Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESPAsyncWiFiManager forgets data after reboot #83

Open
dansiebert opened this issue Jun 8, 2021 · 10 comments
Open

ESPAsyncWiFiManager forgets data after reboot #83

dansiebert opened this issue Jun 8, 2021 · 10 comments

Comments

@dansiebert
Copy link

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
Copy link

MassiPi commented Jun 9, 2021

Hello,
i think i found the reason. It is a wanted modification in the 3.0.0 core
esp8266/Arduino#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
Copy link

MassiPi commented Jun 9, 2021

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

  • include in the resetSettings function, just before the disconnect(true), a WiFi.persistent(true)
  • there is also a typo in the first page in the definition of the configModeCallback. The variable tipe should be AsyncWiFiManager, not WiFiManager, or you'll get a compile error

@me-cooper
Copy link

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
Copy link

MassiPi commented Jul 2, 2021

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
Copy link

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
Copy link

mdwarby commented Jul 25, 2021

in the example add

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

and it persist the settings

@hmronline
Copy link
Contributor

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

@alanswx
Copy link
Owner

alanswx commented Aug 3, 2021

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

@numericOverflow
Copy link

@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
Copy link

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!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants