mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-17 08:31:31 +10:00
Fix hostname #1403
This commit is contained in:
+10
-4
@@ -275,6 +275,12 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
_startconn = millis();
|
||||
_begin();
|
||||
|
||||
// sethostname before wifi ready
|
||||
// https://github.com/tzapu/WiFiManager/issues/1403
|
||||
if(_hostname != ""){
|
||||
setupHostname(true);
|
||||
}
|
||||
|
||||
// attempt to connect using saved settings, on fail fallback to AP config portal
|
||||
if(!WiFi.enableSTA(true)){
|
||||
// handle failure mode Brownout detector etc.
|
||||
@@ -298,9 +304,9 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
WiFi_autoReconnect();
|
||||
|
||||
// set hostname before stating
|
||||
if(_hostname != ""){
|
||||
setupHostname(true);
|
||||
}
|
||||
// if(_hostname != ""){
|
||||
// setupHostname(true);
|
||||
// }
|
||||
|
||||
// if already connected, or try stored connect
|
||||
// @note @todo ESP32 has no autoconnect, so connectwifi will always be called unless user called begin etc before
|
||||
@@ -386,7 +392,7 @@ bool WiFiManager::setupHostname(bool restart){
|
||||
#endif
|
||||
#elif defined(ESP32)
|
||||
// @note hostname must be set after STA_START
|
||||
delay(200); // do not remove, give time for STA_START
|
||||
// @note, this may have changed at some point, now it wont work, I have to set it before.
|
||||
|
||||
#ifdef WM_DEBUG_LEVEL
|
||||
DEBUG_WM(DEBUG_VERBOSE,F("Setting WiFi hostname"));
|
||||
|
||||
Reference in New Issue
Block a user