zhouhan0126 / WIFIMANAGER-ESP32

wifimanager-esp32
MIT License
401 stars 135 forks source link

How to prevent esp from going to AP mode again after save config if it can not connect to SSID #10

Open davidjonz2005 opened 6 years ago

davidjonz2005 commented 6 years ago

i have some application that i want to configure an ESP with my WIFI then i want it always be in client mode even if it does not see any successful AP. Actually i put a button that will make my ESP go to AP mode (never comeback to AP mode automatically)and reset the module. so what can i do to achieve this?

karan6190 commented 6 years ago

So if you want to send to send you esp into StandAlone mode after saving config then you have forcefully change the WiFi.mode while its checking esp status.

WiFiManager.cpp file image

if (connectWifi(_ssid, _pass) != WL_CONNECTED) { DEBUG_WM(F("Failed to connect.")); WiFi.mode(WIFI_STA); }

but just make sure, it will never be in a AP mode again.

davidjonz2005 commented 6 years ago

thanks for reply but it does not work i want to check whether there is a saved config and if there is a config client mode will be active or else AP mode will be active

i read the code but i could not find where the config SSID is saved so i can check it

davidjonz2005 commented 6 years ago

long time passed i ask my question again

where do i have to look in order to find out there is a config already set? and how can I prevent esp from going to AP mode after checking that a config has already been set?