alanswx / ESPAsyncWiFiManager

Port WiFiManager to ESP Async Server
MIT License
224 stars 86 forks source link

ESPAsyncWiFiManager forgets data after reboot #83

Open dansiebert opened 3 years ago

dansiebert commented 3 years ago

I have the problem that the Wemos D1 mini (ESP8266) forgets the wifi data after every reboot. Usually the once entered data is saved. However, this only happens after updating Core in PlatformIO to espressif@3.0.0. If I switch back to espressif8266@2.6.3, it works. Is it possible that with Core 3.0.0 there is a problem with the file system in the flash of the ESP8266? Is SPIFFS unsupported any more? I ask, because I think, that ESPAsyncWebServer uses SPIFFS. There are at least warning messages while compiling. And ESPAsyncWiFiManager uses ESPAsyncWebServer, right?

MassiPi commented 3 years ago

Hello, i think i found the reason. It is a wanted modification in the 3.0.0 core https://github.com/esp8266/Arduino/pull/7902 Probably we should add back the WiFi.persistent(true) to get the previous behaviour. I think it should be enough to add this when the captive portal is enabled, not always (once credentials are stored, they can be used by a simple wifi.begin()) (i forgot: and also before the disconnect. Reference in the manual: https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html ) i'll give a try this evening.. bye!

MassiPi commented 3 years ago

Yes, it seems it works. I took advantage of the callbacks: in the configModeCallback (since this is called upon connection fail) i enabled the persistency. in the setSaveConfigCallback (since this is called when the connection is estabilished) i disabled the persistency you also have to enable persistency right before the resetSettings

Suggestion for @dansiebert

me-cooper commented 3 years ago

forgets the wifi data after every reboot

For me it's ESP01-S. Same issue. ESP8266 3.0.0.

I tried what @MassiPi suggested. For me it doesn't work. If I am using esp8266 2.6.3 it does save credentials well. I

MassiPi commented 3 years ago

with 3.0.0 they removed the default "persistent(true)", that's why it does not save credentials (or save them) between reboots i can only suggest you to add a WiFi.persistent(true) before every need to save (or delete) credentials. Or just try enabling it for everything, but it's definitely the solution Ciao

numericOverflow commented 3 years ago

I've got the same issue, but I'm confused about where the changes need to be made to correct the problem and persist the SSID/password

mdwarby commented 3 years ago

in the example add

WiFi.persistent(true); just before AsyncWiFiManager wifiManager(&server,&dns);

and it persist the settings

hmronline commented 3 years ago

@dansiebert proposed solutions do work, were you able to test any of them ?

alanswx commented 3 years ago

I did not. I am not at home and don’t have a test setup.

numericOverflow commented 3 years ago

@dansiebert proposed solutions do work, were you able to test any of them ?

@hmronline, I added the line as suggested by @mdwarby you my code and it seems to work. I haven't tested too much, but had a chance last night to reflash and the WiFi connection persisted across several reboots.

jmcastillejo commented 2 years ago

in the example add

WiFi.persistent(true); just before AsyncWiFiManager wifiManager(&server,&dns);

and it persist the settings

This solution work for me, many thanks!!