Explorar o código

Merge pull request #125 from speendo/master

Solving issues #120 and #123
Chris Mullins %!s(int64=8) %!d(string=hai) anos
pai
achega
d991d45fd6
Modificáronse 3 ficheiros con 7 adicións e 2 borrados
  1. 2 0
      README.md
  2. 3 1
      lib/WebServer/MiLightHttpServer.cpp
  3. 2 1
      src/main.cpp

+ 2 - 0
README.md

@@ -65,6 +65,8 @@ This project uses [WiFiManager](https://github.com/tzapu/WiFiManager) to avoid t
 
 When the ESP powers on, you should be able to see a network named "ESPXXXXX", with XXXXX being an identifier for your ESP. Connect to this AP and a window should pop up prompting you to enter WiFi credentials.
 
+The network password is "**milightHub**".
+
 #### Get IP Address
 
 Both mDNS and SSDP are supported.

+ 3 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -7,6 +7,7 @@
 #include <string.h>
 #include <TokenIterator.h>
 #include <index.html.gz.h>
+#include <WiFiManager.h>
 
 void MiLightHttpServer::begin() {
   applySettings(settings);
@@ -111,7 +112,8 @@ void MiLightHttpServer::handleSystemPost() {
         server.send_P(200, TEXT_PLAIN, PSTR("true"));
 
         delay(100);
-        ESP.eraseConfig();
+        WiFiManager wifiManager;
+        wifiManager.resetSettings();
         delay(100);
         ESP.restart();
 

+ 2 - 1
src/main.cpp

@@ -165,7 +165,8 @@ bool shouldRestart() {
 
 void setup() {
   Serial.begin(9600);
-  wifiManager.autoConnect();
+  String ssid = "ESP" + String(ESP.getChipId());
+  wifiManager.autoConnect(ssid.c_str(), "milightHub");
   SPIFFS.begin();
   Settings::load(settings);
   applySettings();