소스 검색

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

Rob Chartier 8 년 전
부모
커밋
cda427d062
1개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 13 1
      lib/WebServer/MiLightHttpServer.cpp

+ 13 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -128,7 +128,19 @@ void MiLightHttpServer::handleSystemPost() {
       delay(100);
 
       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) {