detect and recover from wifi disconnect
This commit is contained in:
parent
c0924a52ef
commit
8a740d4f19
1 changed files with 20 additions and 0 deletions
|
@ -295,8 +295,28 @@ void setup() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
//detect connection lost and reconnect
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
u8g2log.print("WiFi lost connection.\n");
|
||||
|
||||
delay(500);
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
u8g2log.print("Reconnecting to:\n");
|
||||
u8g2log.print(ssid);
|
||||
u8g2log.print("\n");
|
||||
u8g2log.print("\n");
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
u8g2log.print(".");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
server.handleClient();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue