[GH-ISSUE #1119] getWiFiIsSaved() returns true if no WiFi is saved when no reset is called #955

Closed
opened 2026-02-28 01:27:50 +03:00 by kerem · 19 comments
Owner

Originally created by @Lithimlin on GitHub (Sep 1, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1119

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • ESP12 E/F/S (nodemcu, wemos, feather)
  • Other: TTGO T8

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

As the title says, when I call getWiFiIsSaved() it returns true if I don't call resetSettings() before it after startup/deep sleep.
If I reset the settings on the initial startup, the method works as expected, returning false if the AP is exited without configuring WiFi settings. On subsequent startups, however, it returns true if the settings are not reset explicitly.

I would expect it to still return false since no settings have been saved.

Note: Even without the deep sleep, as long as I don't call resetSettings(), getWiFiIsSaved() returns true.

Sketch

#include <WiFiManager.h>

#define uS_TO_S_FACTOR 1000000ULL

WiFiManager wm;

void setup() {
  Serial.begin(115200);
  // put your setup code here, to run once:

  if(esp_sleep_get_wakeup_cause() == 0) {
    wm.resetSettings();
  }
  Serial.println("WiFi saved? " + String(wm.getWiFiIsSaved() ? "YES" : "NO"));

  if(wm.autoConnect("AutoConnectAP","password")) {
    Serial.println("Failed to connect");
    // ESP.restart();
  } else {
    //if you get here you have connected to the WiFi    
    Serial.println("connected...yeey :)");
  }
  
  Serial.println("WiFi saved? " + String(wm.getWiFiIsSaved() ? "YES" : "NO"));

  uint8_t sleepSeconds = 5;
  esp_sleep_enable_timer_wakeup(sleepSeconds * uS_TO_S_FACTOR);
  Serial.println("Sleeping for " + String(sleepSeconds) + " seconds...");
  esp_deep_sleep_start();
}

void loop() {
  // put your main code here, to run repeatedly:

}

Debug Messages

*WM: [1] resetSettings 
*WM: [3] WiFi_enableSTA enable
*WM: [1] SETTINGS ERASED 
WiFi saved? NO
*WM: [1] AutoConnect 
*WM: [1] No Credentials are Saved, skipping connect 
*WM: [2] Starting Config Portal 
*WM: [2] AccessPoint set password is VALID 
*WM: [1] password 
*WM: [3] WiFi station disconnect 
*WM: [3] WiFi_enableSTA enable
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  AutoConnectAP
*WM: [1] SoftAP Configuration 
*WM: [1] -------------------- 
*WM: [1] ssid:             AutoConnectAP
*WM: [1] password:         password
*WM: [1] ssid_len:         13
*WM: [1] channel:          1
*WM: [1] authmode:         3
*WM: [1] ssid_hidden:     
*WM: [1] max_connection:   4
*WM: [1] country:          CN
*WM: [1] beacon_interval:  100(ms)
*WM: [1] -------------------- 
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
*WM: [2] WiFi Scan completed in 3105 ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresulttmp: WL_IDLE_STATUS
*WM: [3] lastconxresult: WL_DISCONNECTED
*WM: [2] Scan is cached 7300 ms ago
*WM: [3] -> 192.168.4.1 
*WM: [2] <- HTTP Exit 
*WM: [3] configportal abort 
*WM: [2] disconnect configportal 
*WM: [2] restoring usermode STA
*WM: [2] wifi status: WL_DISCONNECTED
*WM: [2] wifi mode: STA
*WM: [1] config portal exiting 
connected...yeey :)
WiFi saved? NO
Sleeping for 5 seconds...
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
WiFi saved? YES
*WM: [1] AutoConnect 
*WM: [2] ESP32 event handler enabled 
*WM: [2] Connecting as wifi client... 
*WM: [3] STA static IP:
*WM: [2] setSTAConfig static ip not set, skipping 
*WM: [1] No wifi save required, skipping 
*WM: [2] Connection result: WL_NO_SSID_AVAIL
*WM: [3] lastconxresult: WL_NO_SSID_AVAIL
*WM: [1] AutoConnect: FAILED 
*WM: [2] Starting Config Portal 
*WM: [2] AccessPoint set password is VALID 
*WM: [1] password 
*WM: [3] WiFi station disconnect 
*WM: [3] WiFi_enableSTA enable
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  AutoConnectAP
*WM: [1] SoftAP Configuration 
*WM: [1] -------------------- 
*WM: [1] ssid:             AutoConnectAP
*WM: [1] password:         password
*WM: [1] ssid_len:         13
*WM: [1] channel:          1
*WM: [1] authmode:         3
*WM: [1] ssid_hidden:     
*WM: [1] max_connection:   4
*WM: [1] country:          CN
*WM: [1] beacon_interval:  100(ms)
*WM: [1] -------------------- 
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
*WM: [2] WiFi Scan ASYNC completed in 3305 ms
*WM: [2] WiFi Scan ASYNC found: 38
*WM: [2] WiFi Scan completed in 3306 ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
Originally created by @Lithimlin on GitHub (Sep 1, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1119 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ ] Master - [x] Development **Esp8266/Esp32:** - [ ] ESP8266 - [x] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [ ] ESP12 E/F/S (nodemcu, wemos, feather) - [x] Other: TTGO T8 **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [x] 2.4.0 - [ ] staging (master/dev) ### Description As the title says, when I call `getWiFiIsSaved()` it returns true if I don't call `resetSettings()` before it after startup/deep sleep. If I reset the settings on the initial startup, the method works as expected, returning `false` if the AP is exited without configuring WiFi settings. On subsequent startups, however, it returns `true` if the settings are not reset explicitly. I would expect it to still return `false` since no settings have been saved. Note: Even without the deep sleep, as long as I don't call `resetSettings()`, `getWiFiIsSaved()` returns `true`. ### Sketch ```cpp #include <WiFiManager.h> #define uS_TO_S_FACTOR 1000000ULL WiFiManager wm; void setup() { Serial.begin(115200); // put your setup code here, to run once: if(esp_sleep_get_wakeup_cause() == 0) { wm.resetSettings(); } Serial.println("WiFi saved? " + String(wm.getWiFiIsSaved() ? "YES" : "NO")); if(wm.autoConnect("AutoConnectAP","password")) { Serial.println("Failed to connect"); // ESP.restart(); } else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } Serial.println("WiFi saved? " + String(wm.getWiFiIsSaved() ? "YES" : "NO")); uint8_t sleepSeconds = 5; esp_sleep_enable_timer_wakeup(sleepSeconds * uS_TO_S_FACTOR); Serial.println("Sleeping for " + String(sleepSeconds) + " seconds..."); esp_deep_sleep_start(); } void loop() { // put your main code here, to run repeatedly: } ``` ### Debug Messages ``` *WM: [1] resetSettings *WM: [3] WiFi_enableSTA enable *WM: [1] SETTINGS ERASED WiFi saved? NO *WM: [1] AutoConnect *WM: [1] No Credentials are Saved, skipping connect *WM: [2] Starting Config Portal *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WiFi station disconnect *WM: [3] WiFi_enableSTA enable *WM: [2] Disabling STA *WM: [2] Enabling AP *WM: [1] StartAP with SSID: AutoConnectAP *WM: [1] SoftAP Configuration *WM: [1] -------------------- *WM: [1] ssid: AutoConnectAP *WM: [1] password: password *WM: [1] ssid_len: 13 *WM: [1] channel: 1 *WM: [1] authmode: 3 *WM: [1] ssid_hidden: *WM: [1] max_connection: 4 *WM: [1] country: CN *WM: [1] beacon_interval: 100(ms) *WM: [1] -------------------- *WM: [1] AP IP address: 192.168.4.1 *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 192.168.4.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan completed in 3105 ms *WM: [2] Config Portal Running, blocking, waiting for clients... *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [2] <- HTTP Root *WM: [3] -> 192.168.4.1 *WM: [3] lastconxresulttmp: WL_IDLE_STATUS *WM: [3] lastconxresult: WL_DISCONNECTED *WM: [2] Scan is cached 7300 ms ago *WM: [3] -> 192.168.4.1 *WM: [2] <- HTTP Exit *WM: [3] configportal abort *WM: [2] disconnect configportal *WM: [2] restoring usermode STA *WM: [2] wifi status: WL_DISCONNECTED *WM: [2] wifi mode: STA *WM: [1] config portal exiting connected...yeey :) WiFi saved? NO Sleeping for 5 seconds... ets Jun 8 2016 00:22:57 rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:9720 ho 0 tail 12 room 4 load:0x40080400,len:6352 entry 0x400806b8 WiFi saved? YES *WM: [1] AutoConnect *WM: [2] ESP32 event handler enabled *WM: [2] Connecting as wifi client... *WM: [3] STA static IP: *WM: [2] setSTAConfig static ip not set, skipping *WM: [1] No wifi save required, skipping *WM: [2] Connection result: WL_NO_SSID_AVAIL *WM: [3] lastconxresult: WL_NO_SSID_AVAIL *WM: [1] AutoConnect: FAILED *WM: [2] Starting Config Portal *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WiFi station disconnect *WM: [3] WiFi_enableSTA enable *WM: [2] Disabling STA *WM: [2] Enabling AP *WM: [1] StartAP with SSID: AutoConnectAP *WM: [1] SoftAP Configuration *WM: [1] -------------------- *WM: [1] ssid: AutoConnectAP *WM: [1] password: password *WM: [1] ssid_len: 13 *WM: [1] channel: 1 *WM: [1] authmode: 3 *WM: [1] ssid_hidden: *WM: [1] max_connection: 4 *WM: [1] country: CN *WM: [1] beacon_interval: 100(ms) *WM: [1] -------------------- *WM: [1] AP IP address: 192.168.4.1 *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 192.168.4.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan ASYNC completed in 3305 ms *WM: [2] WiFi Scan ASYNC found: 38 *WM: [2] WiFi Scan completed in 3306 ms *WM: [2] Config Portal Running, blocking, waiting for clients... ```
kerem closed this issue 2026-02-28 01:27:50 +03:00
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

I've traveled down the rabbit hole a bit and found out that getWiFiSSID() returns a specific string when not reset after startup/deep sleep.

Here is the relevant line of code:

Serial.println("WiFi SSID: " + String(wm.getWiFiSSID(true)));

When resetting the settings, the output is

WiFi SSID: 

So there is no SSID saved since it was reset.

Without the reset, the output always is

WiFi SSID: G⸮⸮⸮⸮?P⸮?
<!-- gh-comment-id:684861365 --> @Lithimlin commented on GitHub (Sep 1, 2020): I've traveled down the rabbit hole a bit and found out that `getWiFiSSID()` returns a specific string when not reset after startup/deep sleep. Here is the relevant line of code: ```cpp Serial.println("WiFi SSID: " + String(wm.getWiFiSSID(true))); ``` When resetting the settings, the output is ``` WiFi SSID: ``` So there is no SSID saved since it was reset. Without the reset, the output always is ``` WiFi SSID: G⸮⸮⸮⸮?P⸮? ```
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

This function returns if the esp has credentials stored in flash. Other than that I have no idea what you are doing but it has nothing to do with saving in wifimanager.

Also this function behaves differently on esp32, esp32 does not expose the wifi creds if wifi has not been init yet. It is how the esp32 works,

<!-- gh-comment-id:684861476 --> @tablatronix commented on GitHub (Sep 1, 2020): This function returns if the esp has credentials stored in flash. Other than that I have no idea what you are doing but it has nothing to do with saving in wifimanager. Also this function behaves differently on esp32, esp32 does not expose the wifi creds if wifi has not been init yet. It is how the esp32 works,
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Alternatively, is there a method that connects to a WiFi network when one has been configured and returns an indicator when that fails? What I want to do is connect to a previously configured WiFi network if it is available but not start the AP when that fails.

<!-- gh-comment-id:684863799 --> @Lithimlin commented on GitHub (Sep 1, 2020): Alternatively, is there a method that connects to a WiFi network when one has been configured and returns an indicator when that fails? What I want to do is connect to a previously configured WiFi network if it is available but not start the AP when that fails.
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

They way to use this would be to always start the CP if wifiissaved == false; meaning there are no credentials saved in this esp and it is new or erased

<!-- gh-comment-id:684863858 --> @tablatronix commented on GitHub (Sep 1, 2020): They way to use this would be to always start the CP if wifiissaved == false; meaning there are no credentials saved in this esp and it is new or erased
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

if wifiissaved()
wifi.begin()

Or you can use autoconnect and use the disablecp settting

See the dev/ examples for almost all options

<!-- gh-comment-id:684864311 --> @tablatronix commented on GitHub (Sep 1, 2020): if wifiissaved() wifi.begin() Or you can use autoconnect and use the disablecp settting See the dev/ examples for almost all options
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

So have an extra RTC_DATA_ATTR bool wifiConfigured variable to externally keep track of whether it has been configured before?

<!-- gh-comment-id:684866754 --> @Lithimlin commented on GitHub (Sep 1, 2020): So have an extra `RTC_DATA_ATTR bool wifiConfigured` variable to externally keep track of whether it has been configured before?
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Or you can use autoconnect and use the disablecp settting

I'm confused what you mean.
I assume you mean config portal when you say CP. So does that mean that if I disable the CP, the ESP will also not start a soft AP and just try to connect to the stored WiFi network?

<!-- gh-comment-id:684869416 --> @Lithimlin commented on GitHub (Sep 1, 2020): > Or you can use autoconnect and use the disablecp settting I'm confused what you mean. I assume you mean config portal when you say CP. So does that mean that if I disable the CP, the ESP will also not start a soft AP and just try to connect to the stored WiFi network?
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

Yes well config portal

<!-- gh-comment-id:684874792 --> @tablatronix commented on GitHub (Sep 1, 2020): Yes well config portal
Author
Owner
<!-- gh-comment-id:684877917 --> @tablatronix commented on GitHub (Sep 1, 2020): https://github.com/tzapu/WiFiManager/blob/development/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino#L251
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

oops that not it

<!-- gh-comment-id:684878536 --> @tablatronix commented on GitHub (Sep 1, 2020): oops that not it
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Using wm.setCaptivePortalEnable(false); does not actually disable the soft AP though (I just tried it and that does make sense). So what is the correct way to do it?
As it is now, the code above (wm.autoConnect("AutoConnectAP","password")) always starts a soft AP if there is no WiFi config saved, even when disabling the captive portal. I have not found a method to disable the config portal itself. The only thing I found was stopConfigPortal() but since autoConnect(...) is blocking, calling that won't help.

<!-- gh-comment-id:684878714 --> @Lithimlin commented on GitHub (Sep 1, 2020): Using `wm.setCaptivePortalEnable(false);` does not actually disable the soft AP though (I just tried it and that does make sense). So what is the correct way to do it? As it is now, the code above (`wm.autoConnect("AutoConnectAP","password")`) always starts a soft AP if there is no WiFi config saved, even when disabling the captive portal. I have not found a method to disable the config portal itself. The only thing I found was `stopConfigPortal()` but since `autoConnect(...)` is blocking, calling that won't help.
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

// if true (default) then start the config portal from autoConnect if connection failed
    void          setEnableConfigPortal(boolean enable);

Sorry about that, its actually not in that example, Ill add it!

<!-- gh-comment-id:684879240 --> @tablatronix commented on GitHub (Sep 1, 2020): ```C++ // if true (default) then start the config portal from autoConnect if connection failed void setEnableConfigPortal(boolean enable); ``` Sorry about that, its actually not in that example, Ill add it!
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Ah! Thanks a lot! That's probably what I was looking for.
Quick question: Does it also prevent the explicit starting of a config portal via wm.startConfigPortal?

<!-- gh-comment-id:684881290 --> @Lithimlin commented on GitHub (Sep 1, 2020): Ah! Thanks a lot! That's probably what I was looking for. Quick question: Does it also prevent the explicit starting of a config portal via `wm.startConfigPortal`?
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

no, good point, maybe auto* would be a better name

<!-- gh-comment-id:684881420 --> @tablatronix commented on GitHub (Sep 1, 2020): no, good point, maybe auto* would be a better name
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Yes! This method was what I was looking for. Although, is it intended that autoConnect returns true when it didn't connect to anything and the config portal is disabled?

<!-- gh-comment-id:684883623 --> @Lithimlin commented on GitHub (Sep 1, 2020): Yes! This method was what I was looking for. Although, is it intended that `autoConnect` returns true when it didn't connect to anything and the config portal is disabled?
Author
Owner

@tablatronix commented on GitHub (Sep 1, 2020):

hmm, i would not think so, that sounds wrong.
is that what you are seeing ?

<!-- gh-comment-id:684894563 --> @tablatronix commented on GitHub (Sep 1, 2020): hmm, i would not think so, that sounds wrong. is that what you are seeing ?
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Yes, here's the updated code:

#include <WiFiManager.h>

#define uS_TO_S_FACTOR 1000000ULL

WiFiManager wm;

void setup() {
  Serial.begin(115200);
  // put your setup code here, to run once:

  if(esp_sleep_get_wakeup_cause() == 0) {
    wm.resetSettings();
  } else {
    wm.setEnableConfigPortal(false);
  }

  if(wm.autoConnect("AutoConnectAP","password")) {
    Serial.println("Failed to connect");
  } else {
    //if you get here you have connected to the WiFi    
    Serial.println("connected...yeey :)");
  }

  uint8_t sleepSeconds = 5;
  esp_sleep_enable_timer_wakeup(sleepSeconds * uS_TO_S_FACTOR);
  Serial.println("Sleeping for " + String(sleepSeconds) + " seconds...");
  esp_deep_sleep_start();
}

void loop() {
  // put your main code here, to run repeatedly:

}

I immediately exit the config portal the first time, without configuring the WiFi and get the following output:

*WM: [1] resetSettings 
*WM: [3] WiFi_enableSTA enable
*WM: [1] SETTINGS ERASED 
*WM: [1] AutoConnect 
*WM: [1] No Credentials are Saved, skipping connect 
*WM: [2] Starting Config Portal 
*WM: [2] AccessPoint set password is VALID 
*WM: [1] password 
*WM: [3] WiFi station disconnect 
*WM: [3] WiFi_enableSTA enable
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  AutoConnectAP
*WM: [1] SoftAP Configuration 
*WM: [1] -------------------- 
*WM: [1] ssid:             AutoConnectAP
*WM: [1] password:         password
*WM: [1] ssid_len:         13
*WM: [1] channel:          1
*WM: [1] authmode:         3
*WM: [1] ssid_hidden:     
*WM: [1] max_connection:   4
*WM: [1] country:          CN
*WM: [1] beacon_interval:  100(ms)
*WM: [1] -------------------- 
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
*WM: [2] WiFi Scan completed in 3105 ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
*WM: [2] NUM CLIENTS: 0 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresulttmp: WL_IDLE_STATUS
*WM: [3] lastconxresult: WL_DISCONNECTED
*WM: [2] WiFi Scan completed in 3706 ms
*WM: [3] -> connectivitycheck.platform.hicloud.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Exit 
*WM: [3] configportal abort 
*WM: [2] disconnect configportal 
*WM: [2] restoring usermode STA
*WM: [2] wifi status: WL_DISCONNECTED
*WM: [2] wifi mode: STA
*WM: [1] config portal exiting 
connected...yeey :)
Sleeping for 5 seconds...
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
*WM: [1] AutoConnect 
*WM: [2] ESP32 event handler enabled 
*WM: [2] Connecting as wifi client... 
*WM: [3] STA static IP:
*WM: [2] setSTAConfig static ip not set, skipping 
*WM: [1] No wifi save required, skipping 
*WM: [2] Connection result: WL_NO_SSID_AVAIL
*WM: [3] lastconxresult: WL_NO_SSID_AVAIL
connected...yeey :)
Sleeping for 5 seconds...

