mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-16 16:01:36 +10:00
fixes #1068 esp32 S2
Esp32 has seeveral variations on when you can sethostname, might vary with versions so will try to add a best practice for all
This commit is contained in:
+9
-2
@@ -272,13 +272,20 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
DEBUG_WM(F("AutoConnect"));
|
||||
#endif
|
||||
|
||||
// sethostname before wifi ready
|
||||
// https://github.com/tzapu/WiFiManager/issues/1403
|
||||
#ifdef ESP32
|
||||
if(_hostname != ""){
|
||||
setupHostname(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
if(WiFi.getMode() != WIFI_STA){
|
||||
WiFi.mode(WIFI_STA);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if(getWiFiIsSaved()){
|
||||
_startconn = millis();
|
||||
_begin();
|
||||
@@ -287,7 +294,7 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
// https://github.com/tzapu/WiFiManager/issues/1403
|
||||
#ifdef ESP32
|
||||
if(_hostname != ""){
|
||||
setupHostname(true);
|
||||
setupHostname(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user