fix esp.restart by adding wifi disconnect
This commit is contained in:
parent
2c71863b08
commit
4e4c9426ff
2 changed files with 17 additions and 8 deletions
|
|
@ -108,9 +108,15 @@ void messageReceived(String &topic, String &payload) {
|
|||
Serial.println("Reset value error flag");
|
||||
}
|
||||
if (topic==((String)client_id+"/reboot") && payload=="true") { //error acknowledge
|
||||
Serial.println("Reboot by mqtt");
|
||||
delay(100);
|
||||
ESP.restart();
|
||||
|
||||
while(1) {
|
||||
Serial.println("Reboot by mqtt");
|
||||
Serial.flush();
|
||||
WiFi.disconnect();
|
||||
delay(12000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
13
src/main.cpp
13
src/main.cpp
|
|
@ -243,12 +243,15 @@ void loop() {
|
|||
pixels.setPixelColor(0, pixels.Color(255, 0,100));
|
||||
pixels.show();
|
||||
#endif
|
||||
Serial.println("Too many wifi reconnect fails. Rebooting ESP");
|
||||
Serial.flush();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
|
||||
|
||||
while(1){ //infinite loop until rebooted
|
||||
delay(1);
|
||||
Serial.println("Too many wifi reconnect fails. Rebooting ESP");
|
||||
Serial.flush();
|
||||
delay(1000);
|
||||
WiFi.disconnect();
|
||||
delay(12000);
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
if (WiFi.status() == WL_CONNECTED) { //connect successfull
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue