diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp index 6cf361b47e..42d951cb8f 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp @@ -129,9 +129,15 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch strcpy(reinterpret_cast(conf.password), passphrase); } - struct softap_config conf_current; - wifi_softap_get_config(&conf_current); - if(!softap_config_equal(conf, conf_current)) { + struct softap_config conf_compare; + if(WiFi._persistent){ + wifi_softap_get_config_default(&conf_compare); + } + else { + wifi_softap_get_config(&conf_compare); + } + + if(!softap_config_equal(conf, conf_compare)) { ETS_UART_INTR_DISABLE(); if(WiFi._persistent) { diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp index effe473a72..bea45bc36e 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp @@ -316,7 +316,11 @@ bool ESP8266WiFiGenericClass::getPersistent(){ * @param m WiFiMode_t */ bool ESP8266WiFiGenericClass::mode(WiFiMode_t m) { - if(wifi_get_opmode() == (uint8) m) { + if(_persistent){ + if(wifi_get_opmode() == (uint8) m && wifi_get_opmode_default() == (uint8) m){ + return true; + } + } else if(wifi_get_opmode() == (uint8) m){ return true; } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp index de79e7cc21..601b4aeb43 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp @@ -138,9 +138,15 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase, conf.bssid_set = 0; } - struct station_config current_conf; - wifi_station_get_config(¤t_conf); - if(sta_config_equal(current_conf, conf)) { + struct station_config conf_compare; + if(WiFi._persistent){ + wifi_station_get_config_default(&conf_compare); + } + else { + wifi_station_get_config(&conf_compare); + } + + if(sta_config_equal(conf_compare, conf)) { DEBUGV("sta config unchanged"); } else {