diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 1c92ada9..68600bbb 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -1,8 +1,8 @@ - + - WLED 0.5dev + WLED 0.5.0 +.ctrl_box{margin:auto;width:80vw;background-color:var(--cCol);position:absolute;top:55%;left:50%;transform:translate(-50%,-50%);filter:drop-shadow(-5px -5px 5px var(--sCol))}.sds{width:100%;height:12vh;margin-top:2vh}.sl{margin-left:auto;margin-right:auto;margin-top:2vh;width:77vw}#slA{margin-top:0vh;background:linear-gradient(to right,black,yellow)}#slR{background:linear-gradient(to right,black,red)}#slG{background:linear-gradient(to right,black,green)}#slB{background:linear-gradient(to right,black,blue)}#slW{background:linear-gradient(to right,black,white)}#slH{background:linear-gradient(to right,red,orange,yellow,green,cyan,blue,violet,red)}#slS{background:linear-gradient(to right,grey,green)}#slN{background:linear-gradient(to right,black,turquoise)}#slT{background:linear-gradient(to right,black,yellow)}.tools{margin-left:auto;margin-right:auto;margin-top:2vh;width:77vw}#slX{background:linear-gradient(to right,black,white)}#slI{background:linear-gradient(to right,black,red)}body{font-family:var(--cFn),sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);height:100%;margin:0;background-repeat:no-repeat;background-attachment:fixed;color:var(--tCol)}html{height:100%}iframe{display:none;border:0;filter:drop-shadow(-5px -5px 5px var(--sCol));margin:auto;width:80vw;height:60vh;position:absolute;top:55%;left:50%;transform:translate(-50%,-50%)}svg{fill:var(--dCol);width:12vw;height:10vmin;filter:drop-shadow(-5px -5px 5px var(--sCol))}input{filter:drop-shadow(-5px -5px 5px var(--sCol));}button{background:var(--bCol);color:var(--tCol);border:.5ch solid var(--bCol);margin-bottom:1vh;font-family:var(--cFn),sans-serif;filter:drop-shadow(-5px -5px 5px var(--sCol))}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{background:var(--bCol);color:var(--dCol);border:.5ch solid var(--bCol);font-family:var(--cFn),sans-serif;width:3em}input[type=range]{-webkit-appearance:none;margin:-4px 0}input[type=range]:focus{outline:0}input[type=range]::-webkit-slider-runnable-track{width:100%;height:12vh;cursor:pointer;background:var(--bCol)}input[type=range]::-webkit-slider-thumb{filter:drop-shadow(-5px -5px 5px var(--sCol));height:10vh;width:10vh;background:var(--aCol);cursor:pointer;-webkit-appearance:none;margin-top:1vh}input[type=range]::-moz-range-track{width:100%;height:12vh;cursor:pointer;background:var(--bCol)}input[type=range]::-moz-range-thumb{filter:drop-shadow(-5px -5px 5px var(--sCol));height:10vh;width:10vh;background:var(--aCol);cursor:pointer;margin-top:1vh}input[type=range]::-ms-track{width:100%;height:12vh;cursor:pointer;background:transparent;border-color:transparent;color:transparent}input[type=range]::-ms-fill-lower{background:#var(--bCol)}input[type=range]::-ms-fill-upper{background:#var(--bCol)}input[type=range]::-ms-thumb{width:10vh;background:var(--aCol);cursor:pointer;height:10vh} Loading... diff --git a/wled00/htmls01.h b/wled00/htmls01.h index c21fc551..abca9ac7 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -2,7 +2,7 @@ * Settings html */ const char PAGE_settingsCss[] PROGMEM = R"=====( -body{font-family:Verdana,Helvetica,sans-serif;text-align:center;background:var(--cCol);color:var(--dCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--dCol);border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--dCol);border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:3em}select{background:var(--bCol);color:var(--dCol);border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );} +body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:3em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );} )====="; const char PAGE_settings0[] PROGMEM = R"=====( @@ -13,7 +13,7 @@ const char PAGE_settings0[] PROGMEM = R"=====( )====="; const char PAGE_settings1[] PROGMEM = R"=====( -body{font-family:Verdana,Helvetica,sans-serif;text-align:center;background:var(--cCol);height:100%;margin:0;background-attachment:fixed}button{background:var(--bCol);color:var(--dCol);border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:9vmin;width:95%;margin-top:2.4vh} +body{text-align:center;background:var(--cCol);height:100%;margin:0;background-attachment:fixed}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:13.86vh;width:95%;margin-top:2.4vh}
@@ -37,7 +37,7 @@ const char PAGE_settings_wifi1[] PROGMEM = R"=====(
-
+

