Retrieve credential from wifimanager

Hi guys! Noob question, I'm very knew here, I'm trying to use wifi manager and modem sleep, but once I turn off the wifi I can't reconnect again. I know what I'm missing is the configuration to connect to the wifi after it has been turned off but I don't know how to do it if I'm using WiFi Manager.

These are the steps:

  • Power on ESP8266
  • Call WiFi Manager and set the credential. Save them for the next time
  • Turn the WiFi Off (In order to collect data from a sensor without power consumption)
  • Collected my data I need to power on the WiFi again and reconnect to it automatically using the previous credentials.

I attached a little code I wrote just to test the reconnection

modem_sleep.ino (3.47 KB)

I have not used the ESP Wifi, so my comments may need to be taken with a pinch of salt!
You appear to check the Wifi Status in Loop and if not connected you call forceSleepWake following which you check the client status and if not connected call reconnect which attempts to reconnect the client.

For the Wifi to be asleep appears to be caused by you calling forceSleepBegin, but before that you call Wifi.disconnect(), it would therefore seem logical that after calling forceSleepWake you should be calling Wifi.autoConnect() before you can expect the client to reconnect surely?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.