differenciate handling of disconnection between ESP and other boards

This commit is contained in:
1technophile committed 2019-07-26 12:34:29 +02:00
1 parent 60bc75f0b6
commit 6795475e03
1 file changed
+13 -1
+13 -1
View File
@@ -831,6 +831,7 @@ void loop()
trc("client disconnected");
lastReconnectAttempt = now;
// Attempt to reconnect
#if defined(ESP8266) || defined(ESP32)
if (WiFi.status() == WL_CONNECTED){
if (reconnect()) {
lastReconnectAttempt = 0;
@@ -843,7 +844,7 @@ void loop()
#ifdef ESP8266
ESP.reset();
#endif
#elif defined(ESP8266) || defined(ESP32)
#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
@@ -853,6 +854,17 @@ void loop()
}else{
trc("wifi disconnected");
}
#else //other boards
if (Ethernet.linkStatus() == LinkON){
if (reconnect()) {
lastReconnectAttempt = 0;
} else {
trc(F("brk disconnected"));
}
}else{
trc("eth disconnected");
}
#endif
}
} else { //connected
// MQTT loop