Closed bit4man closed 3 years ago
I figured out what I did wrong with the DEBUG - moved the define up before the #include - here's the debug information:
17:30:03.174 -> Starting AutoConnect_ESP8266_minimal on ESP8266_NODEMCU
17:30:03.174 -> ESP_WiFiManager v1.5.3
17:30:03.174 -> [WM] RFC925 Hostname = mysleepdemo
17:30:03.207 -> [WM]
17:30:03.207 -> AutoConnect using previously saved SSID/PW, but keep previous settings
17:30:03.273 -> [WM] Connect to previous WiFi using new IP parameters
17:30:03.273 -> [WM] Waiting WiFi connection with time out
17:30:13.271 -> [WM] Connection timed out
17:30:13.371 -> [WM] Connection result: WL_DISCONNECTED
17:31:23.384 -> [WM] WiFi.waitForConnectResult Done
17:31:23.384 -> [WM] SET AP
17:31:23.483 -> [WM] Configuring AP SSID = AutoConnectAP
17:31:24.080 -> [WM] AP IP address = 192.168.4.1
17:31:24.080 -> [WM] HTTP server started
17:31:24.080 -> [WM] ESP_WiFiManager::startConfigPortal : Enter loop
17:31:53.555 -> [WM] Waiting WiFi connection with time out
17:31:57.957 -> [WM] Timed out connection result: WL_CONNECTED
17:31:57.957 -> Connected. Local IP: 192.168.18.91
17:31:57.957 -> Time to wakeup: 114974ms
17:31:57.957 -> [WM] freeing allocated params!
I didn't attempt to reconnect etc - just letting it time out. Notice that eventually it does connect to the configuration eventually after going into AP mode. I have a few tests where it jumps the AP mode and goes straight to the connection after the initial timeout.
I'm suspecting that the period between sleep mode and when the WiFi is attempted to be restarted is too short. Is that something that needs to be addressed?
I can confirm that adding a delay(2000) before initializing ESP WiFiManager makes resuming after deep-sleep work. Not sure what status/feature isn't ready but there probably should be a test in the library?
It's good that you partially figure out what's wrong with your code as this issue has nothing to do with the library.
Please do more research on Deep Sleep, and you can try the reliable SmartFarm_DeepSleep example in my other SmallProjects library.
I'm closing this issue as it's not a bug of this library.
Good Luck,
Thanks for the link - but I'm not seeing how it uses deepsleep any different from my example. The code seems to be a lot more focused on where/how to save state - and if that's what you want me to learn, then indeed the ESP_WifiManager is not doing it wrong - but I doubt that's what you want me to see. This code basically reads from internal memory (RTC) that's kept stateful during shutdown to remember parameters - my simple setup doesn't have state data outside of what's in WiFi_Manager which does work when powering on "the first time".
So in my opinion this is an issue with how WiFiManager initializes and I only wanted to let you know about it. I have a work-around for now, so I'll move on.
Describe the bug
I have a simple test sketch testing a setup with a PIR event to wake an ESP8266 (NodeMCU) up after deep-sleep:
I can reproduce the problem without the PIR involved by simply connecting RST to D0 with a pullup resistor (10K). I then short the line with a switch pulling RST low, which causes the unit to reset.
When "config()" is resumed, things hang here:
With the timeouts implemented it finally resumes.
If I hit the RST button on the NodeMCU, a bit randomly it will resume/connect within 800-1200ms and operate as expected. I've attempted setting the debug mode on the WiFiManager module but I do not see any output on the serial console. Please advice if there's a way I can provide better information.
Steps to Reproduce
Implement the above sketch, add a 10K resistor to RST and connect RST to D0. Have a switch or wire to pull RST to ground on demand.
Expected behavior
A full reconnect using the WiFiManager stored SSID and credentials with no timeout.
Actual behavior
See description.
Information
Please ensure to specify the following: