khoih-prog / ESPAsync_WiFiManager

This is an ESP32 (including ESP32-S2 and ESP32-C3) / ESP8266 WiFi Connection Manager, using ESPAsyncWebServer, with fallback web configuration portal. Use this library for configuring ESP32, ESP8266 modules' WiFi, etc. Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP WiFi channel. With examples supporting ArduinoJson 6.0.0+ as well as 5.13.5- . Using AsyncDNSServer instead of DNSServer now.
MIT License
291 stars 73 forks source link

ESP 8266 - ConfigPortal in white after few seconds (out of memory) #45

Closed ghost closed 3 years ago

ghost commented 3 years ago

Before all thanks for this great library!.

### Describe the bug

When board turns on and connects any device, the config portal begin and can be configured a wifi access point but portal close quickly (in a few seconds, less than a minute) because an oom - out of memory (checked with arduino ide debugger), this only occurs when I store a byte variable in RTC memory.

A clear and concise description of what the bug is.

ESP8266-12E board starts in AP, I try to connect to a wifi using the config portal and it works but in a few seconds navigation through pages go blank (unusable) and configportal breaks.. I have checked with Arduino debugger tool and get the following:

16:44:42.468 -> wifi evt: 5 16:44:42.739 -> wifi evt: 9 16:44:42.977 -> wifi evt: 7 16:44:43.011 -> wifi evt: 7 16:44:43.113 -> wifi evt: 7 16:44:43.246 -> :urn 56 16:44:43.246 -> :urd 56, 56, 0 16:44:43.279 -> :urn 60 16:44:43.279 -> :urd 60, 60, 0 16:44:43.756 -> :urn 34 16:44:43.756 -> :urch 62, 53 16:44:43.756 -> :urch 143, 45 16:44:43.756 -> :urd 34, 34, 0 16:44:43.756 -> :urd 53, 53, 0 16:44:43.756 -> :ust rc=-13 16:44:43.791 -> :urd 45, 45, 0 16:44:43.791 -> :ust rc=-13 16:44:44.634 -> :urn 30 16:44:44.634 -> :urd 30, 30, 0 16:44:44.634 -> :ust rc=-13 16:44:44.838 -> :urn 40 16:44:44.838 -> :urd 40, 40, 0 16:44:45.009 -> :urn 38 16:44:45.009 -> :urd 38, 38, 0 16:44:46.625 -> :urn 39 16:44:46.625 -> :urd 39, 39, 0 16:44:47.402 -> :urn 53 16:44:47.402 -> :urd 53, 53, 0 16:44:47.470 -> :urn 45 16:44:47.470 -> :urd 45, 45, 0 16:44:47.604 -> :urn 50 16:44:47.604 -> :urd 50, 50, 0 16:44:48.619 -> :urn 30 16:44:48.619 -> :urd 30, 30, 0 16:44:49.742 -> :urn 36 16:44:49.742 -> :urd 36, 36, 0 16:44:50.449 -> wifi evt: 7 16:44:50.483 -> wifi evt: 7 16:44:50.621 -> :urn 43 16:44:50.621 -> :urd 43, 43, 0 16:44:50.824 -> :urn 31 16:44:50.824 -> :urd 31, 31, 0 16:44:52.750 -> :oom(8784)@WString.cpp:182 16:44:55.118 -> :urn 38 16:44:55.118 -> :urd 38, 38, 0 16:44:56.686 -> :urn 39 16:44:56.686 -> :urd 39, 39, 0 16:45:02.579 -> :oom(8464)@WString.cpp:182 16:45:02.579 -> :oom(8464)@WString.cpp:182 16:45:02.579 -> :oom(8464)@WString.cpp:182 16:45:02.579 -> :oom(8368)@WString.cpp:182 16:45:02.579 -> :oom(8432)@WString.cpp:182

### Steps to Reproduce

Adding to Async_AutoConnect_ESP8266_minimal example sketch a RTC variable with RTCMemory library:

Sketch code:

/**** Async_AutoConnect_ESP8266_minimal.ino For ESP8266 / ESP32 boards Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager Licensed under MIT license *****/

if !( defined(ESP8266) )

error This code is intended to run on ESP8266 platform! Please check your Tools->Board setting.

endif

include //https://github.com/khoih-prog/ESPAsync_WiFiManager

include

AsyncWebServer webServer(80); DNSServer dnsServer;

define SERIAL_BAUDRATE 115200

define LED_1 LED_BUILTIN //Cambiar por pin 4 o el que quiera

typedef struct { byte estado; //Con esto sabremos si ejecutar estado 1 (servidor OTA) o estado 2 (borra wifis y resetea ESP8266). Este dato está dentro de la estructura de variables que se guarda en la memoria RTC } MyData;

RtcMemory rtcMemory; // -----------------------------------------------------------------------------

void setup() { // LEDs y Botón pinMode(LED_1, OUTPUT); digitalWrite(LED_1, LOW);

// put your setup code here, to run once: Serial.begin(115200); while (!Serial); delay(200); Serial.print("\nStarting Async_AutoConnect_ESP8266_minimal on " + String(ARDUINO_BOARD)); Serial.println(ESP_ASYNC_WIFIMANAGER_VERSION); //RTC Memory if(rtcMemory.begin()){ Serial.println("RTC initialization done!"); } else { Serial.println("No previous data found. The memory is reset to zeros!"); } // Get the data MyData* data = rtcMemory.getData(); Serial.println(String("En RTC hay guardado: ") + data->estado); ESPAsync_WiFiManager ESPAsync_wifiManager(&webServer, &dnsServer, "AutoConnectAP"); if (data->estado == 2) { ESPAsync_wifiManager.resetSettings(); //reset saved settings data->estado = 0; //Modificamos el contador en RTC rtcMemory.save(); //Guarda el nuevo estado en memoria RTC } //ESPAsync_wifiManager.setAPStaticIPConfig(IPAddress(192,168,186,1), IPAddress(192,168,186,1), IPAddress(255,255,255,0)); ESPAsync_wifiManager.autoConnect("AutoConnectAP"); if (WiFi.status() == WL_CONNECTED) { Serial.print(F("Connected. Local IP: ")); Serial.println(WiFi.localIP()); } else { Serial.println(ESPAsync_wifiManager.getStatus(WiFi.status())); } }

void loop() {

}

### Expected behavior

Espasync_WifiManager config portal doesn't close until a wifi was configured and saved.

### Actual behavior

Configuration portal close fast, it's difficult to to navigate between info page or configure a wifi access successfully (something I've noticed is that even when oom occurs if I was writing my wifi password (doen't update the config page) and save, the connection is successful.

A clear and concise description of what you expected to happen.

Spent the needed time to navigate through the config portal.

### Information

Please ensure to specify the following:

khoih-prog commented 3 years ago

I'm sorry I won't waste time on fixing your out of memory bug.

I suggest you start from the simplest working example, then move on step-by-step to know what causes the severe out of memory issue.

Also check the DRD examples, e.g. Async_ConfigOnDoubleReset

Good Luck,