diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 78c9ed843..d271de1cc 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -379,18 +379,16 @@ String WifiGetIPv6(void) #endif // LWIP_IPV6=1 // Check to see if we have any routable IP address -inline bool WifiCheck_hasIP(IPAddress const & ip_address) -{ +bool WifiHasIP(void) { #ifdef LWIP2_IPV6 return !a.isLocal(); #else - return static_cast(ip_address) != 0; + return (uint32_t)WiFi.localIP() != 0; #endif } -void WifiCheckIp(void) -{ - if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP())) { +void WifiCheckIp(void) { + if ((WL_CONNECTED == WiFi.status()) && WifiHasIP()) { WifiSetState(1); Wifi.counter = WIFI_CHECK_SEC; Wifi.retry = Wifi.retry_init; @@ -520,7 +518,7 @@ void WifiCheck(uint8_t param) Wifi.counter = WIFI_CHECK_SEC; WifiCheckIp(); } - if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP()) && !Wifi.config_type) { + if ((WL_CONNECTED == WiFi.status()) && WifiHasIP() && !Wifi.config_type) { WifiSetState(1); if (Settings->flag3.use_wifi_rescan) { // SetOption57 - Scan wifi network every 44 minutes for configured AP's if (!(TasmotaGlobal.uptime % (60 * WIFI_RESCAN_MINUTES))) { diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index fbb83954f..20d857c50 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -105,7 +105,7 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM = "}"; const char HTTP_SCRIPT_HIDE[] PROGMEM = - "function hidBtns() {" + "function hidBtns(){" "eb('butmo').style.display='none';" "eb('butmod').style.display='none';" "eb('but0').style.display='block';" @@ -3549,7 +3549,7 @@ bool Xdrv01(uint8_t function) if (Web.wifi_test_counter) { Web.wifi_test_counter--; AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_TRYING_TO_CONNECT " %s"), SettingsText(SET_STASSID1)); - if ( WifiCheck_hasIP(WiFi.localIP()) ) { // Got IP - Connection Established + if (WifiHasIP()) { // Got IP - Connection Established Web.wifi_test_AP_TIMEOUT = false; Web.wifi_test_counter = 0; Web.wifiTest = WIFI_TEST_FINISHED; diff --git a/tasmota/xdrv_62_improv.ino b/tasmota/xdrv_62_improv.ino index 12d895cf2..0f03bbff8 100644 --- a/tasmota/xdrv_62_improv.ino +++ b/tasmota/xdrv_62_improv.ino @@ -293,7 +293,7 @@ void ImprovEverySecond(void) { if (Improv.wifi_timeout) { Improv.wifi_timeout--; if (Improv.wifi_timeout < IMPROV_WIFI_TIMEOUT -3) { // Tasmota restarts after ssid or password change - if ((!TasmotaGlobal.global_state.wifi_down)) { + if (WifiHasIP()) { Improv.wifi_timeout = 0; if (IMPROV_STATE_AUTHORIZED == RtcSettings.improv_state) { RtcSettings.improv_state = IMPROV_STATE_PROVISIONED;