Explorar o código

added a system command to reset the wifi and then restart the device

Rob Chartier %!s(int64=8) %!d(string=hai) anos
pai
achega
cda427d062
Modificáronse 1 ficheiros con 13 adicións e 1 borrados
  1. 13 1
      lib/WebServer/MiLightHttpServer.cpp

+ 13 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -128,7 +128,19 @@ void MiLightHttpServer::handleSystemPost() {
       delay(100);
       delay(100);
 
 
       ESP.restart();
       ESP.restart();
-    }
+
+      handled = true;
+    } else if (request["command"] == "reset_wifi") {
+        Serial.println(F("Resetting Wifi and then Restarting..."));
+        server.send(200, TEXT_PLAIN, "true");
+
+        delay(100);
+        ESP.eraseConfig();
+        delay(100);
+        ESP.restart();
+
+        handled = true;
+      }
   }
   }
 
 
   if (handled) {
   if (handled) {