From ce2b8a37b07589824517785e1e36f0cca3050889 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Sat, 18 Jun 2022 07:38:07 -0500 Subject: [PATCH] Add fallback reboot to OTA-Base --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e62cca4..610fa92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(""); + ESP.restart(); + } } + + Serial.println(""); Serial.print("Connected to "); Serial.println(ssid);