From f1fd553ac66edc205d9fc880ba475ce0a9b37b58 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 19 Jul 2018 08:40:46 -0500 Subject: [PATCH] fix autoreconnect, forgot we use event for other stuff --- WiFiManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 838b45a..1a2521a 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2437,7 +2437,9 @@ void WiFiManager::WiFiEvent(WiFiEvent_t event,system_event_info_t info){ } else _lastconxresulttmp = WiFi.status(); // if(info.disconnected.reason == WIFI_REASON_NO_AP_FOUND) Serial.println("*WM: EVENT: WIFI_REASON: NO_AP_FOUND"); // Serial.println("*WM: Event: SYSTEM_EVENT_STA_DISCONNECTED, reconnecting"); - WiFi.reconnect(); + #ifdef esp32autoreconnect + WiFi.reconnect(); + #endif } } #endif @@ -2445,7 +2447,7 @@ void WiFiManager::WiFiEvent(WiFiEvent_t event,system_event_info_t info){ void WiFiManager::WiFi_autoReconnect(){ #ifdef ESP8266 WiFi.setAutoReconnect(_wifiAutoReconnect); - #elif defined(ESP32) && defined(esp32autoreconnect) + #elif defined(ESP32) if(_wifiAutoReconnect){ DEBUG_WM(DEBUG_VERBOSE,"ESP32 event handler enabled"); WiFi.onEvent(WiFiEvent);