Переглянути джерело

Fix #277: restart ESP after config portal times out (#278)

Chris Mullins 7 роки тому
батько
коміт
19843908d8
1 змінених файлів з 7 додано та 1 видалено
  1. 7 1
      src/main.cpp

+ 7 - 1
src/main.cpp

@@ -283,10 +283,16 @@ void setup() {
     // set LED mode for successful operation
     ledStatus->continuous(settings.ledModeOperating);
     Serial.println(F("Wifi connected succesfully\n"));
+
+    // if the config portal was started, make sure to turn off the config AP
+    WiFi.mode(WIFI_STA);
   } else {
     // set LED mode for Wifi failed
     ledStatus->continuous(settings.ledModeWifiFailed);
-    Serial.println(F("Wifi failed.  Oh well.\n"));
+    Serial.println(F("Wifi failed.  Restarting in 10 seconds.\n"));
+
+    delay(10000);
+    ESP.restart();
   }