Add WiFi recovery via reboot
This commit is contained in:
@@ -144,11 +144,17 @@ void setup(void) {
|
|||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
// Wait for connection
|
// Wait for connection or reboot if it doesn't connect for too long
|
||||||
|
uint32_t wifiConnAttements = 0;
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
delay(500);
|
delay(500);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
|
if (wifiConnAttements++ > 120) {
|
||||||
|
Serial.println("<Wifi not connecting after 120 attmepts (1 min.) - rebooting>");
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.print("Connected to ");
|
Serial.print("Connected to ");
|
||||||
Serial.println(ssid);
|
Serial.println(ssid);
|
||||||
|
|||||||
Reference in New Issue
Block a user