differenciate handling of disconnection between ESP and other boards
This commit is contained in:
1 parent
60bc75f0b6
commit
6795475e03
1 file changed
+13
-1
+13
-1
@@ -831,6 +831,7 @@ void loop()
|
|||||||
trc("client disconnected");
|
trc("client disconnected");
|
||||||
lastReconnectAttempt = now;
|
lastReconnectAttempt = now;
|
||||||
// Attempt to reconnect
|
// Attempt to reconnect
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
if (WiFi.status() == WL_CONNECTED){
|
if (WiFi.status() == WL_CONNECTED){
|
||||||
if (reconnect()) {
|
if (reconnect()) {
|
||||||
lastReconnectAttempt = 0;
|
lastReconnectAttempt = 0;
|
||||||
@@ -843,7 +844,7 @@ void loop()
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
#endif
|
#endif
|
||||||
#elif defined(ESP8266) || defined(ESP32)
|
#else
|
||||||
if (!connectedOnce) {
|
if (!connectedOnce) {
|
||||||
trc(F("reseting wifi manager"));
|
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
|
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{
|
}else{
|
||||||
trc("wifi disconnected");
|
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
|
} else { //connected
|
||||||
// MQTT loop
|
// MQTT loop
|
||||||
|
|||||||
Reference in new issue
Block a user