Add fallback reboot to OTA-Base
This commit is contained in:
@@ -129,11 +129,18 @@ void setup(void) {
|
||||
WiFi.begin(ssid, password);
|
||||
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) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
if (wifiConnAttements++ > 120) {
|
||||
Serial.println("<Wifi not connecting after 120 attmepts (1 min.) - rebooting>");
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Serial.println("");
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(ssid);
|
||||
|
||||
Reference in New Issue
Block a user