diff --git a/src/main.cpp b/src/main.cpp index 543e6fb..259d791 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,11 +144,17 @@ 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);