Migrated to AsyncWebServer
This commit is contained in:
parent
76f1c689c1
commit
5694ff7c97
@ -6,13 +6,12 @@
|
|||||||
//see https://github.com/Aircoookie/WLED/issues/2 for flicker free ESP32 support
|
//see https://github.com/Aircoookie/WLED/issues/2 for flicker free ESP32 support
|
||||||
|
|
||||||
//PIN CONFIGURATION
|
//PIN CONFIGURATION
|
||||||
#define LEDPIN 3 //strip pin. Any for ESP32, gpio2 is recommended for ESP8266
|
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 or 3 is recommended for ESP8266 (gpio2/3 are labeled D4/RX on NodeMCU and Wemos)
|
||||||
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
|
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
|
||||||
#define IR_PIN 4 //infrared pin.
|
#define IR_PIN 4 //infrared pin.
|
||||||
#define AUXPIN 15 //unused auxiliary output pin
|
#define AUXPIN 15 //unused auxiliary output pin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//automatically uses the right driver method for each platform
|
//automatically uses the right driver method for each platform
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#ifdef WORKAROUND_ESP32_BITBANG
|
#ifdef WORKAROUND_ESP32_BITBANG
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
* 4. update length value
|
* 4. update length value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uint16_t PAGE_index0_L = 10264;
|
const uint16_t PAGE_index_L = 10264;
|
||||||
|
|
||||||
const char PAGE_index0[] PROGMEM = {
|
const uint8_t PAGE_index[] PROGMEM = {
|
||||||
0x1f, 0x8b, 0x08, 0x08, 0x67, 0x5e, 0x61, 0x5c, 0x00, 0x03, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65,
|
0x1f, 0x8b, 0x08, 0x08, 0x67, 0x5e, 0x61, 0x5c, 0x00, 0x03, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65,
|
||||||
0x73, 0x73, 0x65, 0x64, 0x20, 0x28, 0x37, 0x29, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0xcc, 0x5a,
|
0x73, 0x73, 0x65, 0x64, 0x20, 0x28, 0x37, 0x29, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0xcc, 0x5a,
|
||||||
0xe9, 0x72, 0xdb, 0x46, 0xb6, 0xfe, 0xaf, 0xa7, 0x80, 0xe9, 0x4a, 0x4c, 0x46, 0x04, 0x88, 0x9d,
|
0xe9, 0x72, 0xdb, 0x46, 0xb6, 0xfe, 0xaf, 0xa7, 0x80, 0xe9, 0x4a, 0x4c, 0x46, 0x04, 0x88, 0x9d,
|
||||||
|
@ -19,7 +19,7 @@ Mobile UI is unsupported in this build. Go to /settings/ui and change UI mode to
|
|||||||
#else WLED_DISABLE_MOBILE_UI
|
#else WLED_DISABLE_MOBILE_UI
|
||||||
const uint16_t PAGE_indexM_L = 19259; //length of the binary payload
|
const uint16_t PAGE_indexM_L = 19259; //length of the binary payload
|
||||||
|
|
||||||
const char PAGE_indexM[] PROGMEM = {
|
const uint8_t PAGE_indexM[] PROGMEM = {
|
||||||
0x1f, 0x8b, 0x08, 0x08, 0xcf, 0xcd, 0x62, 0x5c, 0x00, 0x03, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65,
|
0x1f, 0x8b, 0x08, 0x08, 0xcf, 0xcd, 0x62, 0x5c, 0x00, 0x03, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65,
|
||||||
0x73, 0x73, 0x65, 0x64, 0x20, 0x28, 0x39, 0x29, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0xed, 0xbd,
|
0x73, 0x73, 0x65, 0x64, 0x20, 0x28, 0x39, 0x29, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0xed, 0xbd,
|
||||||
0x69, 0x7b, 0xda, 0x48, 0xb7, 0x28, 0xfa, 0xfd, 0xfd, 0x15, 0x6e, 0xfa, 0x79, 0xbb, 0x21, 0xc2,
|
0x69, 0x7b, 0xda, 0x48, 0xb7, 0x28, 0xfa, 0xfd, 0xfd, 0x15, 0x6e, 0xfa, 0x79, 0xbb, 0x21, 0xc2,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3,16 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//common CSS of settings pages
|
//common CSS of settings pages
|
||||||
const char PAGE_settingsCss[] PROGMEM = R"=====(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:4em}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) );}td{padding:2px;}</style>)=====";
|
const char PAGE_settingsCss[] PROGMEM = R"=====(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:4em}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) );}td{padding:2px;}</style>)=====";
|
||||||
|
|
||||||
|
|
||||||
//settings menu
|
//settings menu
|
||||||
const char PAGE_settings0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><title>WLED Settings</title>)=====";
|
<html><head><title>WLED Settings</title>%CSS%body{text-align:center;background:var(--cCol);height:100%%;margin:0;background-attachment:fixed}html{--h:11.55vh}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),Helvetica,sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:var(--h);width:95%%;margin-top:2.4vh}</style>
|
||||||
|
<script>function BB(){if(window.frameElement){document.getElementById("b").style.display="none";document.documentElement.style.setProperty("--h","13.86vh")}};</script></head>
|
||||||
const char PAGE_settings1[] PROGMEM = R"=====(body{text-align:center;background:var(--cCol);height:100%;margin:0;background-attachment:fixed}html{--h:11.55vh}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),Helvetica,sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:var(--h);width:95%;margin-top:2.4vh}</style>
|
|
||||||
<script>function BB(){if(window.frameElement){document.getElementById("b").style.display="none";document.documentElement.style.setProperty("--h","13.86vh")}};</script>
|
|
||||||
</head>
|
|
||||||
<body onload=BB()>
|
<body onload=BB()>
|
||||||
<form action=/><button type=submit id=b>Back</button></form>
|
<form action=/><button type=submit id=b>Back</button></form>
|
||||||
<form action=/settings/wifi><button type=submit>WiFi Setup</button></form>
|
<form action=/settings/wifi><button type=submit>WiFi Setup</button></form>
|
||||||
@ -21,17 +18,14 @@ const char PAGE_settings1[] PROGMEM = R"=====(body{text-align:center;background:
|
|||||||
<form action=/settings/sync><button type=submit>Sync Interfaces</button></form>
|
<form action=/settings/sync><button type=submit>Sync Interfaces</button></form>
|
||||||
<form action=/settings/time><button type=submit>Time & Macros</button></form>
|
<form action=/settings/time><button type=submit>Time & Macros</button></form>
|
||||||
<form action=/settings/sec><button type=submit>Security & Updates</button></form>
|
<form action=/settings/sec><button type=submit>Security & Updates</button></form>
|
||||||
</body>
|
</body></html>)=====";
|
||||||
</html>)=====";
|
|
||||||
|
|
||||||
|
|
||||||
//wifi settings
|
//wifi settings
|
||||||
const char PAGE_settings_wifi0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_wifi[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500">
|
<html><head><meta name="viewport" content="width=500">
|
||||||
<title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d = document;)=====";
|
<title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d=document;
|
||||||
|
%CSS%%SCSS%</head><body onload="GetV()">
|
||||||
const char PAGE_settings_wifi1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="GetV()">
|
|
||||||
<form id="form_s" name="Sf" method="post">
|
<form id="form_s" name="Sf" method="post">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button><hr>
|
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button><hr>
|
||||||
@ -71,7 +65,7 @@ AP IP: <span class="sip"> Not active </span><hr>
|
|||||||
|
|
||||||
|
|
||||||
//LED settings
|
//LED settings
|
||||||
const char PAGE_settings_leds0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_leds[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500">
|
<html><head><meta name="viewport" content="width=500">
|
||||||
<title>LED Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");}function B(){window.history.back();}function S(){GetV();UI();}function UI(){
|
<title>LED Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");}function B(){window.history.back();}function S(){GetV();UI();}function UI(){
|
||||||
var myC=document.querySelectorAll('.wc'),l=myC.length;
|
var myC=document.querySelectorAll('.wc'),l=myC.length;
|
||||||
@ -80,9 +74,7 @@ var val=Math.ceil((100+document.Sf.LC.value*55)/500)/2;
|
|||||||
val=(val>5)?Math.ceil(val):val;var s="";
|
val=(val>5)?Math.ceil(val):val;var s="";
|
||||||
if (val<1.1){s="ESP 5V pin with 1A USB supply";}else{s="External 5V ";s+=val;s+="A supply connected to LEDs";}
|
if (val<1.1){s="ESP 5V pin with 1A USB supply";}else{s="External 5V ";s+=val;s+="A supply connected to LEDs";}
|
||||||
document.getElementById('psu').innerHTML=s;document.getElementById('ps2').innerHTML=val+"A = "+val*1000;
|
document.getElementById('psu').innerHTML=s;document.getElementById('ps2').innerHTML=val+"A = "+val*1000;
|
||||||
}function GetV(){var d = document;)=====";
|
}function GetV(){var d=document;%CSS%%SCSS%</head>
|
||||||
|
|
||||||
const char PAGE_settings_leds1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="S()">
|
<body onload="S()">
|
||||||
<form id="form_s" name="Sf" method="post">
|
<form id="form_s" name="Sf" method="post">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
@ -113,7 +105,7 @@ Default RGB color:
|
|||||||
<span class="wc">Default white value: <input name="CW" type="number" min="0" max="255" required><br>
|
<span class="wc">Default white value: <input name="CW" type="number" min="0" max="255" required><br>
|
||||||
Auto-calculate white from RGB instead: <input type="checkbox" name="AW"><br></span>
|
Auto-calculate white from RGB instead: <input type="checkbox" name="AW"><br></span>
|
||||||
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br>
|
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br>
|
||||||
Default effect ID: <input name="FX" type="number" min="0" max="57" required><br>
|
Default effect ID: <input name="FX" type="number" min="0" max="79" required><br>
|
||||||
Default effect speed: <input name="SX" type="number" min="0" max="255" required><br>
|
Default effect speed: <input name="SX" type="number" min="0" max="255" required><br>
|
||||||
Default effect intensity: <input name="IX" type="number" min="0" max="255" required><br>
|
Default effect intensity: <input name="IX" type="number" min="0" max="255" required><br>
|
||||||
Default effect palette: <input name="FP" type="number" min="0" max="255" required><br>
|
Default effect palette: <input name="FP" type="number" min="0" max="255" required><br>
|
||||||
@ -127,7 +119,7 @@ Apply preset <input name="BP" type="number" min="0" max="25" required> at boot (
|
|||||||
Save current preset cycle configuration as boot default: <input type="checkbox" name="PC"><br><br>
|
Save current preset cycle configuration as boot default: <input type="checkbox" name="PC"><br><br>
|
||||||
Use Gamma correction for color: <input type="checkbox" name="GC"> (strongly recommended)<br>
|
Use Gamma correction for color: <input type="checkbox" name="GC"> (strongly recommended)<br>
|
||||||
Use Gamma correction for brightness: <input type="checkbox" name="GB"> (not recommended)<br><br>
|
Use Gamma correction for brightness: <input type="checkbox" name="GB"> (not recommended)<br><br>
|
||||||
Brightness factor: <input name="BF" type="number" min="0" max="255" required> %
|
Brightness factor: <input name="BF" type="number" min="0" max="255" required> %%
|
||||||
<h3>Transitions</h3>
|
<h3>Transitions</h3>
|
||||||
Crossfade: <input type="checkbox" name="TF"><br>
|
Crossfade: <input type="checkbox" name="TF"><br>
|
||||||
Transition Time: <input name="TD" maxlength="5" size="2"> ms<br>
|
Transition Time: <input name="TD" maxlength="5" size="2"> ms<br>
|
||||||
@ -154,12 +146,11 @@ Skip first LED: <input type="checkbox" name="SL"><hr>
|
|||||||
|
|
||||||
|
|
||||||
//User Interface settings
|
//User Interface settings
|
||||||
const char PAGE_settings_ui0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_ui[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500">
|
<html><head><meta name="viewport" content="width=500">
|
||||||
<title>UI Settings</title><script>
|
<title>UI Settings</title><script>
|
||||||
function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d = document;)=====";
|
function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d=document;
|
||||||
|
%CSS%%SCSS%</head>
|
||||||
const char PAGE_settings_ui1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="S()">
|
<body onload="S()">
|
||||||
<form id="form_s" name="Sf" method="post">
|
<form id="form_s" name="Sf" method="post">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
@ -210,11 +201,10 @@ Make sure the font you use is installed on your system!<br>
|
|||||||
|
|
||||||
|
|
||||||
//sync settings
|
//sync settings
|
||||||
const char PAGE_settings_sync0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_sync[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500"><title>Sync Settings</title>
|
<html><head><meta name="viewport" content="width=500"><title>Sync Settings</title>
|
||||||
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d = document;)=====";
|
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d=document;
|
||||||
|
%CSS%%SCSS%</head>
|
||||||
const char PAGE_settings_sync1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="GetV()">
|
<body onload="GetV()">
|
||||||
<form id="form_s" name="Sf" method="post">
|
<form id="form_s" name="Sf" method="post">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
@ -277,14 +267,13 @@ Hue status: <span class="hms"> Internal ESP Error! </span><hr>
|
|||||||
|
|
||||||
|
|
||||||
//time and macro settings
|
//time and macro settings
|
||||||
const char PAGE_settings_time0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_time[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500"><title>Time Settings</title>
|
<html><head><meta name="viewport" content="width=500"><title>Time Settings</title>
|
||||||
<script>var d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings");}function B(){window.open("/settings","_self");}function S(){BTa();GetV();Cs();FC();}function gId(s){return d.getElementById(s);}function Cs(){gId("cac").style.display="none";gId("coc").style.display="block";gId("ccc").style.display="none";if (gId("ca").selected){gId("cac").style.display="block";}if (gId("cc").selected){gId("coc").style.display="none";gId("ccc").style.display="block";}if (gId("cn").selected){gId("coc").style.display="none";}}
|
<script>var d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings");}function B(){window.open("/settings","_self");}function S(){BTa();GetV();Cs();FC();}function gId(s){return d.getElementById(s);}function Cs(){gId("cac").style.display="none";gId("coc").style.display="block";gId("ccc").style.display="none";if (gId("ca").selected){gId("cac").style.display="block";}if (gId("cc").selected){gId("coc").style.display="none";gId("ccc").style.display="block";}if (gId("cn").selected){gId("coc").style.display="none";}}
|
||||||
function BTa(){var ih="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Macro</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";for (i=0;i<8;i++){ih+="<tr><td><input name=\"W"+i+"\" id=\"W"+i+"\" type=\"number\" style=\"display:none\"><input id=\"W"+i+"0\" type=\"checkbox\"></td><td><input name=\"H"+i+"\" type=\"number\" min=\"0\" max=\"24\"></td><td><input name=\"N"+i+"\" type=\"number\" min=\"0\" max=\"59\"></td><td><input name=\"T"+i+"\" type=\"number\" min=\"0\" max=\"16\"></td>";for (j=1;j<8;j++) ih+="<td><input id=\"W"+i+j+"\" type=\"checkbox\"></td>";}gId("TMT").innerHTML=ih;}
|
function BTa(){var ih="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Macro</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";for (i=0;i<8;i++){ih+="<tr><td><input name=\"W"+i+"\" id=\"W"+i+"\" type=\"number\" style=\"display:none\"><input id=\"W"+i+"0\" type=\"checkbox\"></td><td><input name=\"H"+i+"\" type=\"number\" min=\"0\" max=\"24\"></td><td><input name=\"N"+i+"\" type=\"number\" min=\"0\" max=\"59\"></td><td><input name=\"T"+i+"\" type=\"number\" min=\"0\" max=\"16\"></td>";for (j=1;j<8;j++) ih+="<td><input id=\"W"+i+j+"\" type=\"checkbox\"></td>";}gId("TMT").innerHTML=ih;}
|
||||||
function FC(){for(j=0;j<8;j++){for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1;}}
|
function FC(){for(j=0;j<8;j++){for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1;}}
|
||||||
function Wd(){a=[0,0,0,0,0,0,0,0];for(i=0;i<8;i++){m=1;for(j=0;j<8;j++){a[i]+=gId("W"+i+j).checked*m;m*=2;}gId("W"+i).value=a[i];}}function GetV(){)=====";
|
function Wd(){a=[0,0,0,0,0,0,0,0];for(i=0;i<8;i++){m=1;for(j=0;j<8;j++){a[i]+=gId("W"+i+j).checked*m;m*=2;}gId("W"+i).value=a[i];}}function GetV(){
|
||||||
|
%CSS%%SCSS%</head>
|
||||||
const char PAGE_settings_time1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="S()">
|
<body onload="S()">
|
||||||
<form id="form_s" name="Sf" method="post" onsubmit="Wd()">
|
<form id="form_s" name="Sf" method="post" onsubmit="Wd()">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
@ -369,12 +358,11 @@ Time-Controlled Macros:<br>
|
|||||||
|
|
||||||
|
|
||||||
//security settings and about
|
//security settings and about
|
||||||
const char PAGE_settings_sec0[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_settings_sec[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta name="viewport" content="width=500">
|
<html><head><meta name="viewport" content="width=500">
|
||||||
<title>Misc Settings</title>
|
<title>Misc Settings</title>
|
||||||
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d = document;)=====";
|
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d=document;
|
||||||
|
%CSS%%SCSS%</head>
|
||||||
const char PAGE_settings_sec1[] PROGMEM = R"=====(</head>
|
|
||||||
<body onload="GetV()">
|
<body onload="GetV()">
|
||||||
<form id="form_s" name="Sf" method="post">
|
<form id="form_s" name="Sf" method="post">
|
||||||
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
<div class="helpB"><button type="button" onclick="H()">?</button></div>
|
||||||
|
@ -33,16 +33,17 @@
|
|||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
||||||
#include "src/dependencies/webserver/Webserver->h"
|
#include <AsyncTCP.h>
|
||||||
|
#include <AsyncWebServer.h>
|
||||||
#include <HTTPClient.h>
|
#include <HTTPClient.h>
|
||||||
/*#ifndef WLED_DISABLE_INFRARED
|
/*#ifndef WLED_DISABLE_INFRARED
|
||||||
#include <IRremote.h>
|
#include <IRremote.h>
|
||||||
#endif*/ //there are issues with ESP32 infrared, so it is disabled for now
|
#endif*/ //there are issues with ESP32 infrared, so it is disabled for now
|
||||||
#else
|
#else
|
||||||
#define TEMPLATE_PLACEHOLDER '~'
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
#include <ESP8266Webserver.h>
|
#include <ESPAsyncTCP.h>
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
#ifndef WLED_DISABLE_INFRARED
|
#ifndef WLED_DISABLE_INFRARED
|
||||||
#include <IRremoteESP8266.h>
|
#include <IRremoteESP8266.h>
|
||||||
@ -53,15 +54,16 @@
|
|||||||
|
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <DNSserver.h>
|
#include <DNSServer.h>
|
||||||
#ifndef WLED_DISABLE_OTA
|
#ifndef WLED_DISABLE_OTA
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#include "src/dependencies/webserver/ESP8266HTTPUpdateserver->h"
|
//#include "src/dependencies/webserver/ESP8266HTTPUpdateServer.h"
|
||||||
#endif
|
#endif
|
||||||
#include "src/dependencies/time/Time.h"
|
#include "src/dependencies/time/Time.h"
|
||||||
#include "src/dependencies/time/TimeLib.h"
|
#include "src/dependencies/time/TimeLib.h"
|
||||||
#include "src/dependencies/timezone/Timezone.h"
|
#include "src/dependencies/timezone/Timezone.h"
|
||||||
#ifndef WLED_DISABLE_ALEXA
|
#ifndef WLED_DISABLE_ALEXA
|
||||||
|
#define ESPALEXA_ASYNC
|
||||||
#define ESPALEXA_MAXDEVICES 1
|
#define ESPALEXA_MAXDEVICES 1
|
||||||
#include "src/dependencies/espalexa/Espalexa.h"
|
#include "src/dependencies/espalexa/Espalexa.h"
|
||||||
#endif
|
#endif
|
||||||
@ -79,8 +81,8 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1902122
|
#define VERSION 1902162
|
||||||
char versionString[] = "0.8.3";
|
char versionString[] = "0.8.4-dev";
|
||||||
|
|
||||||
|
|
||||||
//AP and OTA default passwords (for maximum change them!)
|
//AP and OTA default passwords (for maximum change them!)
|
||||||
@ -176,7 +178,7 @@ bool notifyTwice = false; //notifications use UDP: enable if
|
|||||||
bool alexaEnabled = true; //enable device discovery by Amazon Echo
|
bool alexaEnabled = true; //enable device discovery by Amazon Echo
|
||||||
char alexaInvocationName[33] = "Light"; //speech control name of device. Choose something voice-to-text can understand
|
char alexaInvocationName[33] = "Light"; //speech control name of device. Choose something voice-to-text can understand
|
||||||
|
|
||||||
char blynkApiKey[36] = ""; //Auth token for Blynk server-> If empty, no connection will be made
|
char blynkApiKey[36] = ""; //Auth token for Blynk server. If empty, no connection will be made
|
||||||
|
|
||||||
uint16_t realtimeTimeoutMs = 2500; //ms timeout of realtime mode before returning to normal mode
|
uint16_t realtimeTimeoutMs = 2500; //ms timeout of realtime mode before returning to normal mode
|
||||||
int arlsOffset = 0; //realtime LED offset
|
int arlsOffset = 0; //realtime LED offset
|
||||||
@ -394,18 +396,17 @@ unsigned int ntpLocalPort = 2390;
|
|||||||
char obuf[OMAX];
|
char obuf[OMAX];
|
||||||
uint16_t olen = 0;
|
uint16_t olen = 0;
|
||||||
|
|
||||||
|
String messageHead, messageSub;
|
||||||
|
uint32_t optionType;
|
||||||
|
|
||||||
//server library objects
|
//server library objects
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
AsyncWebServer server(80);
|
||||||
WebServer server(80);
|
|
||||||
#else
|
|
||||||
ESP8266WebServer server(80);
|
|
||||||
#endif
|
|
||||||
HTTPClient* hueClient = NULL;
|
HTTPClient* hueClient = NULL;
|
||||||
WiFiClient* mqttTCPClient = NULL;
|
WiFiClient* mqttTCPClient = NULL;
|
||||||
PubSubClient* mqtt = NULL;
|
PubSubClient* mqtt = NULL;
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_OTA
|
#ifndef WLED_DISABLE_OTA
|
||||||
ESP8266HTTPUpdateServer httpUpdater;
|
//ESP8266HTTPUpdateServer httpUpdater;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//udp interface objects
|
//udp interface objects
|
||||||
@ -458,7 +459,7 @@ const byte gamma8[] = {
|
|||||||
String txd = "Please disable OTA Lock in security settings!";
|
String txd = "Please disable OTA Lock in security settings!";
|
||||||
|
|
||||||
//function prototypes
|
//function prototypes
|
||||||
void serveMessage(int,String,String,int=255);
|
void serveMessage(AsyncWebServerRequest*,uint16_t,String,String,uint32_t);
|
||||||
|
|
||||||
|
|
||||||
//turns all LEDs off and restarts ESP
|
//turns all LEDs off and restarts ESP
|
||||||
@ -500,7 +501,6 @@ void setup() {
|
|||||||
|
|
||||||
//main program loop
|
//main program loop
|
||||||
void loop() {
|
void loop() {
|
||||||
server->handleClient();
|
|
||||||
handleSerial();
|
handleSerial();
|
||||||
handleNotifications();
|
handleNotifications();
|
||||||
handleTransitions();
|
handleTransitions();
|
||||||
@ -522,7 +522,7 @@ void loop() {
|
|||||||
|
|
||||||
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
|
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
|
||||||
{
|
{
|
||||||
if (dnsActive) dnsserver.processNextRequest();
|
if (dnsActive) dnsServer.processNextRequest();
|
||||||
#ifndef WLED_DISABLE_OTA
|
#ifndef WLED_DISABLE_OTA
|
||||||
if (aOtaEnabled) ArduinoOTA.handle();
|
if (aOtaEnabled) ArduinoOTA.handle();
|
||||||
#endif
|
#endif
|
||||||
|
@ -603,7 +603,7 @@ void applyMacro(byte index)
|
|||||||
*/
|
*/
|
||||||
forbidden = forbidden + index;
|
forbidden = forbidden + index;
|
||||||
if (mc.indexOf(forbidden) >= 0) return;
|
if (mc.indexOf(forbidden) >= 0) return;
|
||||||
handleSet(mc);
|
handleSet(nullptr, mc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//build XML response to HTTP /win API request
|
//build XML response to HTTP /win API request
|
||||||
void XML_response(bool isHTTP, bool includeTheme)
|
void XML_response(AsyncWebServerRequest *request, bool includeTheme)
|
||||||
{
|
{
|
||||||
olen = 0;
|
olen = 0;
|
||||||
oappend("<?xml version = \"1.0\" ?><vs><ac>");
|
oappend("<?xml version = \"1.0\" ?><vs><ac>");
|
||||||
@ -79,7 +79,7 @@ void XML_response(bool isHTTP, bool includeTheme)
|
|||||||
oappend("</cf></th>");
|
oappend("</cf></th>");
|
||||||
}
|
}
|
||||||
oappend("</vs>");
|
oappend("</vs>");
|
||||||
if (isHTTP) server->send(200, "text/xml", obuf);
|
if (request != nullptr) request->send(200, "text/xml", obuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//append a numeric setting to string buffer
|
//append a numeric setting to string buffer
|
||||||
|
@ -15,7 +15,7 @@ void _setRandomColor(bool _sec,bool fromButton=false)
|
|||||||
|
|
||||||
|
|
||||||
//called upon POST settings form submit
|
//called upon POST settings form submit
|
||||||
void handleSettingsSet(byte subPage)
|
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||||
{
|
{
|
||||||
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
|
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
|
||||||
if (subPage <1 || subPage >6) return;
|
if (subPage <1 || subPage >6) return;
|
||||||
@ -23,16 +23,16 @@ void handleSettingsSet(byte subPage)
|
|||||||
//WIFI SETTINGS
|
//WIFI SETTINGS
|
||||||
if (subPage == 1)
|
if (subPage == 1)
|
||||||
{
|
{
|
||||||
strcpy(clientSSID,server->arg("CS").c_str());
|
strcpy(clientSSID,request->arg("CS").c_str());
|
||||||
if (server->arg("CP").charAt(0) != '*') strcpy(clientPass, server->arg("CP").c_str());
|
if (request->arg("CP").charAt(0) != '*') strcpy(clientPass, request->arg("CP").c_str());
|
||||||
|
|
||||||
strcpy(cmDNS, server->arg("CM").c_str());
|
strcpy(cmDNS, request->arg("CM").c_str());
|
||||||
|
|
||||||
int t = server->arg("AT").toInt(); if (t > 9 && t <= 255) apWaitTimeSecs = t;
|
int t = request->arg("AT").toInt(); if (t > 9 && t <= 255) apWaitTimeSecs = t;
|
||||||
strcpy(apSSID, server->arg("AS").c_str());
|
strcpy(apSSID, request->arg("AS").c_str());
|
||||||
apHide = server->hasArg("AH");
|
apHide = request->hasArg("AH");
|
||||||
if (server->arg("AP").charAt(0) != '*') strcpy(apPass, server->arg("AP").c_str());
|
if (request->arg("AP").charAt(0) != '*') strcpy(apPass, request->arg("AP").c_str());
|
||||||
t = server->arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t;
|
t = request->arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t;
|
||||||
|
|
||||||
char k[3]; k[2] = 0;
|
char k[3]; k[2] = 0;
|
||||||
for (int i = 0; i<4; i++)
|
for (int i = 0; i<4; i++)
|
||||||
@ -40,32 +40,32 @@ void handleSettingsSet(byte subPage)
|
|||||||
k[1] = i+48;//ascii 0,1,2,3
|
k[1] = i+48;//ascii 0,1,2,3
|
||||||
|
|
||||||
k[0] = 'I'; //static IP
|
k[0] = 'I'; //static IP
|
||||||
staticIP[i] = server->arg(k).toInt();
|
staticIP[i] = request->arg(k).toInt();
|
||||||
|
|
||||||
k[0] = 'G'; //gateway
|
k[0] = 'G'; //gateway
|
||||||
staticGateway[i] = server->arg(k).toInt();
|
staticGateway[i] = request->arg(k).toInt();
|
||||||
|
|
||||||
k[0] = 'S'; //subnet
|
k[0] = 'S'; //subnet
|
||||||
staticSubnet[i] = server->arg(k).toInt();
|
staticSubnet[i] = request->arg(k).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//LED SETTINGS
|
//LED SETTINGS
|
||||||
if (subPage == 2)
|
if (subPage == 2)
|
||||||
{
|
{
|
||||||
int t = server->arg("LC").toInt();
|
int t = request->arg("LC").toInt();
|
||||||
if (t > 0 && t <= 1200) ledCount = t;
|
if (t > 0 && t <= 1200) ledCount = t;
|
||||||
//RMT eats up too much RAM
|
//RMT eats up too much RAM
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
if (ledCount > 600) ledCount = 600;
|
if (ledCount > 600) ledCount = 600;
|
||||||
#endif
|
#endif
|
||||||
strip.ablMilliampsMax = server->arg("MA").toInt();
|
strip.ablMilliampsMax = request->arg("MA").toInt();
|
||||||
useRGBW = server->hasArg("EW");
|
useRGBW = request->hasArg("EW");
|
||||||
strip.colorOrder = server->arg("CO").toInt();
|
strip.colorOrder = request->arg("CO").toInt();
|
||||||
autoRGBtoRGBW = server->hasArg("AW");
|
autoRGBtoRGBW = request->hasArg("AW");
|
||||||
|
|
||||||
//ignore settings and save current brightness, colors and fx as default
|
//ignore settings and save current brightness, colors and fx as default
|
||||||
if (server->hasArg("IS"))
|
if (request->hasArg("IS"))
|
||||||
{
|
{
|
||||||
for (byte i=0; i<4; i++)
|
for (byte i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
@ -78,122 +78,122 @@ void handleSettingsSet(byte subPage)
|
|||||||
effectIntensityDefault = effectIntensity;
|
effectIntensityDefault = effectIntensity;
|
||||||
effectPaletteDefault = effectPalette;
|
effectPaletteDefault = effectPalette;
|
||||||
} else {
|
} else {
|
||||||
colS[0] = server->arg("CR").toInt();
|
colS[0] = request->arg("CR").toInt();
|
||||||
colS[1] = server->arg("CG").toInt();
|
colS[1] = request->arg("CG").toInt();
|
||||||
colS[2] = server->arg("CB").toInt();
|
colS[2] = request->arg("CB").toInt();
|
||||||
colSecS[0] = server->arg("SR").toInt();
|
colSecS[0] = request->arg("SR").toInt();
|
||||||
colSecS[1] = server->arg("SG").toInt();
|
colSecS[1] = request->arg("SG").toInt();
|
||||||
colSecS[2] = server->arg("SB").toInt();
|
colSecS[2] = request->arg("SB").toInt();
|
||||||
colS[3] = server->arg("CW").toInt();
|
colS[3] = request->arg("CW").toInt();
|
||||||
colSecS[3] = server->arg("SW").toInt();
|
colSecS[3] = request->arg("SW").toInt();
|
||||||
briS = server->arg("CA").toInt();
|
briS = request->arg("CA").toInt();
|
||||||
effectDefault = server->arg("FX").toInt();
|
effectDefault = request->arg("FX").toInt();
|
||||||
effectSpeedDefault = server->arg("SX").toInt();
|
effectSpeedDefault = request->arg("SX").toInt();
|
||||||
effectIntensityDefault = server->arg("IX").toInt();
|
effectIntensityDefault = request->arg("IX").toInt();
|
||||||
effectPaletteDefault = server->arg("FP").toInt();
|
effectPaletteDefault = request->arg("FP").toInt();
|
||||||
}
|
}
|
||||||
saveCurrPresetCycConf = server->hasArg("PC");
|
saveCurrPresetCycConf = request->hasArg("PC");
|
||||||
turnOnAtBoot = server->hasArg("BO");
|
turnOnAtBoot = request->hasArg("BO");
|
||||||
t = server->arg("BP").toInt();
|
t = request->arg("BP").toInt();
|
||||||
if (t <= 25) bootPreset = t;
|
if (t <= 25) bootPreset = t;
|
||||||
useGammaCorrectionBri = server->hasArg("GB");
|
useGammaCorrectionBri = request->hasArg("GB");
|
||||||
useGammaCorrectionRGB = server->hasArg("GC");
|
useGammaCorrectionRGB = request->hasArg("GC");
|
||||||
|
|
||||||
fadeTransition = server->hasArg("TF");
|
fadeTransition = request->hasArg("TF");
|
||||||
t = server->arg("TD").toInt();
|
t = request->arg("TD").toInt();
|
||||||
if (t > 0) transitionDelay = t;
|
if (t > 0) transitionDelay = t;
|
||||||
transitionDelayDefault = t;
|
transitionDelayDefault = t;
|
||||||
strip.paletteFade = server->hasArg("PF");
|
strip.paletteFade = request->hasArg("PF");
|
||||||
enableSecTransition = server->hasArg("T2");
|
enableSecTransition = request->hasArg("T2");
|
||||||
|
|
||||||
nightlightTargetBri = server->arg("TB").toInt();
|
nightlightTargetBri = request->arg("TB").toInt();
|
||||||
t = server->arg("TL").toInt();
|
t = request->arg("TL").toInt();
|
||||||
if (t > 0) nightlightDelayMinsDefault = t;
|
if (t > 0) nightlightDelayMinsDefault = t;
|
||||||
nightlightFade = server->hasArg("TW");
|
nightlightFade = request->hasArg("TW");
|
||||||
|
|
||||||
t = server->arg("PB").toInt();
|
t = request->arg("PB").toInt();
|
||||||
if (t >= 0 && t < 4) strip.paletteBlend = t;
|
if (t >= 0 && t < 4) strip.paletteBlend = t;
|
||||||
reverseMode = server->hasArg("RV");
|
reverseMode = request->hasArg("RV");
|
||||||
strip.setReverseMode(reverseMode);
|
strip.setReverseMode(reverseMode);
|
||||||
skipFirstLed = server->hasArg("SL");
|
skipFirstLed = request->hasArg("SL");
|
||||||
t = server->arg("BF").toInt();
|
t = request->arg("BF").toInt();
|
||||||
if (t > 0) briMultiplier = t;
|
if (t > 0) briMultiplier = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
//UI
|
//UI
|
||||||
if (subPage == 3)
|
if (subPage == 3)
|
||||||
{
|
{
|
||||||
int t = server->arg("UI").toInt();
|
int t = request->arg("UI").toInt();
|
||||||
if (t >= 0 && t < 3) uiConfiguration = t;
|
if (t >= 0 && t < 3) uiConfiguration = t;
|
||||||
strcpy(serverDescription, server->arg("DS").c_str());
|
strcpy(serverDescription, request->arg("DS").c_str());
|
||||||
useHSBDefault = server->hasArg("MD");
|
useHSBDefault = request->hasArg("MD");
|
||||||
useHSB = useHSBDefault;
|
useHSB = useHSBDefault;
|
||||||
currentTheme = server->arg("TH").toInt();
|
currentTheme = request->arg("TH").toInt();
|
||||||
char k[3]; k[0]='C'; k[2]=0;
|
char k[3]; k[0]='C'; k[2]=0;
|
||||||
for(int i=0;i<6;i++)
|
for(int i=0;i<6;i++)
|
||||||
{
|
{
|
||||||
k[1] = i+48;
|
k[1] = i+48;
|
||||||
strcpy(cssCol[i],server->arg(k).c_str());
|
strcpy(cssCol[i],request->arg(k).c_str());
|
||||||
}
|
}
|
||||||
strcpy(cssFont,server->arg("CF").c_str());
|
strcpy(cssFont,request->arg("CF").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//SYNC
|
//SYNC
|
||||||
if (subPage == 4)
|
if (subPage == 4)
|
||||||
{
|
{
|
||||||
buttonEnabled = server->hasArg("BT");
|
buttonEnabled = request->hasArg("BT");
|
||||||
irEnabled = server->hasArg("IR");
|
irEnabled = request->hasArg("IR");
|
||||||
int t = server->arg("UP").toInt();
|
int t = request->arg("UP").toInt();
|
||||||
if (t > 0) udpPort = t;
|
if (t > 0) udpPort = t;
|
||||||
receiveNotificationBrightness = server->hasArg("RB");
|
receiveNotificationBrightness = request->hasArg("RB");
|
||||||
receiveNotificationColor = server->hasArg("RC");
|
receiveNotificationColor = request->hasArg("RC");
|
||||||
receiveNotificationEffects = server->hasArg("RX");
|
receiveNotificationEffects = request->hasArg("RX");
|
||||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||||
notifyDirectDefault = server->hasArg("SD");
|
notifyDirectDefault = request->hasArg("SD");
|
||||||
notifyDirect = notifyDirectDefault;
|
notifyDirect = notifyDirectDefault;
|
||||||
notifyButton = server->hasArg("SB");
|
notifyButton = request->hasArg("SB");
|
||||||
notifyTwice = server->hasArg("S2");
|
notifyTwice = request->hasArg("S2");
|
||||||
|
|
||||||
receiveDirect = server->hasArg("RD");
|
receiveDirect = request->hasArg("RD");
|
||||||
e131Multicast = server->hasArg("EM");
|
e131Multicast = request->hasArg("EM");
|
||||||
t = server->arg("EU").toInt();
|
t = request->arg("EU").toInt();
|
||||||
if (t > 0 && t <= 63999) e131Universe = t;
|
if (t > 0 && t <= 63999) e131Universe = t;
|
||||||
t = server->arg("ET").toInt();
|
t = request->arg("ET").toInt();
|
||||||
if (t > 99 && t <= 65000) realtimeTimeoutMs = t;
|
if (t > 99 && t <= 65000) realtimeTimeoutMs = t;
|
||||||
arlsForceMaxBri = server->hasArg("FB");
|
arlsForceMaxBri = request->hasArg("FB");
|
||||||
arlsDisableGammaCorrection = server->hasArg("RG");
|
arlsDisableGammaCorrection = request->hasArg("RG");
|
||||||
t = server->arg("WO").toInt();
|
t = request->arg("WO").toInt();
|
||||||
if (t >= -255 && t <= 255) arlsOffset = t;
|
if (t >= -255 && t <= 255) arlsOffset = t;
|
||||||
enableRealtimeUI = server->hasArg("RU");
|
enableRealtimeUI = request->hasArg("RU");
|
||||||
|
|
||||||
alexaEnabled = server->hasArg("AL");
|
alexaEnabled = request->hasArg("AL");
|
||||||
strcpy(alexaInvocationName, server->arg("AI").c_str());
|
strcpy(alexaInvocationName, request->arg("AI").c_str());
|
||||||
notifyAlexa = server->hasArg("SA");
|
notifyAlexa = request->hasArg("SA");
|
||||||
|
|
||||||
if (server->hasArg("BK") && !server->arg("BK").equals("Hidden")) {
|
if (request->hasArg("BK") && !request->arg("BK").equals("Hidden")) {
|
||||||
strcpy(blynkApiKey,server->arg("BK").c_str()); initBlynk(blynkApiKey);
|
strcpy(blynkApiKey,request->arg("BK").c_str()); initBlynk(blynkApiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(mqttServer, server->arg("MS").c_str());
|
strcpy(mqttServer, request->arg("MS").c_str());
|
||||||
strcpy(mqttDeviceTopic, server->arg("MD").c_str());
|
strcpy(mqttDeviceTopic, request->arg("MD").c_str());
|
||||||
strcpy(mqttGroupTopic, server->arg("MG").c_str());
|
strcpy(mqttGroupTopic, request->arg("MG").c_str());
|
||||||
|
|
||||||
notifyHue = server->hasArg("SH");
|
notifyHue = request->hasArg("SH");
|
||||||
for (int i=0;i<4;i++){
|
for (int i=0;i<4;i++){
|
||||||
String a = "H"+String(i);
|
String a = "H"+String(i);
|
||||||
hueIP[i] = server->arg(a).toInt();
|
hueIP[i] = request->arg(a).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
t = server->arg("HL").toInt();
|
t = request->arg("HL").toInt();
|
||||||
if (t > 0) huePollLightId = t;
|
if (t > 0) huePollLightId = t;
|
||||||
|
|
||||||
t = server->arg("HI").toInt();
|
t = request->arg("HI").toInt();
|
||||||
if (t > 50) huePollIntervalMs = t;
|
if (t > 50) huePollIntervalMs = t;
|
||||||
|
|
||||||
hueApplyOnOff = server->hasArg("HO");
|
hueApplyOnOff = request->hasArg("HO");
|
||||||
hueApplyBri = server->hasArg("HB");
|
hueApplyBri = request->hasArg("HB");
|
||||||
hueApplyColor = server->hasArg("HC");
|
hueApplyColor = request->hasArg("HC");
|
||||||
if (server->hasArg("HP"))
|
if (request->hasArg("HP"))
|
||||||
{
|
{
|
||||||
if (!huePollingEnabled) hueAttempt = true;
|
if (!huePollingEnabled) hueAttempt = true;
|
||||||
if (!setupHue()) hueAttempt = true;
|
if (!setupHue()) hueAttempt = true;
|
||||||
@ -207,54 +207,54 @@ void handleSettingsSet(byte subPage)
|
|||||||
//TIME
|
//TIME
|
||||||
if (subPage == 5)
|
if (subPage == 5)
|
||||||
{
|
{
|
||||||
ntpEnabled = server->hasArg("NT");
|
ntpEnabled = request->hasArg("NT");
|
||||||
useAMPM = !server->hasArg("CF");
|
useAMPM = !request->hasArg("CF");
|
||||||
currentTimezone = server->arg("TZ").toInt();
|
currentTimezone = request->arg("TZ").toInt();
|
||||||
utcOffsetSecs = server->arg("UO").toInt();
|
utcOffsetSecs = request->arg("UO").toInt();
|
||||||
|
|
||||||
//start ntp if not already connected
|
//start ntp if not already connected
|
||||||
if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort);
|
if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||||
|
|
||||||
if (server->hasArg("OL")){
|
if (request->hasArg("OL")){
|
||||||
overlayDefault = server->arg("OL").toInt();
|
overlayDefault = request->arg("OL").toInt();
|
||||||
if (overlayCurrent != overlayDefault) strip.unlockAll();
|
if (overlayCurrent != overlayDefault) strip.unlockAll();
|
||||||
overlayCurrent = overlayDefault;
|
overlayCurrent = overlayDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
overlayMin = server->arg("O1").toInt();
|
overlayMin = request->arg("O1").toInt();
|
||||||
overlayMax = server->arg("O2").toInt();
|
overlayMax = request->arg("O2").toInt();
|
||||||
analogClock12pixel = server->arg("OM").toInt();
|
analogClock12pixel = request->arg("OM").toInt();
|
||||||
analogClock5MinuteMarks = server->hasArg("O5");
|
analogClock5MinuteMarks = request->hasArg("O5");
|
||||||
analogClockSecondsTrail = server->hasArg("OS");
|
analogClockSecondsTrail = request->hasArg("OS");
|
||||||
|
|
||||||
strcpy(cronixieDisplay,server->arg("CX").c_str());
|
strcpy(cronixieDisplay,request->arg("CX").c_str());
|
||||||
bool cbOld = cronixieBacklight;
|
bool cbOld = cronixieBacklight;
|
||||||
cronixieBacklight = server->hasArg("CB");
|
cronixieBacklight = request->hasArg("CB");
|
||||||
if (cbOld != cronixieBacklight && overlayCurrent == 3)
|
if (cbOld != cronixieBacklight && overlayCurrent == 3)
|
||||||
{
|
{
|
||||||
strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0;
|
strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0;
|
||||||
}
|
}
|
||||||
countdownMode = server->hasArg("CE");
|
countdownMode = request->hasArg("CE");
|
||||||
countdownYear = server->arg("CY").toInt();
|
countdownYear = request->arg("CY").toInt();
|
||||||
countdownMonth = server->arg("CI").toInt();
|
countdownMonth = request->arg("CI").toInt();
|
||||||
countdownDay = server->arg("CD").toInt();
|
countdownDay = request->arg("CD").toInt();
|
||||||
countdownHour = server->arg("CH").toInt();
|
countdownHour = request->arg("CH").toInt();
|
||||||
countdownMin = server->arg("CM").toInt();
|
countdownMin = request->arg("CM").toInt();
|
||||||
countdownSec = server->arg("CS").toInt();
|
countdownSec = request->arg("CS").toInt();
|
||||||
|
|
||||||
for (int i=1;i<17;i++)
|
for (int i=1;i<17;i++)
|
||||||
{
|
{
|
||||||
String a = "M"+String(i);
|
String a = "M"+String(i);
|
||||||
if (server->hasArg(a)) saveMacro(i,server->arg(a),false);
|
if (request->hasArg(a.c_str())) saveMacro(i,request->arg(a),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
macroBoot = server->arg("MB").toInt();
|
macroBoot = request->arg("MB").toInt();
|
||||||
macroAlexaOn = server->arg("A0").toInt();
|
macroAlexaOn = request->arg("A0").toInt();
|
||||||
macroAlexaOff = server->arg("A1").toInt();
|
macroAlexaOff = request->arg("A1").toInt();
|
||||||
macroButton = server->arg("MP").toInt();
|
macroButton = request->arg("MP").toInt();
|
||||||
macroLongPress = server->arg("ML").toInt();
|
macroLongPress = request->arg("ML").toInt();
|
||||||
macroCountdown = server->arg("MC").toInt();
|
macroCountdown = request->arg("MC").toInt();
|
||||||
macroNl = server->arg("MN").toInt();
|
macroNl = request->arg("MN").toInt();
|
||||||
|
|
||||||
char k[3]; k[2] = 0;
|
char k[3]; k[2] = 0;
|
||||||
for (int i = 0; i<8; i++)
|
for (int i = 0; i<8; i++)
|
||||||
@ -262,48 +262,48 @@ void handleSettingsSet(byte subPage)
|
|||||||
k[1] = i+48;//ascii 0,1,2,3
|
k[1] = i+48;//ascii 0,1,2,3
|
||||||
|
|
||||||
k[0] = 'H'; //timer hours
|
k[0] = 'H'; //timer hours
|
||||||
timerHours[i] = server->arg(k).toInt();
|
timerHours[i] = request->arg(k).toInt();
|
||||||
|
|
||||||
k[0] = 'N'; //minutes
|
k[0] = 'N'; //minutes
|
||||||
timerMinutes[i] = server->arg(k).toInt();
|
timerMinutes[i] = request->arg(k).toInt();
|
||||||
|
|
||||||
k[0] = 'T'; //macros
|
k[0] = 'T'; //macros
|
||||||
timerMacro[i] = server->arg(k).toInt();
|
timerMacro[i] = request->arg(k).toInt();
|
||||||
|
|
||||||
k[0] = 'W'; //weekdays
|
k[0] = 'W'; //weekdays
|
||||||
timerWeekday[i] = server->arg(k).toInt();
|
timerWeekday[i] = request->arg(k).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SECURITY
|
//SECURITY
|
||||||
if (subPage == 6)
|
if (subPage == 6)
|
||||||
{
|
{
|
||||||
if (server->hasArg("RS")) //complete factory reset
|
if (request->hasArg("RS")) //complete factory reset
|
||||||
{
|
{
|
||||||
clearEEPROM();
|
clearEEPROM();
|
||||||
serveMessage(200, "All Settings erased.", "Connect to WLED-AP to setup again",255);
|
serveMessage(request, 200, "All Settings erased.", "Connect to WLED-AP to setup again",255);
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pwdCorrect = !otaLock; //always allow access if ota not locked
|
bool pwdCorrect = !otaLock; //always allow access if ota not locked
|
||||||
if (server->hasArg("OP"))
|
if (request->hasArg("OP"))
|
||||||
{
|
{
|
||||||
if (otaLock && strcmp(otaPass,server->arg("OP").c_str()) == 0)
|
if (otaLock && strcmp(otaPass,request->arg("OP").c_str()) == 0)
|
||||||
{
|
{
|
||||||
pwdCorrect = true;
|
pwdCorrect = true;
|
||||||
}
|
}
|
||||||
if (!otaLock && server->arg("OP").length() > 0)
|
if (!otaLock && request->arg("OP").length() > 0)
|
||||||
{
|
{
|
||||||
strcpy(otaPass,server->arg("OP").c_str());
|
strcpy(otaPass,request->arg("OP").c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwdCorrect) //allow changes if correct pwd or no ota active
|
if (pwdCorrect) //allow changes if correct pwd or no ota active
|
||||||
{
|
{
|
||||||
otaLock = server->hasArg("NO");
|
otaLock = request->hasArg("NO");
|
||||||
wifiLock = server->hasArg("OW");
|
wifiLock = request->hasArg("OW");
|
||||||
recoveryAPDisabled = server->hasArg("NA");
|
recoveryAPDisabled = request->hasArg("NA");
|
||||||
aOtaEnabled = server->hasArg("AO");
|
aOtaEnabled = request->hasArg("AO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveSettingsToEEPROM();
|
saveSettingsToEEPROM();
|
||||||
@ -320,7 +320,7 @@ int getNumVal(String* req, uint16_t pos)
|
|||||||
|
|
||||||
|
|
||||||
//HTTP API request parser
|
//HTTP API request parser
|
||||||
bool handleSet(String req)
|
bool handleSet(AsyncWebServerRequest *request, String req)
|
||||||
{
|
{
|
||||||
if (!(req.indexOf("win") >= 0)) return false;
|
if (!(req.indexOf("win") >= 0)) return false;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ bool handleSet(String req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = req.indexOf("IN");
|
pos = req.indexOf("IN");
|
||||||
if (pos < 1) XML_response(true, false);
|
if (pos < 1) XML_response(request, false);
|
||||||
return true;
|
return true;
|
||||||
//if you save a macro in one request, other commands in that request are ignored due to unwanted behavior otherwise
|
//if you save a macro in one request, other commands in that request are ignored due to unwanted behavior otherwise
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ bool handleSet(String req)
|
|||||||
|
|
||||||
//internal call, does not send XML response
|
//internal call, does not send XML response
|
||||||
pos = req.indexOf("IN");
|
pos = req.indexOf("IN");
|
||||||
if (pos < 1) XML_response(true, (req.indexOf("IT") > 0)); //include theme if firstload
|
if (pos < 1) XML_response(request, (req.indexOf("IT") > 0)); //include theme if firstload
|
||||||
|
|
||||||
pos = req.indexOf("NN"); //do not send UDP notifications this time
|
pos = req.indexOf("NN"); //do not send UDP notifications this time
|
||||||
colorUpdated((pos > 0) ? 5:1);
|
colorUpdated((pos > 0) ? 5:1);
|
||||||
|
@ -52,8 +52,8 @@ void wledInit()
|
|||||||
//start captive portal if AP active
|
//start captive portal if AP active
|
||||||
if (onlyAP || strlen(apSSID) > 0)
|
if (onlyAP || strlen(apSSID) > 0)
|
||||||
{
|
{
|
||||||
dnsserver.setErrorReplyCode(DNSReplyCode::ServerFailure);
|
dnsServer.setErrorReplyCode(DNSReplyCode::ServerFailure);
|
||||||
dnsserver.start(53, "wled.me", WiFi.softAPIP());
|
dnsServer.start(53, "wled.me", WiFi.softAPIP());
|
||||||
dnsActive = true;
|
dnsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ void wledInit()
|
|||||||
//init Alexa hue emulation
|
//init Alexa hue emulation
|
||||||
if (alexaEnabled && !onlyAP) alexaInit();
|
if (alexaEnabled && !onlyAP) alexaInit();
|
||||||
|
|
||||||
server->begin();
|
server.begin();
|
||||||
DEBUG_PRINTLN("HTTP server started");
|
DEBUG_PRINTLN("HTTP server started");
|
||||||
|
|
||||||
//init ArduinoOTA
|
//init ArduinoOTA
|
||||||
|
@ -60,7 +60,7 @@ BLYNK_WRITE(V2)
|
|||||||
|
|
||||||
BLYNK_WRITE(V3)
|
BLYNK_WRITE(V3)
|
||||||
{
|
{
|
||||||
handleSet((param.asInt()>0)?"win&T=1&IN":"win&T=0&IN");//power
|
handleSet(nullptr, (param.asInt()>0)?"win&T=1&IN":"win&T=0&IN");//power
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V4)
|
BLYNK_WRITE(V4)
|
||||||
@ -83,7 +83,7 @@ BLYNK_WRITE(V6)
|
|||||||
|
|
||||||
BLYNK_WRITE(V7)
|
BLYNK_WRITE(V7)
|
||||||
{
|
{
|
||||||
handleSet((param.asInt()>0)?"win&ND&IN":"win&NL=0&IN");//nl
|
handleSet(nullptr, (param.asInt()>0)?"win&ND&IN":"win&NL=0&IN");//nl
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V8)
|
BLYNK_WRITE(V8)
|
||||||
|
@ -33,7 +33,7 @@ void callbackMQTT(char* topic, byte* payload, unsigned int length) {
|
|||||||
{
|
{
|
||||||
String apireq = "win&";
|
String apireq = "win&";
|
||||||
apireq += (char*)payload;
|
apireq += (char*)payload;
|
||||||
handleSet(apireq);
|
handleSet(nullptr, apireq);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
parseMQTTBriPayload((char*)payload);
|
parseMQTTBriPayload((char*)payload);
|
||||||
@ -62,7 +62,7 @@ void publishMQTT()
|
|||||||
|
|
||||||
//if you want to use this, increase the MQTT buffer in PubSubClient.h to 350+
|
//if you want to use this, increase the MQTT buffer in PubSubClient.h to 350+
|
||||||
//it will publish the API response to MQTT
|
//it will publish the API response to MQTT
|
||||||
/*XML_response(false, false);
|
/*XML_response(nullptr, false);
|
||||||
strcpy(subuf, mqttDeviceTopic);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat(subuf, "/v");
|
strcat(subuf, "/v");
|
||||||
mqtt->publish(subuf, obuf);*/
|
mqtt->publish(subuf, obuf);*/
|
||||||
|
@ -8,118 +8,93 @@ void initServer()
|
|||||||
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
|
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
//settings page
|
//settings page
|
||||||
server->on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveSettings(0);
|
serveSettings(request);
|
||||||
});
|
|
||||||
server->on("/settings/wifi", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
if (!(wifiLock && otaLock))
|
|
||||||
{
|
|
||||||
serveSettings(1);
|
|
||||||
}else{
|
|
||||||
serveMessage(500, "Access Denied", txd, 254);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
server->on("/settings/leds", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(2);
|
|
||||||
});
|
|
||||||
server->on("/settings/ui", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(3);
|
|
||||||
});
|
|
||||||
server->on("/settings/sync", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(4);
|
|
||||||
});
|
|
||||||
server->on("/settings/time", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(5);
|
|
||||||
});
|
|
||||||
server->on("/settings/sec", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(6);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
if(!handleFileRead("/favicon.ico"))
|
if(!handleFileRead("/favicon.ico"))
|
||||||
{
|
{
|
||||||
server->send_P(200, "image/x-icon", favicon, 156);
|
request->send_P(200, "image/x-icon", favicon, 156);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/sliders", HTTP_GET, serveIndex);
|
server.on("/sliders", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
serveIndex(request);
|
||||||
server->on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
serveSettings(255);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(200,"Rebooting now...","(takes ~20 seconds, wait for auto-redirect)",79);
|
serveSettings(request);
|
||||||
|
});
|
||||||
|
|
||||||
|
server.on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
serveMessage(request, 200,"Rebooting now...","(takes ~20 seconds, wait for auto-redirect)",79);
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/wifi", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/wifi", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
if (!(wifiLock && otaLock)) handleSettingsSet(1);
|
if (!(wifiLock && otaLock)) handleSettingsSet(request, 1);
|
||||||
serveMessage(200,"WiFi settings saved.","Rebooting now...",255);
|
serveMessage(request, 200,"WiFi settings saved.","Rebooting now...",255);
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/leds", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/leds", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
handleSettingsSet(2);
|
handleSettingsSet(request, 2);
|
||||||
serveMessage(200,"LED settings saved.","Redirecting...",1);
|
serveMessage(request, 200,"LED settings saved.","Redirecting...",1);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/ui", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/ui", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
handleSettingsSet(3);
|
handleSettingsSet(request, 3);
|
||||||
serveMessage(200,"UI settings saved.","Reloading to apply theme...",122);
|
serveMessage(request, 200,"UI settings saved.","Reloading to apply theme...",122);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/sync", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/sync", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
handleSettingsSet(4);
|
handleSettingsSet(request, 4);
|
||||||
if (hueAttempt)
|
if (hueAttempt)
|
||||||
{
|
{
|
||||||
serveMessage(200,"Hue setup result",hueError,253);
|
serveMessage(request, 200,"Hue setup result",hueError,253);
|
||||||
} else {
|
} else {
|
||||||
serveMessage(200,"Sync settings saved.","Redirecting...",1);
|
serveMessage(request, 200,"Sync settings saved.","Redirecting...",1);
|
||||||
}
|
}
|
||||||
hueAttempt = false;
|
hueAttempt = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/time", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/time", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
handleSettingsSet(5);
|
handleSettingsSet(request, 5);
|
||||||
serveMessage(200,"Time settings saved.","Redirecting...",1);
|
serveMessage(request, 200,"Time settings saved.","Redirecting...",1);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/settings/sec", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings/sec", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
handleSettingsSet(6);
|
handleSettingsSet(request, 6);
|
||||||
serveMessage(200,"Security settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139);
|
serveMessage(request, 200,"Security settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139);
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/json", HTTP_ANY, [](AsyncWebServerRequest *request){
|
/*server.on("/json", HTTP_ANY, [](AsyncWebServerRequest *request){
|
||||||
server->send(500, "application/json", "{\"error\":\"Not implemented\"}");
|
request->send(500, "application/json", "{\"error\":\"Not implemented\"}");
|
||||||
|
});*/
|
||||||
|
|
||||||
|
server.on("/json/effects", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
request->send_P(200, "application/json", JSON_mode_names);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/json/effects", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/json/palettes", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
server->setContentLength(strlen_P(JSON_mode_names));
|
request->send_P(200, "application/json", JSON_palette_names);
|
||||||
server->send(200, "application/json", "");
|
|
||||||
server->sendContent_P(JSON_mode_names);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/json/palettes", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
server->setContentLength(strlen_P(JSON_palette_names));
|
|
||||||
server->send(200, "application/json", "");
|
|
||||||
server->sendContent_P(JSON_palette_names);
|
|
||||||
});
|
|
||||||
|
|
||||||
server->on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
request->send(200, "text/plain", (String)VERSION);
|
request->send(200, "text/plain", (String)VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", (String)millis());
|
request->send(200, "text/plain", (String)millis());
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/power", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/power", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
String val = "";
|
String val = "";
|
||||||
if (strip.currentMilliamps == 0)
|
if (strip.currentMilliamps == 0)
|
||||||
{
|
{
|
||||||
@ -129,112 +104,98 @@ void initServer()
|
|||||||
val += (String)strip.currentMilliamps;
|
val += (String)strip.currentMilliamps;
|
||||||
val += "mA currently";
|
val += "mA currently";
|
||||||
}
|
}
|
||||||
serveMessage(200, val, "This is just an estimate (does not account for factors like wire resistance). It is NOT a measurement!", 254);
|
serveMessage(request, 200, val, "This is just an estimate (does not account for factors like wire resistance). It is NOT a measurement!", 254);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
server->setContentLength(strlen_P(PAGE_usermod));
|
request->send_P(200, "text/html", PAGE_usermod);
|
||||||
server->send(200, "text/html", "");
|
|
||||||
server->sendContent_P(PAGE_usermod);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/teapot", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/teapot", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(418, "418. I'm a teapot.", "(Tangible Embedded Advanced Project Of Twinkling)", 254);
|
serveMessage(request, 418, "418. I'm a teapot.", "(Tangible Embedded Advanced Project Of Twinkling)", 254);
|
||||||
});
|
});
|
||||||
|
|
||||||
server->on("/build", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/build", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
getBuildInfo();
|
getBuildInfo();
|
||||||
request->send(200, "text/plain", obuf);
|
request->send(200, "text/plain", obuf);
|
||||||
});
|
});
|
||||||
|
|
||||||
//if OTA is allowed
|
//if OTA is allowed
|
||||||
if (!otaLock){
|
if (!otaLock){
|
||||||
server->on("/edit", HTTP_GET, [](){
|
server.on("/edit", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
server->send(200, "text/html", PAGE_edit);
|
request->send(200, "text/html", PAGE_edit);
|
||||||
});
|
});
|
||||||
#ifdef USEFS
|
#ifdef USEFS
|
||||||
server->on("/edit", HTTP_PUT, handleFileCreate);
|
server.on("/edit", HTTP_PUT, handleFileCreate);
|
||||||
server->on("/edit", HTTP_DELETE, handleFileDelete);
|
server.on("/edit", HTTP_DELETE, handleFileDelete);
|
||||||
server->on("/edit", HTTP_POST, [](){ server->send(200, "text/plain", ""); }, handleFileUpload);
|
server.on("/edit", HTTP_POST, [](){ server->send(200, "text/plain", ""); }, handleFileUpload);
|
||||||
server->on("/list", HTTP_GET, handleFileList);
|
server.on("/list", HTTP_GET, handleFileList);
|
||||||
#endif
|
#endif
|
||||||
//init ota page
|
//init ota page
|
||||||
#ifndef WLED_DISABLE_OTA
|
#ifndef WLED_DISABLE_OTA
|
||||||
httpUpdater.setup(&server);
|
//httpUpdater.setup(&server);
|
||||||
#else
|
#else
|
||||||
server->on("/update", HTTP_GET, [](){
|
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(500, "Not implemented", "OTA updates are unsupported in this build.", 254);
|
serveMessage(request, 500, "Not implemented", "OTA updates are unsupported in this build.", 254);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
server->on("/edit", HTTP_GET, [](){
|
server.on("/edit", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(500, "Access Denied", txd, 254);
|
serveMessage(request, 500, "Access Denied", txd, 254);
|
||||||
});
|
});
|
||||||
server->on("/update", HTTP_GET, [](){
|
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(500, "Access Denied", txd, 254);
|
serveMessage(request, 500, "Access Denied", txd, 254);
|
||||||
});
|
});
|
||||||
server->on("/list", HTTP_GET, [](){
|
server.on("/list", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(500, "Access Denied", txd, 254);
|
serveMessage(request, 500, "Access Denied", txd, 254);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//this ceased working somehow
|
//this ceased working somehow
|
||||||
/*server->on("/", HTTP_GET, [](){
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveIndexOrWelcome();
|
serveIndexOrWelcome(request);
|
||||||
});*/
|
});
|
||||||
|
|
||||||
//called when the url is not defined here, ajax-in; get-settings
|
//called when the url is not defined here, ajax-in; get-settings
|
||||||
server->onNotFound([](){
|
server.onNotFound([](AsyncWebServerRequest *request){
|
||||||
DEBUG_PRINTLN("Not-Found HTTP call:");
|
DEBUG_PRINTLN("Not-Found HTTP call:");
|
||||||
DEBUG_PRINTLN("URI: " + server->uri());
|
DEBUG_PRINTLN("URI: " + server->uri());
|
||||||
DEBUG_PRINTLN("Body: " + server->arg(0));
|
DEBUG_PRINTLN("Body: " + server->arg(0));
|
||||||
|
|
||||||
//make API CORS compatible
|
//make API CORS compatible
|
||||||
if (server->method() == HTTP_OPTIONS)
|
if (request->method() == HTTP_OPTIONS)
|
||||||
{
|
{
|
||||||
server->sendHeader("Access-Control-Allow-Origin", "*");
|
request->send(200); return;
|
||||||
server->sendHeader("Access-Control-Max-Age", "10000");
|
|
||||||
server->sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS");
|
|
||||||
server->sendHeader("Access-Control-Allow-Headers", "*");
|
|
||||||
server->send(200);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//workaround for subpage issue
|
//workaround for subpage issue
|
||||||
if (server->uri().length() == 1)
|
/*if (request->url().length() == 1)
|
||||||
{
|
{
|
||||||
serveIndexOrWelcome();
|
serveIndexOrWelcome(request);
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(!handleSet(server->uri())){
|
if(!handleSet(request, request->url())){
|
||||||
#ifndef WLED_DISABLE_ALEXA
|
#ifndef WLED_DISABLE_ALEXA
|
||||||
if(!espalexa.handleAlexaApiCall(server->uri(),server->arg(0)))
|
if(!espalexa.handleAlexaApiCall(request))
|
||||||
#endif
|
#endif
|
||||||
server->send(404, "text/plain", "Not Found");
|
request->send(404, "text/plain", "Not Found");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifndef ARDUINO_ARCH_ESP32
|
|
||||||
const char * headerkeys[] = {"User-Agent"};
|
|
||||||
server->collectHeaders(headerkeys,sizeof(headerkeys)/sizeof(char*));
|
|
||||||
#else
|
|
||||||
String ua = "User-Agent";
|
|
||||||
server->collectHeaders(ua);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void serveIndexOrWelcome()
|
void serveIndexOrWelcome(AsyncWebServerRequest *request)
|
||||||
{
|
{
|
||||||
if (!showWelcomePage){
|
if (!showWelcomePage){
|
||||||
serveIndex();
|
serveIndex(request);
|
||||||
}else{
|
} else {
|
||||||
serveSettings(255);
|
serveSettings(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void serveRealtimeError(bool settings)
|
void serveRealtimeError(AsyncWebServerRequest *request, bool settings)
|
||||||
{
|
{
|
||||||
String mesg = "The ";
|
String mesg = "The ";
|
||||||
mesg += (settings)?"settings":"WLED";
|
mesg += (settings)?"settings":"WLED";
|
||||||
@ -252,7 +213,7 @@ void serveRealtimeError(bool settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mesg += ").";
|
mesg += ").";
|
||||||
server->send(200, "text/plain", mesg);
|
request->send(200, "text/plain", mesg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -271,123 +232,126 @@ void getCSSColors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void serveIndex()
|
void serveIndex(AsyncWebServerRequest* request)
|
||||||
{
|
{
|
||||||
bool serveMobile = false;
|
|
||||||
if (uiConfiguration == 0) serveMobile = checkClientIsMobile(server->header("User-Agent"));
|
|
||||||
else if (uiConfiguration == 2) serveMobile = true;
|
|
||||||
|
|
||||||
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
|
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
|
||||||
{
|
{
|
||||||
serveRealtimeError(false);
|
serveRealtimeError(request, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool serveMobile = false;
|
||||||
|
if (uiConfiguration == 0 && request->hasHeader("User-Agent")) serveMobile = checkClientIsMobile(request->getHeader("User-Agent")->value());
|
||||||
|
else if (uiConfiguration == 2) serveMobile = true;
|
||||||
|
|
||||||
|
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html",
|
||||||
|
(serveMobile) ? PAGE_indexM : PAGE_index,
|
||||||
|
(serveMobile) ? PAGE_indexM_L : PAGE_index_L);
|
||||||
|
|
||||||
//error message is not gzipped
|
//error message is not gzipped
|
||||||
#ifdef WLED_DISABLE_MOBILE_UI
|
#ifdef WLED_DISABLE_MOBILE_UI
|
||||||
if (!serveMobile) server->sendHeader("Content-Encoding","gzip");
|
if (!serveMobile) response->addHeader("Content-Encoding","gzip");
|
||||||
#else
|
#else
|
||||||
server->sendHeader("Content-Encoding","gzip");
|
response->addHeader("Content-Encoding","gzip");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
server->send_P(200, "text/html",
|
request->send(response);
|
||||||
(serveMobile) ? PAGE_indexM : PAGE_index0,
|
|
||||||
(serveMobile) ? PAGE_indexM_L : PAGE_index0_L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void serveMessage(int code, String headl, String subl="", int optionType)
|
String msgProcessor(const String& var)
|
||||||
|
{
|
||||||
|
if (var == "CSS") return String(obuf);
|
||||||
|
if (var == "MSG") {
|
||||||
|
String messageBody = "";
|
||||||
|
messageBody += messageHead;
|
||||||
|
messageBody += "</h2>";
|
||||||
|
messageBody += messageSub;
|
||||||
|
|
||||||
|
if (optionType < 60) //redirect to settings after optionType seconds
|
||||||
|
{
|
||||||
|
messageBody += "<script>setTimeout(RS," + String(optionType*1000) + ")</script>";
|
||||||
|
} else if (optionType < 120) //redirect back after optionType-60 seconds
|
||||||
|
{
|
||||||
|
messageBody += "<script>setTimeout(B," + String((optionType-60)*1000) + ")</script>";
|
||||||
|
} else if (optionType < 180) //reload parent after optionType-120 seconds
|
||||||
|
{
|
||||||
|
messageBody += "<script>setTimeout(RP," + String((optionType-120)*1000) + ")</script>";
|
||||||
|
} else if (optionType == 253)
|
||||||
|
{
|
||||||
|
messageBody += "<br><br><form action=/settings><button type=submit>Back</button></form>"; //button to settings
|
||||||
|
} else if (optionType == 254)
|
||||||
|
{
|
||||||
|
messageBody += "<br><br><button type=\"button\" onclick=\"B()\">Back</button>";
|
||||||
|
}
|
||||||
|
return messageBody;
|
||||||
|
}
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void serveMessage(AsyncWebServerRequest* request, uint16_t code, String headl, String subl="", uint32_t optionT=255)
|
||||||
{
|
{
|
||||||
olen = 0;
|
olen = 0;
|
||||||
getCSSColors();
|
getCSSColors();
|
||||||
|
messageHead = headl;
|
||||||
|
messageSub = subl;
|
||||||
|
optionType = optionT;
|
||||||
|
|
||||||
String messageBody = "<h2>";
|
request->send_P(code, "text/html", PAGE_msg, msgProcessor);
|
||||||
messageBody += headl;
|
|
||||||
messageBody += "</h2>";
|
|
||||||
messageBody += subl;
|
|
||||||
switch(optionType)
|
|
||||||
{
|
|
||||||
case 255: break; //simple message
|
|
||||||
case 254: messageBody += "<br><br><button type=\"button\" onclick=\"B()\">Back</button>"; break; //back button
|
|
||||||
case 253: messageBody += "<br><br><form action=/settings><button type=submit>Back</button></form>"; //button to settings
|
|
||||||
}
|
|
||||||
if (optionType < 60) //redirect to settings after optionType seconds
|
|
||||||
{
|
|
||||||
messageBody += "<script>setTimeout(RS," + String(optionType*1000) + ")</script>";
|
|
||||||
} else if (optionType < 120) //redirect back after optionType-60 seconds
|
|
||||||
{
|
|
||||||
messageBody += "<script>setTimeout(B," + String((optionType-60)*1000) + ")</script>";
|
|
||||||
} else if (optionType < 180) //reload parent after optionType-120 seconds
|
|
||||||
{
|
|
||||||
messageBody += "<script>setTimeout(RP," + String((optionType-120)*1000) + ")</script>";
|
|
||||||
}
|
|
||||||
messageBody += "</body></html>";
|
|
||||||
server->setContentLength(strlen_P(PAGE_msg0) + olen + strlen_P(PAGE_msg1) + messageBody.length());
|
|
||||||
server->send(code, "text/html", "");
|
|
||||||
server->sendContent_P(PAGE_msg0);
|
|
||||||
server->sendContent(obuf);
|
|
||||||
server->sendContent_P(PAGE_msg1);
|
|
||||||
server->sendContent(messageBody);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void serveSettings(byte subPage)
|
String settingsProcessor(const String& var)
|
||||||
{
|
{
|
||||||
|
if (var == "CSS") return String(obuf);
|
||||||
|
if (var == "SCSS") return String(PAGE_settingsCss);
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void serveSettings(AsyncWebServerRequest* request)
|
||||||
|
{
|
||||||
|
byte subPage = 0;
|
||||||
|
String url = request->url();
|
||||||
|
if (url.indexOf("sett") >= 0)
|
||||||
|
{
|
||||||
|
if (url.indexOf("wifi") > 0) subPage = 1;
|
||||||
|
else if (url.indexOf("leds") > 0) subPage = 2;
|
||||||
|
else if (url.indexOf("ui") > 0) subPage = 3;
|
||||||
|
else if (url.indexOf("sync") > 0) subPage = 4;
|
||||||
|
else if (url.indexOf("time") > 0) subPage = 5;
|
||||||
|
else if (url.indexOf("sec") > 0) subPage = 6;
|
||||||
|
} else subPage = 255; //welcome page
|
||||||
|
|
||||||
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
|
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
|
||||||
{
|
{
|
||||||
serveRealtimeError(true);
|
serveRealtimeError(request, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_DISABLE_MOBILE_UI //disable welcome page if not enough storage
|
if (subPage == 1 && wifiLock && otaLock)
|
||||||
if (subPage == 255) {serveIndex(); return;}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int pl0, pl1;
|
|
||||||
switch (subPage) //0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec 255: welcomepage
|
|
||||||
{
|
{
|
||||||
case 1: pl0 = strlen_P(PAGE_settings_wifi0); pl1 = strlen_P(PAGE_settings_wifi1); break;
|
serveMessage(request, 500, "Access Denied", txd, 254); return;
|
||||||
case 2: pl0 = strlen_P(PAGE_settings_leds0); pl1 = strlen_P(PAGE_settings_leds1); break;
|
|
||||||
case 3: pl0 = strlen_P(PAGE_settings_ui0); pl1 = strlen_P(PAGE_settings_ui1); break;
|
|
||||||
case 4: pl0 = strlen_P(PAGE_settings_sync0); pl1 = strlen_P(PAGE_settings_sync1); break;
|
|
||||||
case 5: pl0 = strlen_P(PAGE_settings_time0); pl1 = strlen_P(PAGE_settings_time1); break;
|
|
||||||
case 6: pl0 = strlen_P(PAGE_settings_sec0); pl1 = strlen_P(PAGE_settings_sec1); break;
|
|
||||||
case 255: pl0 = strlen_P(PAGE_welcome0); pl1 = strlen_P(PAGE_welcome1); break;
|
|
||||||
default: pl0 = strlen_P(PAGE_settings0); pl1 = strlen_P(PAGE_settings1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t sCssLength = (subPage >0 && subPage <7)?strlen_P(PAGE_settingsCss):0;
|
#ifdef WLED_DISABLE_MOBILE_UI //disable welcome page if not enough storage
|
||||||
|
if (subPage == 255) {serveIndex(request); return;}
|
||||||
|
#endif
|
||||||
|
|
||||||
getSettingsJS(subPage);
|
getSettingsJS(subPage);
|
||||||
|
|
||||||
getCSSColors();
|
getCSSColors();
|
||||||
|
|
||||||
server->setContentLength(pl0 + olen + sCssLength + pl1);
|
|
||||||
server->send(200, "text/html", "");
|
|
||||||
|
|
||||||
switch (subPage)
|
switch (subPage)
|
||||||
{
|
{
|
||||||
case 1: server->sendContent_P(PAGE_settings_wifi0); break;
|
case 1: request->send_P(200, "text/html", PAGE_settings_wifi, settingsProcessor); break;
|
||||||
case 2: server->sendContent_P(PAGE_settings_leds0); break;
|
case 2: request->send_P(200, "text/html", PAGE_settings_leds, settingsProcessor); break;
|
||||||
case 3: server->sendContent_P(PAGE_settings_ui0 ); break;
|
case 3: request->send_P(200, "text/html", PAGE_settings_ui , settingsProcessor); break;
|
||||||
case 4: server->sendContent_P(PAGE_settings_sync0); break;
|
case 4: request->send_P(200, "text/html", PAGE_settings_sync, settingsProcessor); break;
|
||||||
case 5: server->sendContent_P(PAGE_settings_time0); break;
|
case 5: request->send_P(200, "text/html", PAGE_settings_time, settingsProcessor); break;
|
||||||
case 6: server->sendContent_P(PAGE_settings_sec0 ); break;
|
case 6: request->send_P(200, "text/html", PAGE_settings_sec , settingsProcessor); break;
|
||||||
case 255: server->sendContent_P(PAGE_welcome0 ); break;
|
case 255: request->send_P(200, "text/html", PAGE_welcome , settingsProcessor); break;
|
||||||
default: server->sendContent_P(PAGE_settings0 );
|
default: request->send_P(200, "text/html", PAGE_settings , settingsProcessor);
|
||||||
}
|
|
||||||
server->sendContent(obuf);
|
|
||||||
|
|
||||||
if (subPage >0 && subPage <7) server->sendContent_P(PAGE_settingsCss);
|
|
||||||
switch (subPage)
|
|
||||||
{
|
|
||||||
case 1: server->sendContent_P(PAGE_settings_wifi1); break;
|
|
||||||
case 2: server->sendContent_P(PAGE_settings_leds1); break;
|
|
||||||
case 3: server->sendContent_P(PAGE_settings_ui1 ); break;
|
|
||||||
case 4: server->sendContent_P(PAGE_settings_sync1); break;
|
|
||||||
case 5: server->sendContent_P(PAGE_settings_time1); break;
|
|
||||||
case 6: server->sendContent_P(PAGE_settings_sec1 ); break;
|
|
||||||
case 255: server->sendContent_P(PAGE_welcome1 ); break;
|
|
||||||
default: server->sendContent_P(PAGE_settings1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user