Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
}

.show{
height: 150px;
height: 200px;
transition: height 1s;
}

Expand Down Expand Up @@ -284,6 +284,12 @@ <h1 id="headline">WORDCLOCK 2.0</h1>
<label for="nm_end" style="align-self: flex-start">Nightmode end time: </label>
<input type="time" id="nm_end" name="nm_end" min="00:00" max="23:59">
</div>
<div class="checkbox-container">
<label for="ResetWifi" style="align-self: flex-start">Reset Wifi</label>
<div>
<input name= "ResetWifi" id="ResetWifi" type="checkbox" class="toggle">
</div>
</div>
<div class="buttonClass save-button" onclick="saveSettings()">SAVE</div>
</div>

Expand Down Expand Up @@ -538,6 +544,7 @@ <h1 id="headline">WORDCLOCK 2.0</h1>
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 += "-";
Expand All @@ -546,6 +553,9 @@ <h1 id="headline">WORDCLOCK 2.0</h1>
cmdstr += brightnessElmt.value;
console.log(cmdstr);
sendCommand(cmdstr);
if(ckb_resetWifi.checked) {
sendCommand("./cmd?resetwifi");
}
toggleSettings();
}

Expand Down
23 changes: 21 additions & 2 deletions wordclock_esp8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -368,7 +371,6 @@ void setup() {
ledmatrix.drawOnMatrixInstant();
}


// setup NTP
ntp.setupNTPClient();
logger.logString("NTP running");
Expand Down Expand Up @@ -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);
Expand Down