diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 14b44d9..dd91b49 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -172,13 +172,14 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) { WiFi.hostname(_hostname); #elif defined(ESP32) WiFi.setHostname(_hostname); - if(WiFi.status() == WL_CONNECTED){ - DEBUG_WM("reconnecting to set new hostname"); - // WiFi.reconnect(); // does not reset dhcp - WiFi_Disconnect(); - delay(500); // need a delay for disconnect to change status() - } #endif + + if(WiFi.status() == WL_CONNECTED){ + DEBUG_WM("reconnecting to set new hostname"); + // WiFi.reconnect(); // does not reset dhcp + WiFi_Disconnect(); + delay(500); // need a delay for disconnect to change status() + } } // if already connected, or try stored connect diff --git a/WiFiManager.h b/WiFiManager.h index 3bdec84..5cb7de3 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -226,7 +226,7 @@ class WiFiManager boolean _cpClientCheck = false; // keep cp alive if cp have station boolean _webClientCheck = true; // keep cp alive if web have client boolean _scanDispOptions = false; // show percentage in scans not icons - const char * _hostname = ""; + const char * _hostname = "wmtest"; const char* _customHeadElement = ""; // store custom head element html from user