WiFi setup

Connect to existing network

Network name (SSID, empty to not connect):

@@ -67,7 +67,7 @@ Hide AP name:
AP password (leave empty for open):

Access Point WiFi channel:
AP IP: Not active
- +
@@ -152,21 +152,24 @@ Color Theme: - - - - - + + + + +
-Please specify your custom hex colors (e.g. #FF0000 for red)
+Please specify your custom hex colors (e.g. FF0000 for red)
Custom accent color:
Custom background:
Custom panel color:
-Custom text color:
-Custom shadow:
+Custom icon color:
+Custom shadow:
+Custom text color:
+Use font:
+Make sure the font you use is installed on your system!

@@ -233,9 +236,8 @@ const char PAGE_settings_time1[] PROGMEM = R"=====(

Time setup

-Requires reboot.
Get time from NTP server:
-NTP server:
+ Current local time is unknown.

Weather

Coming soon! Not yet implemented! @@ -264,7 +266,8 @@ Reverse (turns on at sunset):
Fade duration:
Sunrise/Sunset Offset: -->

Advanced Macros

-Define API macros here:
+Coming soon! Not yet implemented! + +<--1st Time-Controlled Macro: Alexa On/Off Macros:
- +<--Emulate 2nd Alexa device: + +Emulate 3rd Alexa device: Button Macro:
Button Long Press Macro:
- -Countdown-Over Macro:
+<--Sunrise Macro +Sunset Macro +Countdown-Over Macro:
-->
- + + )====="; const char PAGE_settings_sec0[] PROGMEM = R"=====( @@ -309,7 +314,7 @@ const char PAGE_settings_sec1[] PROGMEM = R"=====(
-
+

Security & Update setup

Enable OTA lock:
Passphrase:
@@ -328,7 +333,7 @@ HTTP traffic is not encrypted. An attacker in the same network could intercept f
Enable ArduinoOTA:

About

-WLED version 0.5dev
+WLED version 0.5.0
(c) 2016-2018 Christian Schwinne
Licensed under the MIT license

Uses libraries:
@@ -339,7 +344,7 @@ Enable ArduinoOTA:
Espalexa by Aircoookie (modified)

UI icons by Linearicons created by Perxis! (CC-BY-SA 4.0)

Server message: Response error!
- +
diff --git a/wled00/htmls02.h b/wled00/htmls02.h index cd62281a..946aaa11 100644 --- a/wled00/htmls02.h +++ b/wled00/htmls02.h @@ -4,12 +4,11 @@ const char PAGE_msg0[] PROGMEM = R"=====( - WLED Message - + )====="; const char PAGE_msg1[] PROGMEM = R"=====( -button{background:var(--bCol);color:var(--dCol);border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:Verdana,Helvetica,sans-serif;text-align:center;background:var(--cCol);color:var(--dCol);line-height:200%;margin:0;background-attachment:fixed} +button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed} )====="; @@ -20,7 +19,7 @@ const char PAGE_welcome0[] PROGMEM = R"=====( WLED Welcome! )====="; const char PAGE_welcome1[] PROGMEM = R"=====( -body{font-family:Verdana, Helvetica, sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);height:100%;margin:0;background-repeat:no-repeat;background-attachment: fixed;color: var(--dCol);}svg {fill: var(--dCol);} +body{font-family:var(--cFn),sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);height:100%;margin:0;background-repeat:no-repeat;background-attachment: fixed;color: var(--tCol);}svg {fill: var(--dCol);} @@ -54,7 +53,7 @@ const char PAGE_edit[] PROGMEM = R"=====(SPIFFS disabled)====="; /* * favicon */ -const char favicon[156] PROGMEM = { +const char favicon[] PROGMEM = { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x86, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, diff --git a/wled00/src/dependencies/webserver/ESP8266HTTPUpdateServer.cpp b/wled00/src/dependencies/webserver/ESP8266HTTPUpdateServer.cpp index 5fc501e6..ee1735ea 100644 --- a/wled00/src/dependencies/webserver/ESP8266HTTPUpdateServer.cpp +++ b/wled00/src/dependencies/webserver/ESP8266HTTPUpdateServer.cpp @@ -12,16 +12,17 @@ const char* ESP8266HTTPUpdateServer::_serverIndex = -R"(

WLED Software Update


Get the latest binaries on the project GitHub page!
- Unsure which binary is correct? Go to the /build subpage to find the details of this version.
- Double check to be sure to upload a valid .bin firmware file for your ESP! Otherwise you'll need USB recovery!

-
- - -
- )"; +R"(

WLED Software Update


Get the latest binaries on the project GitHub page!
+Unsure which binary is correct? Go to the /build subpage for the details of this version.
+Be sure to upload a valid .bin file for your ESP! Otherwise you'll need USB recovery!
+



+
+ + +
+)"; const char* ESP8266HTTPUpdateServer::_failedResponse = R"(Update Failed!)"; -const char* ESP8266HTTPUpdateServer::_successResponse = "Update Successful! Rebooting, please wait for redirect..."; +const char* ESP8266HTTPUpdateServer::_successResponse = R"(Update Successful! Rebooting, please wait for redirect...)"; ESP8266HTTPUpdateServer::ESP8266HTTPUpdateServer(bool serial_debug) { diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 6c57f433..6bc177db 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -3,7 +3,7 @@ */ /* * @title WLED project sketch - * @version 0.5dev + * @version 0.5.0 * @author Christian Schwinne */ @@ -30,8 +30,8 @@ #include "WS2812FX.h" //version in format yymmddb (b = daily build) -#define VERSION 1802193 -const String versionName = "WLED 0.5dev"; +#define VERSION 1802221 +const String versionString = "0.5.0"; //AP and OTA default passwords (change them!) String appass = "wled1234"; @@ -83,7 +83,7 @@ bool ntpEnabled = true; #endif //Default CONFIG -String serverDescription = versionName; +String serverDescription = versionString; uint8_t currentTheme = 0; String clientssid = "Your_Network_Here"; String clientpass = "Dummy_Pass"; @@ -112,12 +112,12 @@ uint8_t nightlightTargetBri = 0, bri_nl_t; bool fadeTransition = true; bool sweepTransition = false, sweepDirection = true; uint16_t transitionDelay = 1200; -bool otaLock = true; +bool otaLock = false, wifiLock = false; bool aOtaEnabled = true; bool onlyAP = false; bool buttonEnabled = true; bool notifyDirect = true, notifyButton = true, notifyDirectDefault = true, alexaNotify = false, macroNotify = false; -bool receiveNotifications = true, receiveNotificationBrightness = true, receiveNotificlationColor = true, receiveNotificationEffects = true; +bool receiveNotifications = true, receiveNotificationBrightness = true, receiveNotificationColor = true, receiveNotificationEffects = true; uint8_t briMultiplier = 100; uint8_t nightlightDelayMins = 60; bool nightlightFade = true; @@ -182,6 +182,7 @@ uint8_t effectIntensity = 128; boolean udpConnected = false; byte udpIn[1026]; String cssCol[]={"","","","","",""}; +String cssFont="Verdana"; String cssColorString=""; //NTP stuff boolean ntpConnected = false; @@ -252,7 +253,7 @@ WS2812FX strip = WS2812FX(LEDCOUNT); //1 -> 0.4p 1711272 and up //2 -> 0.4p 1711302 and up //3 -> 0.4 1712121 and up -//4 -> 0.5dev 1801271 and up +//4 -> 0.5.0 and up #ifdef DEBUG #define DEBUG_PRINT(x) Serial.print (x) @@ -295,7 +296,7 @@ const uint8_t gamma8[] = { String txd = "Please disable OTA Lock in security settings!"; -void serveMessage(int,String,String,bool=false); +void serveMessage(int,String,String,int=255); void down() { diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 0ac58132..b377ce79 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -19,7 +19,6 @@ void saveSettingsToEEPROM() { clearEEPROM(); EEPROM.write(233, 233); - showWelcomePage = true; } else { showWelcomePage = false; @@ -130,15 +129,20 @@ void saveSettingsToEEPROM() EEPROM.write(390, aOtaEnabled); EEPROM.write(391, receiveNotificationColor); EEPROM.write(392, receiveNotificationEffects); - if (currentTheme == 15) - { - for (int k=0;k<6;k++){ - for (int i = 900+k*8; i < (908+k*8); ++i) + EEPROM.write(393, wifiLock); + + for (int k=0;k<6;k++){ + int in = 900+k*8; + for (int i=in; i < in+8; ++i) { - EEPROM.write(i, cssCol[k].charAt(i-900)); + EEPROM.write(i, cssCol[k].charAt(i-in)); }} - } + EEPROM.write(948,currentTheme); + for (int i = 950; i < 982; ++i) + { + EEPROM.write(i, cssFont.charAt(i-950)); + } EEPROM.commit(); } @@ -147,6 +151,7 @@ void loadSettingsFromEEPROM(bool first) { if (EEPROM.read(233) != 233) //first boot/reset to default { + showWelcomePage=true; saveSettingsToEEPROM(); return; } @@ -280,24 +285,29 @@ void loadSettingsFromEEPROM(bool first) aOtaEnabled = EEPROM.read(390); receiveNotificationColor = EEPROM.read(391); receiveNotificationEffects = EEPROM.read(392); + cssFont = ""; + for (int i = 950; i < 982; ++i) + { + if (EEPROM.read(i) == 0) break; + cssFont += char(EEPROM.read(i)); + } } receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects); bootPreset = EEPROM.read(389); + wifiLock = EEPROM.read(393); //favorite setting memory (25 slots/ each 20byte) //400 - 899 reserved currentTheme = EEPROM.read(948); - if (currentTheme == 15) - { - for (int k=0;k<6;k++){ - for (int i = 900+k*8; i < (908+k*8); ++i) + for (int k=0;k<6;k++){ + int in=900+k*8; + for (int i=in; i < in+8; ++i) { if (EEPROM.read(i) == 0) break; cssCol[k] += char(EEPROM.read(i)); }} - } //custom macro memory (16 slots/ each 64byte) //1024-2047 reserved diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index ef091096..f71f65f4 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -153,6 +153,7 @@ String getSettings(uint8_t subPage) resp += ds + "BOOTP" + v + bootPreset +";"; resp += ds + "FXDEF" + v + effectDefault +";"; resp += ds + "SXDEF" + v + effectSpeedDefault +";"; + resp += ds + "IXDEF" + v + effectIntensityDefault +";"; resp += ds + "GCBRI" + c + useGammaCorrectionBri +";"; resp += ds + "GCRGB" + c + useGammaCorrectionRGB +";"; resp += ds + "TFADE" + c + fadeTransition +";"; @@ -172,8 +173,9 @@ String getSettings(uint8_t subPage) resp += ds + "DESC" + v + "\"" + serverDescription + "\";"; resp += ds + "COLMD" + c + useHSBDefault + ";"; resp += ds + "THEME.selectedIndex=" + String(currentTheme) + ";"; - for(int i=0;i<5;i++) + for(int i=0;i<6;i++) resp += ds + "CCOL" + i + v + "\"" + cssCol[i] + "\";"; + resp += ds + "CFONT" + v + "\"" + cssFont + "\";"; } if (subPage == 4) @@ -199,9 +201,10 @@ String getSettings(uint8_t subPage) if (subPage == 6) { resp += ds + "NOOTA" + c + otaLock +";"; + resp += ds + "OWIFI" + c + wifiLock +";"; resp += ds + "AROTA" + c + aOtaEnabled +";"; resp += ds + "NORAP" + c + recoveryAPDisabled +";"; - resp += dg + "(\"msg\")[0]" + ih + "\""+ versionName +" (build " + VERSION + ") OK\";"; + resp += dg + "(\"msg\")[0]" + ih + "\"WLED "+ versionString +" (build " + VERSION + ") OK\";"; } resp += "}"; diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 4d2399ce..5b1c7f1c 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -196,6 +196,11 @@ void handleSettingsSet(uint8_t subPage) int i = server.arg("SXDEF").toInt(); if (i >= 0 && i <= 255) effectSpeedDefault = i; } + if (server.hasArg("IXDEF")) + { + int i = server.arg("IXDEF").toInt(); + if (i >= 0 && i <= 255) effectIntensityDefault = i; + } } turnOnAtBoot = server.hasArg("BOOTN"); if (server.hasArg("BOOTP")) @@ -251,10 +256,11 @@ void handleSettingsSet(uint8_t subPage) useHSBDefault = server.hasArg("COLMD"); useHSB = useHSBDefault; if (server.hasArg("THEME")) currentTheme = server.arg("THEME").toInt(); - for(int i=0;i<5;i++) + for(int i=0;i<6;i++) { - if (server.hasArg(("CCOL"+i))) cssCol[i] = server.arg(("CCOL"+i)); + if (server.hasArg("CCOL"+String(i))) cssCol[i] = server.arg("CCOL"+String(i)); } + if (server.hasArg("CFONT")) cssFont = server.arg("CFONT"); buildCssColorString(); } @@ -281,6 +287,7 @@ void handleSettingsSet(uint8_t subPage) if (subPage == 5) { ntpEnabled = server.hasArg("NTPON"); + if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort); //start if not already connected } //SECURITY @@ -289,27 +296,27 @@ void handleSettingsSet(uint8_t subPage) if (server.hasArg("RESET")) { clearEEPROM(); - serveMessage(200, "All Settings erased.", "Rebooting..."); + serveMessage(200, "All Settings erased.", "Connect to WLED-AP to setup again...",255); reset(); } - + + bool pwdCorrect = !otaLock; //always allow access if ota not locked if (server.hasArg("OPASS")) { - if (!otaLock) + if (otaLock && otapass.equals(server.arg("OPASS"))) + { + pwdCorrect = true; + } + if (!otaLock && server.arg("OPASS").length() > 0) { - if (server.arg("OPASS").length() > 0) otapass = server.arg("OPASS"); - } else if (!server.hasArg("NOOTA")) - { - if (otapass.equals(server.arg("OPASS"))) - { - otaLock = false; - } } } - if (server.hasArg("NOOTA")) otaLock = true; - if (!otaLock) + + if (pwdCorrect) //allow changes if correct pwd or no ota active { + otaLock = server.hasArg("NOOTA"); + wifiLock = server.hasArg("OWIFI"); recoveryAPDisabled = server.hasArg("NORAP"); aOtaEnabled = server.hasArg("AROTA"); } @@ -547,7 +554,8 @@ boolean handleSet(String req) } } //toggle nightlight mode - if (req.indexOf("NL=") > 0) + pos = req.indexOf("NL="); + if (pos > 0) { if (req.indexOf("NL=0") > 0) { @@ -555,15 +563,10 @@ boolean handleSet(String req) bri = bri_t; } else { nightlightActive = true; + nightlightDelayMins = req.substring(pos + 3).toInt(); nightlightStartTime = millis(); } } - //set nightlight delay - pos = req.indexOf("ND="); - if (pos > 0) { - nightlightDelayMins = req.substring(pos + 3).toInt(); - nightlightActive_old = false; //re-init - } //set nightlight target brightness pos = req.indexOf("NT="); if (pos > 0) { diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 09ce5d96..e6e154d4 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -75,7 +75,12 @@ void wledInit() serveSettings(0); }); server.on("/settings/wifi", HTTP_GET, [](){ - serveSettings(1); + if (!(wifiLock && otaLock)) + { + serveSettings(1); + }else{ + serveMessage(500, "Access Denied", txd, 254); + } }); server.on("/settings/leds", HTTP_GET, [](){ serveSettings(2); @@ -94,7 +99,10 @@ void wledInit() }); server.on("/favicon.ico", HTTP_GET, [](){ - if(!handleFileRead("/favicon.ico")) server.send(200, "image/x-icon", favicon); + if(!handleFileRead("/favicon.ico")) + { + server.send_P(200, "image/x-icon", favicon, 156); + } }); server.on("/", HTTP_GET, [](){ @@ -116,39 +124,39 @@ void wledInit() }); server.on("/reset", HTTP_GET, [](){ - serveMessage(200,"Rebooting now...","(takes ~15 seconds)"); + serveMessage(200,"Rebooting now...","(takes ~20 seconds, wait for auto-redirect)",139); reset(); }); server.on("/settings/wifi", HTTP_POST, [](){ - handleSettingsSet(1); - serveMessage(200,"WiFi settings saved.","Rebooting now..."); + if (!(wifiLock && otaLock)) handleSettingsSet(1); + serveMessage(200,"WiFi settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139); reset(); }); server.on("/settings/leds", HTTP_POST, [](){ handleSettingsSet(2); - serveMessage(200,"LED settings saved.","",true); + serveMessage(200,"LED settings saved.","Redirecting...",1); }); server.on("/settings/ui", HTTP_POST, [](){ handleSettingsSet(3); - serveMessage(200,"UI settings saved.","",true); + serveMessage(200,"UI settings saved.","Reloading to apply theme...",122); }); server.on("/settings/sync", HTTP_POST, [](){ handleSettingsSet(4); - serveMessage(200,"Sync settings saved.","",true); + serveMessage(200,"Sync settings saved.","Redirecting...",1); }); server.on("/settings/time", HTTP_POST, [](){ handleSettingsSet(5); - serveMessage(200,"Time settings saved.","If you made changes to NTP, please reboot.",true); + serveMessage(200,"Time settings saved.","Redirecting...",1); }); server.on("/settings/sec", HTTP_POST, [](){ handleSettingsSet(6); - serveMessage(200,"Security settings saved.","Rebooting now..."); + serveMessage(200,"Security settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139); reset(); }); @@ -166,12 +174,12 @@ void wledInit() server.on("/power", HTTP_GET, [](){ String val = (String)(int)strip.getPowerEstimate(ledcount,strip.getColor(),strip.getBrightness()); - val += "mA currently\nNotice: This is just an estimate which does not take into account several factors (like effects and wire resistance). It is NOT an accurate measurement!"; - server.send(200, "text/plain", val); + val += "mA currently"; + serveMessage(200,val,"This is just an estimate (does not take into account several factors like effects and wire resistance). It is NOT an accurate measurement!",254); }); server.on("/teapot", HTTP_GET, [](){ - serveMessage(418, "418. I'm a teapot.","(Tangible Embedded Advanced Project Of Twinkling)"); + serveMessage(418, "418. I'm a teapot.","(Tangible Embedded Advanced Project Of Twinkling)",254); }); server.on("/build", HTTP_GET, [](){ @@ -181,8 +189,8 @@ void wledInit() #else info += "platform: esp8266\r\n"; #endif - info += "name: " + versionName + "\r\n"; - info += "version: " + (String)VERSION + "\r\n"; + info += "version: " + versionString + "\r\n"; + info += "build: " + (String)VERSION + "\r\n"; info += "eepver: " + String(EEPVER) + "\r\n"; #ifdef RGBW info += "rgbw: true\r\n"; @@ -236,19 +244,19 @@ void wledInit() } else { server.on("/edit", HTTP_GET, [](){ - serveMessage(500, "Access Denied", txd); + serveMessage(500, "Access Denied", txd, 254); }); server.on("/down", HTTP_GET, [](){ - serveMessage(500, "Access Denied", txd); + serveMessage(500, "Access Denied", txd, 254); }); server.on("/cleareeprom", HTTP_GET, [](){ - serveMessage(500, "Access Denied", txd); + serveMessage(500, "Access Denied", txd, 254); }); server.on("/update", HTTP_GET, [](){ - serveMessage(500, "Access Denied", txd); + serveMessage(500, "Access Denied", txd, 254); }); server.on("/list", HTTP_GET, [](){ - serveMessage(500, "Access Denied", txd); + serveMessage(500, "Access Denied", txd, 254); }); } //called when the url is not defined here, ajax-in; get-settings @@ -313,7 +321,7 @@ void initAP(){ void initCon() { int fail_count = 0; - if (clientssid.length() <1) fail_count = 33; + if (clientssid.length() <1 || clientssid.equals("Your_Network_Here")) fail_count = apWaitTimeSecs*2; WiFi.begin(clientssid.c_str(), clientpass.c_str()); while(WiFi.status() != WL_CONNECTED) { delay(500); @@ -332,31 +340,37 @@ void initCon() void buildCssColorString() { + String cs[]={"","","","","",""}; switch (currentTheme) { - default: cssCol[0]="D9B310"; cssCol[1]="0B3C5D"; cssCol[2]="1D2731"; cssCol[3]="328CC1"; cssCol[4]="000"; break; //night - case 1: cssCol[0]="eee"; cssCol[1]="ddd"; cssCol[2]="b9b9b9"; cssCol[3]="049"; cssCol[4]="777"; break; //modern - case 2: cssCol[0]="abc"; cssCol[1]="fff"; cssCol[2]="ddd"; cssCol[3]="000"; cssCol[4]="0004"; break; //bright - case 3: cssCol[0]="c09f80"; cssCol[1]="d7cec7"; cssCol[2]="76323f"; cssCol[3]="888"; cssCol[4]="3334"; break; //wine - case 4: cssCol[0]="3cc47c"; cssCol[1]="828081"; cssCol[2]="d9a803"; cssCol[3]="1e392a"; cssCol[4]="000a"; break; //electric - case 5: cssCol[0]="57bc90"; cssCol[1]="a5a5af"; cssCol[2]="015249"; cssCol[3]="88c9d4"; cssCol[4]="0004"; break; //mint - case 6: cssCol[0]="f7c331"; cssCol[1]="dcc7aa"; cssCol[2]="6b7a8f"; cssCol[3]="f7882f"; cssCol[4]="0007"; break; //amber - case 7: cssCol[0]="fc3"; cssCol[1]="124"; cssCol[2]="334"; cssCol[3]="f1d"; cssCol[4]="f00"; break; //club - case 14: cssCol[0]="fc7"; cssCol[1]="49274a"; cssCol[2]="94618e"; cssCol[3]="f4decb"; cssCol[4]="0008"; break; //end - //case 15 do nothing since custom vals are already loaded + default: cs[0]="D9B310"; cs[1]="0B3C5D"; cs[2]="1D2731"; cs[3]="328CC1"; cs[4]="000"; cs[5]="328CC1"; break; //night + case 1: cs[0]="eee"; cs[1]="ddd"; cs[2]="b9b9b9"; cs[3]="049"; cs[4]="777"; cs[5]="049"; break; //modern + case 2: cs[0]="abc"; cs[1]="fff"; cs[2]="ddd"; cs[3]="000"; cs[4]="0004"; cs[5]="000"; break; //bright + case 3: cs[0]="c09f80"; cs[1]="d7cec7"; cs[2]="76323f"; cs[3]="888"; cs[4]="3334"; cs[5]="888"; break; //wine + case 4: cs[0]="3cc47c"; cs[1]="828081"; cs[2]="d9a803"; cs[3]="1e392a"; cs[4]="000a"; cs[5]="1e392a"; break; //electric + case 5: cs[0]="57bc90"; cs[1]="a5a5af"; cs[2]="015249"; cs[3]="88c9d4"; cs[4]="0004"; cs[5]="88c9d4"; break; //mint + case 6: cs[0]="f7c331"; cs[1]="dcc7aa"; cs[2]="6b7a8f"; cs[3]="f7882f"; cs[4]="0007"; cs[5]="f7882f"; break; //amber + case 7: cs[0]="fc3"; cs[1]="124"; cs[2]="334"; cs[3]="f1d"; cs[4]="f00"; cs[5]="f1d"; break;//club + case 8: cs[0]="0ac"; cs[1]="124"; cs[2]="224"; cs[3]="003eff"; cs[4]="003eff"; cs[5]="003eff"; break;//air + case 9: cs[0]="f70"; cs[1]="421"; cs[2]="221"; cs[3]="a50"; cs[4]="f70"; cs[5]="f70"; break;//nixie + case 10: cs[0]="2d2"; cs[1]="010"; cs[2]="121"; cs[3]="060"; cs[4]="040"; cs[5]="3f3"; break; //terminal + case 14: cs[0]="fc7"; cs[1]="49274a"; cs[2]="94618e"; cs[3]="f4decb"; cs[4]="0008"; cs[5]="f4decb"; break; //end + case 15: for (int i=0;i<6;i++)cs[i]=cssCol[i];//custom } cssColorString="