differenciate handling of disconnection between ESP and other boards
This commit is contained in:
1 parent
60bc75f0b6
commit
6795475e03
1 file changed
+32
-20
+32
-20
@@ -831,28 +831,40 @@ void loop()
|
|||||||
trc("client disconnected");
|
trc("client disconnected");
|
||||||
lastReconnectAttempt = now;
|
lastReconnectAttempt = now;
|
||||||
// Attempt to reconnect
|
// Attempt to reconnect
|
||||||
if (WiFi.status() == WL_CONNECTED){
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
if (reconnect()) {
|
if (WiFi.status() == WL_CONNECTED){
|
||||||
lastReconnectAttempt = 0;
|
if (reconnect()) {
|
||||||
} else {
|
lastReconnectAttempt = 0;
|
||||||
#if defined(ESPWifiManualSetup)
|
} else {
|
||||||
trc(F("restarting ESP"));
|
#if defined(ESPWifiManualSetup)
|
||||||
#ifdef ESP32
|
trc(F("restarting ESP"));
|
||||||
ESP.restart();
|
#ifdef ESP32
|
||||||
|
ESP.restart();
|
||||||
|
#endif
|
||||||
|
#ifdef ESP8266
|
||||||
|
ESP.reset();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
if (!connectedOnce) {
|
||||||
|
trc(F("reseting wifi manager"));
|
||||||
|
setup_wifimanager(true); // if we didn't connected once to mqtt we reset and start in AP mode again to have a chance to change the parameters
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef ESP8266
|
}
|
||||||
ESP.reset();
|
}else{
|
||||||
#endif
|
trc("wifi disconnected");
|
||||||
#elif defined(ESP8266) || defined(ESP32)
|
|
||||||
if (!connectedOnce) {
|
|
||||||
trc(F("reseting wifi manager"));
|
|
||||||
setup_wifimanager(true); // if we didn't connected once to mqtt we reset and start in AP mode again to have a chance to change the parameters
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}else{
|
#else //other boards
|
||||||
trc("wifi disconnected");
|
if (Ethernet.linkStatus() == LinkON){
|
||||||
}
|
if (reconnect()) {
|
||||||
|
lastReconnectAttempt = 0;
|
||||||
|
} else {
|
||||||
|
trc(F("brk disconnected"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
trc("eth disconnected");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else { //connected
|
} else { //connected
|
||||||
// MQTT loop
|
// MQTT loop
|
||||||
|
|||||||
Reference in new issue
Block a user