瀏覽代碼

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) {