diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 5488cbf..ded4e25 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -717,7 +717,9 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo // HANDLE issues with STA connections, shutdown sta if not connected, or else this will hang channel scanning and softap will not respond if(_disableSTA || (!WiFi.isConnected() && _disableSTAConn)){ // this fixes most ap problems, however, simply doing mode(WIFI_AP) does not work if sta connection is hanging, must `wifi_station_disconnect` - WiFi.mode(WIFI_AP_STA); + #ifdef WM_DISCONWORKAROUND + WiFi.mode(WIFI_AP_STA); + #endif WiFi_Disconnect(); WiFi_enableSTA(false); #ifdef WM_DEBUG_LEVEL diff --git a/WiFiManager.h b/WiFiManager.h index 1911516..08643a6 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -659,6 +659,7 @@ class WiFiManager #if defined(ESP_ARDUINO_VERSION) && defined(ESP_ARDUINO_VERSION_VAL) #define WM_ARDUINOVERCHECK ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) + #define WM_ARDUINOVERCHECK_204 ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 5) #ifdef WM_ARDUINOVERCHECK #define WM_ARDUINOEVENTS @@ -667,6 +668,10 @@ class WiFiManager #define WM_NOCOUNTRY #endif + #ifdef WM_ARDUINOVERCHECK_204 + #define WM_DISCONWORKAROUND + #endif + #else #define WM_NOCOUNTRY #endif