Skip to content

Commit 20b990c

Browse files
authored
Merge pull request #261 from Qrome/3.02
3.02
2 parents b094dd8 + 6115469 commit 20b990c

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed
Binary file not shown.
Binary file not shown.

Diff for: marquee/Settings.h

+2
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,5 @@ String OTA_Password = ""; // Set an OTA password here -- leave blank if you
117117
//******************************
118118
// End Settings
119119
//******************************
120+
//blue-grey
121+
String themeColor = "blue-grey"; // this can be changed later in the web interface.

Diff for: marquee/marquee.ino

+37-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "Settings.h"
2929

30-
#define VERSION "3.01"
30+
#define VERSION "3.02"
3131

3232
#define HOSTNAME "CLOCK-"
3333
#define CONFIG "/conf.txt"
@@ -132,7 +132,8 @@ static const char CHANGE_FORM2[] PROGMEM = "<p><input name='isPM' class='w3-chec
132132
"<p>Display Brightness <input class='w3-border w3-margin-bottom' name='ledintensity' type='number' min='0' max='15' value='%INTENSITYOPTIONS%'></p>"
133133
"<p>Display Scroll Speed <select class='w3-option w3-padding' name='scrollspeed'>%SCROLLOPTIONS%</select></p>"
134134
"<p>Minutes Between Refresh Data <select class='w3-option w3-padding' name='refresh'>%OPTIONS%</select></p>"
135-
"<p>Minutes Between Scrolling Data <input class='w3-border w3-margin-bottom' name='refreshDisplay' type='number' min='1' max='10' value='%REFRESH_DISPLAY%'></p>";
135+
"<p>Minutes Between Scrolling Data <input class='w3-border w3-margin-bottom' name='refreshDisplay' type='number' min='1' max='10' value='%REFRESH_DISPLAY%'></p>"
136+
"<p>Theme Color <select class='w3-option w3-padding' name='theme'>%THEME_OPTIONS%</select></p>";
136137

137138
static const char CHANGE_FORM3[] PROGMEM = "<hr><p><input name='isBasicAuth' class='w3-check w3-margin-top' type='checkbox' %IS_BASICAUTH_CHECKED%> Use Security Credentials for Configuration Changes</p>"
138139
"<p><label>Marquee User ID (for this web interface)</label><input class='w3-input w3-border w3-margin-bottom' type='text' name='userid' value='%USERID%' maxlength='20'></p>"
@@ -179,6 +180,29 @@ static const char OCTO_FORM[] PROGMEM = "<form class='w3-container' action='/sav
179180
"<button class='w3-button w3-block w3-green w3-section w3-padding' type='submit'>Save</button></form>"
180181
"<script>function isNumberKey(e){var h=e.which?e.which:event.keyCode;return!(h>31&&(h<48||h>57))}</script>";
181182

183+
static const char COLOR_THEMES[] PROGMEM = "<option>red</option>"
184+
"<option>pink</option>"
185+
"<option>purple</option>"
186+
"<option>deep-purple</option>"
187+
"<option>indigo</option>"
188+
"<option>blue</option>"
189+
"<option>light-blue</option>"
190+
"<option>cyan</option>"
191+
"<option>teal</option>"
192+
"<option>green</option>"
193+
"<option>light-green</option>"
194+
"<option>lime</option>"
195+
"<option>khaki</option>"
196+
"<option>yellow</option>"
197+
"<option>amber</option>"
198+
"<option>orange</option>"
199+
"<option>deep-orange</option>"
200+
"<option>blue-grey</option>"
201+
"<option>brown</option>"
202+
"<option>grey</option>"
203+
"<option>dark-grey</option>"
204+
"<option>black</option>"
205+
"<option>w3schools</option>";
182206

183207

184208
const int TIMEOUT = 500; // 500 = 1/2 second
@@ -560,6 +584,7 @@ void handleLocations() {
560584
timeDisplayTurnsOff = decodeHtmlString(server.arg("endTime"));
561585
displayIntensity = server.arg("ledintensity").toInt();
562586
minutesBetweenDataRefresh = server.arg("refresh").toInt();
587+
themeColor = server.arg("theme");
563588
minutesBetweenScrolling = server.arg("refreshDisplay").toInt();
564589
displayScrollSpeed = server.arg("scrollspeed").toInt();
565590
IS_BASIC_AUTH = server.hasArg("isBasicAuth");
@@ -832,6 +857,9 @@ void handleConfigure() {
832857
options.replace(">" + minutes + "<", " selected>" + minutes + "<");
833858
form.replace("%OPTIONS%", options);
834859
form.replace("%REFRESH_DISPLAY%", String(minutesBetweenScrolling));
860+
String themeOptions = FPSTR(COLOR_THEMES);
861+
themeOptions.replace(">" + String(themeColor) + "<", " selected>" + String(themeColor) + "<");
862+
form.replace("%THEME_OPTIONS%", themeOptions);
835863

836864
server.sendContent(form); //Send another chunk of the form
837865

@@ -958,7 +986,7 @@ void sendHeader() {
958986
html += "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />";
959987
html += "<meta name='viewport' content='width=device-width, initial-scale=1'>";
960988
html += "<link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'>";
961-
html += "<link rel='stylesheet' href='https://www.w3schools.com/lib/w3-theme-blue-grey.css'>";
989+
html += "<link rel='stylesheet' href='https://www.w3schools.com/lib/w3-theme-" + themeColor + ".css'>";
962990
html += "<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/css/all.min.css'>";
963991
html += "</head><body>";
964992
server.sendContent(html);
@@ -1320,6 +1348,7 @@ String writeCityIds() {
13201348
f.println("USE_PIHOLE=" + String(USE_PIHOLE));
13211349
f.println("PiHoleServer=" + PiHoleServer);
13221350
f.println("PiHolePort=" + String(PiHolePort));
1351+
f.println("themeColor=" + themeColor);
13231352
}
13241353
f.close();
13251354
readCityIds();
@@ -1511,6 +1540,11 @@ void readCityIds() {
15111540
PiHolePort = line.substring(line.lastIndexOf("PiHolePort=") + 11).toInt();
15121541
Serial.println("PiHolePort=" + String(PiHolePort));
15131542
}
1543+
if (line.indexOf("themeColor=") >= 0) {
1544+
themeColor = line.substring(line.lastIndexOf("themeColor=") + 11);
1545+
themeColor.trim();
1546+
Serial.println("themeColor=" + themeColor);
1547+
}
15141548
}
15151549
fr.close();
15161550
matrix.setIntensity(displayIntensity);

0 commit comments

Comments
 (0)