mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Fix setHostname for DHCP requests
This commit is contained in:
parent
218e81d29c
commit
f5c45272e5
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if HASP_USE_WIFI>0
|
#if HASP_USE_WIFI > 0
|
||||||
|
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_config.h"
|
#include "hasp_config.h"
|
||||||
@ -153,7 +153,12 @@ void wifiSetup()
|
|||||||
WiFi.onEvent(wifi_callback);
|
WiFi.onEvent(wifi_callback);
|
||||||
WiFi.setSleep(false);
|
WiFi.setSleep(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WiFi.disconnect(true);
|
||||||
|
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
||||||
|
WiFi.setHostname(mqttGetNodename().c_str());
|
||||||
WiFi.begin(wifiSsid, wifiPassword);
|
WiFi.begin(wifiSsid, wifiPassword);
|
||||||
|
|
||||||
Log.notice(F("WIFI: Connecting to : %s"), wifiSsid);
|
Log.notice(F("WIFI: Connecting to : %s"), wifiSsid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +176,12 @@ bool wifiEvery5Seconds()
|
|||||||
dispatchReboot(false);
|
dispatchReboot(false);
|
||||||
}
|
}
|
||||||
Log.warning(F("WIFI: No Connection... retry %u"), wifiReconnectCounter);
|
Log.warning(F("WIFI: No Connection... retry %u"), wifiReconnectCounter);
|
||||||
if(wifiReconnectCounter % 6 == 0) WiFi.begin(wifiSsid, wifiPassword);
|
if(wifiReconnectCounter % 6 == 0) {
|
||||||
|
WiFi.disconnect(true);
|
||||||
|
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
||||||
|
WiFi.setHostname(mqttGetNodename().c_str());
|
||||||
|
WiFi.begin(wifiSsid, wifiPassword);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user