WiFi.disconnect on wifiOff
This commit is contained in:
parent
38ebd8d32a
commit
8bae83ea32
@ -57,6 +57,7 @@ void wifiSetupOTA() {
|
||||
void wifiOff() {
|
||||
info("wifi disabled");
|
||||
wifiEnabled = false;
|
||||
WiFi.disconnect();
|
||||
}
|
||||
|
||||
void wifiLoop() {
|
||||
@ -64,7 +65,7 @@ void wifiLoop() {
|
||||
if (wifiConnected != currentState) {
|
||||
wifiConnected = currentState;
|
||||
if (wifiConnected) {
|
||||
info("wifi connected: %s", WiFi.localIP().toString().c_str());
|
||||
info("wifi connected as %s", WiFi.localIP().toString().c_str());
|
||||
wifiSetupOTA();
|
||||
} else {
|
||||
warn("wifi disconnected");
|
||||
@ -79,6 +80,7 @@ void wifiLoop() {
|
||||
wifiTryMillis = millis();
|
||||
WiFiClass::hostname(wifiHost);
|
||||
WiFi.setAutoReconnect(true);
|
||||
info(R"(connecting to SSID "%s" with hostname "%s")", wifiSsid, wifiHost);
|
||||
WiFi.begin(wifiSsid, wifiPkey);
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user