So it actually also returns true the first time around when I simply exit the CP.

<!-- gh-comment-id:684896952 --> @Lithimlin commented on GitHub (Sep 1, 2020): Yes, here's the updated code: ```cpp #include <WiFiManager.h> #define uS_TO_S_FACTOR 1000000ULL WiFiManager wm; void setup() { Serial.begin(115200); // put your setup code here, to run once: if(esp_sleep_get_wakeup_cause() == 0) { wm.resetSettings(); } else { wm.setEnableConfigPortal(false); } if(wm.autoConnect("AutoConnectAP","password")) { Serial.println("Failed to connect"); } else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } uint8_t sleepSeconds = 5; esp_sleep_enable_timer_wakeup(sleepSeconds * uS_TO_S_FACTOR); Serial.println("Sleeping for " + String(sleepSeconds) + " seconds..."); esp_deep_sleep_start(); } void loop() { // put your main code here, to run repeatedly: } ``` I immediately exit the config portal the first time, without configuring the WiFi and get the following output: ``` *WM: [1] resetSettings *WM: [3] WiFi_enableSTA enable *WM: [1] SETTINGS ERASED *WM: [1] AutoConnect *WM: [1] No Credentials are Saved, skipping connect *WM: [2] Starting Config Portal *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WiFi station disconnect *WM: [3] WiFi_enableSTA enable *WM: [2] Disabling STA *WM: [2] Enabling AP *WM: [1] StartAP with SSID: AutoConnectAP *WM: [1] SoftAP Configuration *WM: [1] -------------------- *WM: [1] ssid: AutoConnectAP *WM: [1] password: password *WM: [1] ssid_len: 13 *WM: [1] channel: 1 *WM: [1] authmode: 3 *WM: [1] ssid_hidden: *WM: [1] max_connection: 4 *WM: [1] country: CN *WM: [1] beacon_interval: 100(ms) *WM: [1] -------------------- *WM: [1] AP IP address: 192.168.4.1 *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 192.168.4.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan completed in 3105 ms *WM: [2] Config Portal Running, blocking, waiting for clients... *WM: [2] NUM CLIENTS: 0 *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [2] <- HTTP Root *WM: [3] -> 192.168.4.1 *WM: [3] lastconxresulttmp: WL_IDLE_STATUS *WM: [3] lastconxresult: WL_DISCONNECTED *WM: [2] WiFi Scan completed in 3706 ms *WM: [3] -> connectivitycheck.platform.hicloud.com *WM: [2] <- Request redirected to captive portal *WM: [2] <- HTTP Exit *WM: [3] configportal abort *WM: [2] disconnect configportal *WM: [2] restoring usermode STA *WM: [2] wifi status: WL_DISCONNECTED *WM: [2] wifi mode: STA *WM: [1] config portal exiting connected...yeey :) Sleeping for 5 seconds... ets Jun 8 2016 00:22:57 rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:9720 ho 0 tail 12 room 4 load:0x40080400,len:6352 entry 0x400806b8 *WM: [1] AutoConnect *WM: [2] ESP32 event handler enabled *WM: [2] Connecting as wifi client... *WM: [3] STA static IP: *WM: [2] setSTAConfig static ip not set, skipping *WM: [1] No wifi save required, skipping *WM: [2] Connection result: WL_NO_SSID_AVAIL *WM: [3] lastconxresult: WL_NO_SSID_AVAIL connected...yeey :) Sleeping for 5 seconds... ``` So it actually also returns true the first time around when I simply exit the CP.
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

Well, nevermind that, I was missing a ! in front of the wm.autoConnect(...), so it's actually always returning false as it should

<!-- gh-comment-id:684897968 --> @Lithimlin commented on GitHub (Sep 1, 2020): Well, nevermind that, I was missing a `!` in front of the `wm.autoConnect(...)`, so it's actually always returning false as it should
Author
Owner

@Lithimlin commented on GitHub (Sep 1, 2020):

So thanks for the help!

<!-- gh-comment-id:684898751 --> @Lithimlin commented on GitHub (Sep 1, 2020): So thanks for the help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#955
No description provided.