mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-28 01:25:49 +03:00
[GH-ISSUE #1796] AP mode I connect to ESP32 and configure WiFi, after several auto reconnections it Damages the memory(?), maybe because of WiFiManager #1510
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1510
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @szczepul on GitHub (Jan 26, 2025).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1796
Problem Description:
While using the WiFiManager library on the ESP32-WROOM-32D module, I encountered the following issue: after several cycles of disconnecting and reconnecting to a previously configured access point, the module becomes unresponsive. This manifests as a black screen and no response to button presses. The configuration page also becomes inaccessible.
Additionally, after such a state, it is necessary to reflash the program with the full flash memory erase option enabled. Without this, after restarting, the program operates in a completely unstable manner.
Attempts to Resolve:
Unfortunately, these actions did not yield the desired results.
Technical Details:
I kindly request assistance in resolving this issue or guidance on steps to diagnose and fix it.
Thank you in advance for your help.
From Wifimanager 192.168.4.1/info:
`esp32
Uptime
4 mins 3 secs
Chip ID
a9286f24
Chip rev
100
Flash size
4194304 bytes
PSRAM Size
0 bytes
CPU frequency
240MHz
Memory - Free heap
216912 bytes available
Memory - Sketch size
Used / Total bytes
1046992 / 2357712
Temperature
66.67 C° / 177.60 F°
WiFi
Connected
No
Station SSID
Station IP
0.0.0.0
Station gateway
0.0.0.0
Station subnet
0.0.0.0
DNS Server
0.0.0.0
Hostname
esp32-A97894
Station MAC
24:6F:28:A9:78:94
Access point IP
192.168.4.1
Access point MAC
24:6F:28:A9:78:95
Access point hostname
espressif
BSSID
About
WiFiManager
v2.0.17
Arduino
3.1.1
Build date
Jan 25 2025 20:14:58
`
and my code Arduino IDE , Oled ssd1309
`/*
V2
Wersja testy_Ap_wifi 2
Pod projekt ORI oraz NaraTEMeratury
osiągnięto:
*/
#include <WiFi.h>
#include <WiFiManager.h>
#include <U8g2lib.h>
#include <Wire.h>
// Definicje pinów dla przycisków
#define BUTTON_UP 32
#define BUTTON_DOWN 33
#define BUTTON_SELECT 27
// Inicjalizacja wyświetlacza OLED
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE);
// Zmienne globalne
String currentMenu = "MAIN";
int currentMenuOption = 0;
bool isAPMode = false;
unsigned long lastDisplayUpdate = 0;
const unsigned long displayUpdateInterval = 500;
unsigned long lastWiFiCheckTime = 0;
unsigned long wifiCheckInterval = 15000; // 15 sekund
unsigned long apStartTime = 0;
unsigned long apTimeout = 180000; // 3 minuty
unsigned long buttonPressTime = 0;
bool buttonHeld = false;
bool wrongPassword = false; // Flaga dla złego hasła Wi-Fi
WiFiManager wifiManager;
WiFiManagerParameter customAPTimeout("apTimeout", "Czas trybu AP (ms) min.120000: ", "180000", 7);
WiFiManagerParameter customWiFiScanInterval("wifiCheckInterval", "Interwał skanowania WiFi (ms)", "15000", 7);
void setup() {
WiFi.setHostname("MyESP32Device");
}
void loop() {
unsigned long currentMillis = millis();
}
void enableAPMode() {
WiFi.disconnect();
WiFi.mode(WIFI_AP);
WiFi.softAP("ORI_setupWWW");
isAPMode = true;
apStartTime = millis();
Serial.println("Tryb AP włączony.");
}
void disableAPMode() {
WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA);
isAPMode = false;
Serial.println("Tryb AP wyłączony.");
}
void handleAPButton() {
if (digitalRead(BUTTON_SELECT) == LOW) {
if (!buttonHeld) {
buttonPressTime = millis();
buttonHeld = true;
} else if (millis() - buttonPressTime >= 2500) {
if (!isAPMode) {
enableAPMode();
} else {
disableAPMode();
}
buttonHeld = false; // Zapobiega wielokrotnemu włączeniu/wyłączeniu
}
} else {
buttonHeld = false;
}
}
bool checkForSavedWiFi() {
int n = WiFi.scanNetworks(); // Skanowanie sieci
if (n == 0) {
Serial.println("Brak dostępnych sieci Wi-Fi.");
return false;
}
}
void displayCurrentState() {
u8g2.clearBuffer();
}
void handleButtons() {
static unsigned long lastButtonPress = 0;
unsigned long currentMillis = millis();
}
`