settings getter/setter/html for fade transition
removed pwrled from settings page
This commit is contained in:
parent
9b786910d8
commit
d01877d32b
1
TODO.txt
1
TODO.txt
@ -15,7 +15,6 @@ svg icons in html
|
||||
notifier function -> send get request
|
||||
nightlight function -> turns off after set time (+implement fading)
|
||||
(replace StrContains and num functions)
|
||||
settings getter/setter/html for fade transition
|
||||
|
||||
BUGS
|
||||
static ip disables mdns
|
||||
|
@ -12,35 +12,36 @@
|
||||
if (this.readyState == 4) {
|
||||
if (this.status == 200) {
|
||||
if (this.responseXML != null) {
|
||||
document.Settings_form.CSSID.value = this.responseXML.getElementsByTagName('cssid')[0].innerHTML;
|
||||
document.Settings_form.CPASS.value = this.responseXML.getElementsByTagName('cpass')[0].innerHTML; //fake pass like ******
|
||||
document.Settings_form.CSIP0.value = this.responseXML.getElementsByTagName('csips')[0].innerHTML;
|
||||
document.Settings_form.CSIP1.value = this.responseXML.getElementsByTagName('csips')[1].innerHTML;
|
||||
document.Settings_form.CSIP2.value = this.responseXML.getElementsByTagName('csips')[2].innerHTML;
|
||||
document.Settings_form.CSIP3.value = this.responseXML.getElementsByTagName('csips')[3].innerHTML;
|
||||
document.Settings_form.CSGW0.value = this.responseXML.getElementsByTagName('csgws')[0].innerHTML;
|
||||
document.Settings_form.CSGW1.value = this.responseXML.getElementsByTagName('csgws')[1].innerHTML;
|
||||
document.Settings_form.CSGW2.value = this.responseXML.getElementsByTagName('csgws')[2].innerHTML;
|
||||
document.Settings_form.CSGW3.value = this.responseXML.getElementsByTagName('csgws')[3].innerHTML;
|
||||
document.Settings_form.CSSN0.value = this.responseXML.getElementsByTagName('cssns')[0].innerHTML;
|
||||
document.Settings_form.CSSN1.value = this.responseXML.getElementsByTagName('cssns')[1].innerHTML;
|
||||
document.Settings_form.CSSN2.value = this.responseXML.getElementsByTagName('cssns')[2].innerHTML;
|
||||
document.Settings_form.CSSN3.value = this.responseXML.getElementsByTagName('cssns')[3].innerHTML;
|
||||
document.Settings_form.CMDNS.value = this.responseXML.getElementsByTagName('cmdns')[0].innerHTML;
|
||||
document.Settings_form.APSSID.value = this.responseXML.getElementsByTagName('apssid')[0].innerHTML;
|
||||
document.Settings_form.APHSSID.checked = (this.responseXML.getElementsByTagName('aphssid')[0].innerHTML)!=0?true:false;
|
||||
document.Settings_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ******
|
||||
document.Settings_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
|
||||
document.Settings_form.LEDS.value = this.responseXML.getElementsByTagName('leds')[0].innerHTML;
|
||||
document.Settings_form.PWRLED.checked = (this.responseXML.getElementsByTagName('pwrled')[0].innerHTML)!=0?true:false;
|
||||
document.Settings_form.BTNP.value = this.responseXML.getElementsByTagName('btnp')[0].innerHTML;
|
||||
document.Settings_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false;
|
||||
document.Settings_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.CSSID.value = this.responseXML.getElementsByTagName('cssid')[0].innerHTML;
|
||||
document.S_form.CPASS.value = this.responseXML.getElementsByTagName('cpass')[0].innerHTML; //fake pass like ******
|
||||
document.S_form.CSIP0.value = this.responseXML.getElementsByTagName('csips')[0].innerHTML;
|
||||
document.S_form.CSIP1.value = this.responseXML.getElementsByTagName('csips')[1].innerHTML;
|
||||
document.S_form.CSIP2.value = this.responseXML.getElementsByTagName('csips')[2].innerHTML;
|
||||
document.S_form.CSIP3.value = this.responseXML.getElementsByTagName('csips')[3].innerHTML;
|
||||
document.S_form.CSGW0.value = this.responseXML.getElementsByTagName('csgws')[0].innerHTML;
|
||||
document.S_form.CSGW1.value = this.responseXML.getElementsByTagName('csgws')[1].innerHTML;
|
||||
document.S_form.CSGW2.value = this.responseXML.getElementsByTagName('csgws')[2].innerHTML;
|
||||
document.S_form.CSGW3.value = this.responseXML.getElementsByTagName('csgws')[3].innerHTML;
|
||||
document.S_form.CSSN0.value = this.responseXML.getElementsByTagName('cssns')[0].innerHTML;
|
||||
document.S_form.CSSN1.value = this.responseXML.getElementsByTagName('cssns')[1].innerHTML;
|
||||
document.S_form.CSSN2.value = this.responseXML.getElementsByTagName('cssns')[2].innerHTML;
|
||||
document.S_form.CSSN3.value = this.responseXML.getElementsByTagName('cssns')[3].innerHTML;
|
||||
document.S_form.CMDNS.value = this.responseXML.getElementsByTagName('cmdns')[0].innerHTML;
|
||||
document.S_form.APSSID.value = this.responseXML.getElementsByTagName('apssid')[0].innerHTML;
|
||||
document.S_form.APHSSID.checked = (this.responseXML.getElementsByTagName('aphssid')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ******
|
||||
document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
|
||||
document.S_form.LEDS.value = this.responseXML.getElementsByTagName('leds')[0].innerHTML;
|
||||
document.S_form.BTNP.value = this.responseXML.getElementsByTagName('btnp')[0].innerHTML;
|
||||
document.S_form.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML;
|
||||
document.S_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false;
|
||||
document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].innerHTML;
|
||||
document.getElementsByClassName("sip")[1].innerHTML = this.responseXML.getElementsByTagName('sip')[1].innerHTML;
|
||||
document.getElementsByClassName("otastat")[0].innerHTML = this.responseXML.getElementsByTagName('otastat')[0].innerHTML;
|
||||
document.getElementsByClassName("msg")[0].innerHTML = this.responseXML.getElementsByTagName('msg')[0].innerHTML;
|
||||
if (Settings_form.NOOTA.checked) {document.Settings_form.NOOTA.disabled="disabled";}
|
||||
if (S_form.NOOTA.checked) {document.S_form.NOOTA.disabled="disabled";}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,7 +63,7 @@
|
||||
</head>
|
||||
<body onload="GetCurrent()" class=" __plain_text_READY__">
|
||||
<h1>WLED Settings</h1>
|
||||
<form id="form_s" name="Settings_form" action="set-settings" method="post">
|
||||
<form id="form_s" name="S_form" action="set-settings" method="post">
|
||||
<input type="submit" name="SUBM" value="Save">
|
||||
<input type="button" name="BACK" value="Back" onclick="OpenMain()">
|
||||
<h2>WiFi setup</h2>
|
||||
@ -98,14 +99,12 @@
|
||||
<h3>LED setup</h3>
|
||||
The default boot LED color is the current color when settings are saved. <br>
|
||||
LED amount: <input type="text" name="LEDS" maxlength="3" size="2"> <br>
|
||||
Disable Power LED: <input type="checkbox" name="PWRLED" value="0"> <br>
|
||||
<h3>Button setup</h3>
|
||||
Button pin: <input type="text" name="BTNP" maxlength="2" size="2"> <br>
|
||||
Button function: Toggle on/off <br>
|
||||
<h3>Toolbar</h3>
|
||||
<i>Not implemented</i> <br>
|
||||
<h3>Animations</h3>
|
||||
<i>Not implemented</i> <br>
|
||||
<h3>Transitions</h3>
|
||||
Fade: <input type="checkbox" name="TFADE" value="0"> <br>
|
||||
Transition Delay: <input type="text" name="TDLAY" maxlength="5" size="2"> ms <br>
|
||||
<h3>Daisy chain</h3>
|
||||
<i>Not implemented</i> <br>
|
||||
<h3>Security</h3>
|
||||
|
@ -28,7 +28,7 @@ IPAddress staticsubnet(255, 255, 255, 0);
|
||||
byte col[]{255, 127, 0};
|
||||
boolean fadeTransition = true;
|
||||
boolean seqTransition = false;
|
||||
int transitionDelay = 1500;
|
||||
uint16_t transitionDelay = 1500;
|
||||
boolean ota_lock = false;
|
||||
boolean only_ap = false;
|
||||
int led_amount = 16;
|
||||
@ -122,7 +122,9 @@ void saveSettingsToEEPROM()
|
||||
EEPROM.write(247, col[1]);
|
||||
EEPROM.write(248, col[2]);
|
||||
EEPROM.write(249, bri);
|
||||
|
||||
EEPROM.write(251, fadeTransition);
|
||||
EEPROM.write(253, (transitionDelay >> 0) & 0xFF);
|
||||
EEPROM.write(254, (transitionDelay >> 8) & 0xFF);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
@ -184,6 +186,14 @@ void loadSettingsFromEEPROM()
|
||||
col[1] = EEPROM.read(247);
|
||||
col[2] = EEPROM.read(248);
|
||||
bri = EEPROM.read(249);
|
||||
fadeTransition = EEPROM.read(251);
|
||||
transitionDelay = ((EEPROM.read(253) << 0) & 0xFF) + ((EEPROM.read(254) << 8) & 0xFF00);
|
||||
}
|
||||
|
||||
uint8_t bool2int(boolean value)
|
||||
{
|
||||
if (value) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void XML_response()
|
||||
@ -260,9 +270,12 @@ void XML_response_settings()
|
||||
resp = resp + "<leds>";
|
||||
resp = resp + led_amount;
|
||||
resp = resp + "</leds>";
|
||||
resp = resp + "<pwrled>0</pwrled>";
|
||||
resp = resp + "<btnp>0</btnp>"; //NI
|
||||
resp = resp + "<noota>0</noota>"; //NI
|
||||
resp = resp + "<tfade>";
|
||||
resp = resp + bool2int(fadeTransition);
|
||||
resp = resp + "</tfade><tdlay>";
|
||||
resp = resp + transitionDelay;
|
||||
resp = resp + "</tdlay><noota>0</noota>"; //NI
|
||||
resp = resp + "<norap>0</norap>"; //NI
|
||||
resp = resp + "<sip>";
|
||||
if (!WiFi.localIP()[0] == 0)
|
||||
@ -278,8 +291,7 @@ void XML_response_settings()
|
||||
{
|
||||
resp = resp + "Not connected";
|
||||
}
|
||||
resp = resp + "</sip>";
|
||||
resp = resp + "<sip>";
|
||||
resp = resp + "</sip><sip>";
|
||||
if (!WiFi.softAPIP()[0] == 0)
|
||||
{
|
||||
resp = resp + WiFi.softAPIP()[0];
|
||||
@ -293,8 +305,7 @@ void XML_response_settings()
|
||||
{
|
||||
resp = resp + "Not active";
|
||||
}
|
||||
resp = resp + "</sip>";
|
||||
resp = resp + "<otastat>Not implemented</otastat>";
|
||||
resp = resp + "</sip><otastat>Not implemented</otastat>";
|
||||
resp = resp + "<msg>WLED 0.3pd OK</msg>";
|
||||
resp = resp + "</vs>";
|
||||
Serial.println(resp);
|
||||
@ -438,6 +449,17 @@ void handleSettingsSet()
|
||||
int i = server.arg("CSSN3").toInt();
|
||||
if (i >= 0 && i <= 255) staticsubnet[3] = i;
|
||||
}
|
||||
if (server.hasArg("LEDS"))
|
||||
{
|
||||
int i = server.arg("LEDS").toInt();
|
||||
if (i > 0) led_amount = i;
|
||||
}
|
||||
fadeTransition = server.hasArg("TFADE");
|
||||
if (server.hasArg("TDLAY"))
|
||||
{
|
||||
int i = server.arg("TDLAY").toInt();
|
||||
if (i > 0) transitionDelay = i;
|
||||
}
|
||||
saveSettingsToEEPROM();
|
||||
}
|
||||
|
||||
@ -476,7 +498,6 @@ boolean handleSet(String req)
|
||||
return true;
|
||||
}
|
||||
|
||||
//format bytes
|
||||
String formatBytes(size_t bytes){
|
||||
if (bytes < 1024){
|
||||
return String(bytes)+"B";
|
||||
|
Loading…
Reference in New Issue
Block a user