diff --git a/README.md b/README.md index f47ca57..9775c53 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,21 @@ To program the ESP8266 with the Arduino IDE, you need to install the board infor ## Remark about the WiFi setup Regarding the Wifi setting, I have actually implemented two variants: -1. By default the WifiManager is activated. That is, the word clock makes the first time its own WiFi (should be called "WordclockAP"). There you simply connect to the cell phone and you can perform configuration of the WiFi settings conveniently as with a SmartHome devices (Very elegant 😊) +1. By default the WifiManager is activated. That is, the word clock makes the first time its own WiFi (should be called "WordclockAP"). There you connect from a cell phone to `192.168.4.1`* and you can perform configuration of the WiFi settings conveniently as with a SmartHome devices (Very elegant 😊) 2. Another (traditional) variant is to define the wifi credentials in the code (in secrets.h). - For this you have to comment out lines 230 to 251 in the code of the file *wordclock_esp8266.ino* (/\* before and \*/ after) - and comment out lines 257 to 305 (/\* and \*/ remove) +(* default IP provided by the WifiMAnager library.) +## Resetting the wifi + +You can clear the stored wifi credentials and restart the wifi setup described above with these steps: +1. Open the settings panel in the web UI. +2. Enable 'Reset Wifi' slider. +3. Save settings. +4. LED test should be performed. +5. Disconnect and reconnect the power. Wifi credentials were removed. Setup should be restarted. +Resetting the wifi credentials does not delete uploaded files. ## Remark about Logging diff --git a/data/index.html b/data/index.html index 059fefa..595dfb8 100644 --- a/data/index.html +++ b/data/index.html @@ -243,7 +243,7 @@ } .show{ - height: 150px; + height: 200px; transition: height 1s; } @@ -284,6 +284,12 @@

WORDCLOCK 2.0

+
+ +
+ +
+
SAVE
@@ -538,6 +544,7 @@

WORDCLOCK 2.0

var nmStart = document.getElementById("nm_start"); var nmEnd = document.getElementById("nm_end"); var brightnessElmt = document.getElementById("brightness"); + var ckb_resetWifi = document.querySelector('input[id="ResetWifi"]'); var cmdstr = "./cmd?setting="; cmdstr += nmStart.value.replace(":", "-"); cmdstr += "-"; @@ -546,6 +553,9 @@

WORDCLOCK 2.0

cmdstr += brightnessElmt.value; console.log(cmdstr); sendCommand(cmdstr); + if(ckb_resetWifi.checked) { + sendCommand("./cmd?resetwifi"); + } toggleSettings(); } diff --git a/wordclock_esp8266.ino b/wordclock_esp8266.ino index cf946d4..776ff8c 100644 --- a/wordclock_esp8266.ino +++ b/wordclock_esp8266.ino @@ -145,6 +145,9 @@ ESP8266WebServer server(HTTPPort); //DNS Server DNSServer DnsServer; +// Wifi server. keep around to support resetting. +WiFiManager wifiManager; + // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest // example for more information on possible values. @@ -236,7 +239,7 @@ void setup() { /** Use WiFiMaanger for handling initial Wifi setup **/ // Local intialization. Once its business is done, there is no need to keep it around - WiFiManager wifiManager; + // Uncomment and run it once, if you want to erase all the stored information //wifiManager.resetSettings(); @@ -368,7 +371,6 @@ void setup() { ledmatrix.drawOnMatrixInstant(); } - // setup NTP ntp.setupNTPClient(); logger.logString("NTP running"); @@ -856,6 +858,23 @@ void handleCommand() { logger.logString("Brightness: " + String(brightness)); ledmatrix.setBrightness(brightness); } + else if (server.argName(0) == "resetwifi"){ + wifiManager.resetSettings(); + // run LED test. + for(int r = 0; r < HEIGHT; r++){ + for(int c = 0; c < WIDTH; c++){ + matrix.fillScreen(0); + matrix.drawPixel(c, r, LEDMatrix::color24to16bit(colors24bit[2])); + matrix.show(); + delay(10); + } + } + + // clear Matrix + matrix.fillScreen(0); + matrix.show(); + delay(200); + } else if(server.argName(0) == "stateautochange"){ String modestr = server.arg(0); logger.logString("stateAutoChange change via Webserver to: " + modestr);