Significantly altered settings page logic to improve network and memory payloads
Added setting to entirely disable recovery AP (if OTA is enabled) Added setting to specify time to try connecting before opening AP
This commit is contained in:
parent
a33386c672
commit
a4cf0e0e2e
@ -1548,6 +1548,10 @@ void WS2812FX::mode_circus_combustus(void) {
|
||||
_mode_delay = 100 + ((100 * (uint32_t)(SPEED_MAX - _speed)) / _led_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//WLED specific methods
|
||||
|
||||
void WS2812FX::setIndividual(int i)
|
||||
{
|
||||
if (i >= 0 && i < _led_count)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define RGBW
|
||||
//#define RGBW
|
||||
|
||||
/*
|
||||
WS2812FX.h - Library for WS2812 LED effects.
|
||||
|
File diff suppressed because one or more lines are too long
@ -6,77 +6,10 @@
|
||||
<script>
|
||||
function GetCurrent()
|
||||
{
|
||||
var request = new XMLHttpRequest();
|
||||
request.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == 4) {
|
||||
if (this.status == 200) {
|
||||
if (this.responseXML != null) {
|
||||
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
|
||||
document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
|
||||
document.S_form.DESC.value = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
|
||||
document.S_form.COLMD.checked = (this.responseXML.getElementsByTagName('colmd')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.LEDCN.value = this.responseXML.getElementsByTagName('ledcn')[0].innerHTML;
|
||||
document.S_form.CLDFR.value = this.responseXML.getElementsByTagName('cldef')[0].innerHTML;
|
||||
document.S_form.CLDFG.value = this.responseXML.getElementsByTagName('cldef')[1].innerHTML;
|
||||
document.S_form.CLDFB.value = this.responseXML.getElementsByTagName('cldef')[2].innerHTML;
|
||||
document.S_form.CLDFA.value = this.responseXML.getElementsByTagName('cldfa')[0].innerHTML;
|
||||
document.S_form.CLDFW.value = this.responseXML.getElementsByTagName('cldfw')[0].innerHTML;
|
||||
document.S_form.FXDEF.value = this.responseXML.getElementsByTagName('fxdef')[0].innerHTML;
|
||||
document.S_form.SXDEF.value = this.responseXML.getElementsByTagName('sxdef')[0].innerHTML;
|
||||
document.S_form.BOOTN.checked = (this.responseXML.getElementsByTagName('bootn')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.GCBRI.checked = (this.responseXML.getElementsByTagName('gcbri')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.GCRGB.checked = (this.responseXML.getElementsByTagName('gcrgb')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.BTNON.checked = (this.responseXML.getElementsByTagName('btnon')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.TSWEE.checked = (this.responseXML.getElementsByTagName('tswee')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.TSDIR.checked = (this.responseXML.getElementsByTagName('tsdir')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML;
|
||||
document.S_form.TLBRI.value = this.responseXML.getElementsByTagName('tlbri')[0].innerHTML;
|
||||
document.S_form.TLDUR.value = this.responseXML.getElementsByTagName('tldur')[0].innerHTML;
|
||||
document.S_form.TLFDE.checked = (this.responseXML.getElementsByTagName('tlfde')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.NUDPP.value = this.responseXML.getElementsByTagName('nudpp')[0].innerHTML;
|
||||
document.S_form.NRCVE.checked = (this.responseXML.getElementsByTagName('nrcve')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.NRBRI.value = this.responseXML.getElementsByTagName('nrbri')[0].innerHTML;
|
||||
document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.NSBTN.checked = (this.responseXML.getElementsByTagName('nsbtn')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.ALEXA.checked = (this.responseXML.getElementsByTagName('alexa')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.AINVN.value = this.responseXML.getElementsByTagName('ainvn')[0].innerHTML;
|
||||
document.S_form.NSALX.checked = (this.responseXML.getElementsByTagName('nsalx')[0].innerHTML)!=0?true:false;
|
||||
document.S_form.NTPON.checked = (this.responseXML.getElementsByTagName('ntpon')[0].innerHTML)!=0?true:false;
|
||||
document.getElementsByClassName("times")[0].innerHTML = this.responseXML.getElementsByTagName('times')[0].innerHTML;
|
||||
document.S_form.OLDEF.value = this.responseXML.getElementsByTagName('oldef')[0].innerHTML;
|
||||
document.S_form.WOFFS.value = this.responseXML.getElementsByTagName('woffs')[0].innerHTML;
|
||||
document.S_form.WOFFN.checked = (this.responseXML.getElementsByTagName('woffn')[0].innerHTML)!=0?true:false;
|
||||
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("msg")[0].innerHTML = this.responseXML.getElementsByTagName('msg')[0].innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// send HTTP request
|
||||
request.open("GET", "/get-settings", true);
|
||||
request.send(null);
|
||||
var d = document;
|
||||
//values injected by server while sending HTML
|
||||
d.Sf.CSSID.value = "DONT put settings.htm in SPIFFS!";
|
||||
d.getElementsByClassName("msg")[0].innerHTML = "Response Error";
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@ -87,7 +20,7 @@
|
||||
</head>
|
||||
<body onload="GetCurrent()" class=" __plain_text_READY__">
|
||||
<h1 style="text-align:center">WLED Settings</h1>
|
||||
<form id="form_s" name="S_form" action="set-settings" method="post">
|
||||
<form id="form_s" name="Sf" action="set-settings" method="post">
|
||||
<div align="center"><input type="submit" name="SUBM" value="Save"></div>
|
||||
<hr>
|
||||
<h2>WiFi setup</h2>
|
||||
@ -111,6 +44,7 @@
|
||||
<input name="CSSN3" maxlength="3" size="2"> <br>
|
||||
mDNS address (leave empty for no mDNS): <br/>
|
||||
http:// <input name="CMDNS" maxlength="32"> .local <br>
|
||||
Try connecting before opening AP for: <input name="APWTM" maxlength="3" size="2"> s <br>
|
||||
Client IP: <span class="sip"> Not connected </span> <br>
|
||||
<h3>Configure Access Point</h3>
|
||||
AP SSID (leave empty for no AP): <br> <input name="APSSID" maxlength="32"> <br>
|
||||
@ -170,9 +104,10 @@
|
||||
To enable OTA, for security reasons you need to also enter the correct password! <br>
|
||||
The password may/should be changed when OTA is enabled. <br>
|
||||
Disable OTA when not in use, otherwise an attacker could reflash device software! <br> <br>
|
||||
Disable recovery AP (<i>Not implemented</i>): <input type="checkbox" name="NORAP"> <br>
|
||||
Disable recovery AP: <input type="checkbox" name="NORAP"> <br>
|
||||
In case of a connection error there will be no wireless recovery possible! <br>
|
||||
Completely disables all Access Point functions. <br> <br>
|
||||
Completely disables all Access Point functions. <br>
|
||||
Setting only changable if OTA is enabled! <br><br>
|
||||
Factory reset: <input type="checkbox" name="RESET"> <br>
|
||||
All EEPROM content (settings) will be erased. <br> <br>
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -20,7 +20,7 @@
|
||||
#include "CallbackFunction.h"
|
||||
|
||||
//version in format yymmddb (b = daily build)
|
||||
#define VERSION 1711191
|
||||
#define VERSION 1711200
|
||||
|
||||
//If you have an RGBW strip, uncomment first line in WS2812FX.h!
|
||||
|
||||
@ -79,7 +79,8 @@ String cmdns = "led";
|
||||
String apssid = "WLED-AP";
|
||||
uint8_t apchannel = 1;
|
||||
uint8_t aphide = 0;
|
||||
boolean useap = true;
|
||||
uint8_t apWaitTimeSecs = 32;
|
||||
boolean recoveryAPDisabled = false;
|
||||
IPAddress staticip(0, 0, 0, 0);
|
||||
IPAddress staticgateway(0, 0, 0, 0);
|
||||
IPAddress staticsubnet(255, 255, 255, 0);
|
||||
@ -93,8 +94,8 @@ uint8_t bri_nl = 0, bri_nls;
|
||||
boolean fadeTransition = true;
|
||||
boolean sweepTransition = false; boolean sweepDirection = true;
|
||||
uint16_t transitionDelay = 1200;
|
||||
boolean ota_lock = true;
|
||||
boolean only_ap = false;
|
||||
boolean otaLock = true;
|
||||
boolean onlyAP = false;
|
||||
boolean buttonEnabled = true;
|
||||
boolean notifyDirect = true, notifyButton = true, notifyDirectDefault = true;
|
||||
boolean receiveNotifications = true, receiveNotificationsDefault = true;
|
||||
@ -178,7 +179,7 @@ uint8_t auxTime = 0;
|
||||
unsigned long auxStartTime;
|
||||
boolean auxActive, auxActiveBefore;
|
||||
|
||||
boolean useGammaCorrectionBri = true;
|
||||
boolean useGammaCorrectionBri = false;
|
||||
boolean useGammaCorrectionRGB = true;
|
||||
int arlsOffset = -22; //10: -22 assuming arls52
|
||||
boolean realtimeEnabled = true;
|
||||
|
@ -75,7 +75,7 @@ void saveSettingsToEEPROM()
|
||||
EEPROM.write(i, otapass.charAt(i-256));
|
||||
}
|
||||
EEPROM.write(288, bri_nl);
|
||||
EEPROM.write(289, ota_lock);
|
||||
EEPROM.write(289, otaLock);
|
||||
EEPROM.write(290, (udpPort >> 0) & 0xFF);
|
||||
EEPROM.write(291, (udpPort >> 8) & 0xFF);
|
||||
for (int i = 292; i < 324; ++i)
|
||||
@ -105,6 +105,8 @@ void saveSettingsToEEPROM()
|
||||
EEPROM.write(372, useRGBW);
|
||||
EEPROM.write(373, sweepTransition);
|
||||
EEPROM.write(374, sweepDirection);
|
||||
EEPROM.write(375, apWaitTimeSecs);
|
||||
EEPROM.write(376, recoveryAPDisabled);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
@ -189,7 +191,7 @@ void loadSettingsFromEEPROM()
|
||||
otapass += char(EEPROM.read(i));
|
||||
}
|
||||
bri_nl = EEPROM.read(288);
|
||||
ota_lock = EEPROM.read(289);
|
||||
otaLock = EEPROM.read(289);
|
||||
udpPort = ((EEPROM.read(290) << 0) & 0xFF) + ((EEPROM.read(291) << 8) & 0xFF00);
|
||||
serverDescription = "";
|
||||
for (int i = 292; i < 324; ++i)
|
||||
@ -220,5 +222,7 @@ void loadSettingsFromEEPROM()
|
||||
useRGBW = EEPROM.read(372);
|
||||
sweepTransition = EEPROM.read(373);
|
||||
sweepDirection = EEPROM.read(374);
|
||||
apWaitTimeSecs = EEPROM.read(375);
|
||||
recoveryAPDisabled = EEPROM.read(376);
|
||||
useHSB = useHSBDefault;
|
||||
}
|
||||
|
@ -49,186 +49,119 @@ void XML_response()
|
||||
server.send(200, "text/xml", resp);
|
||||
}
|
||||
|
||||
void XML_response_settings()
|
||||
String getSettings()
|
||||
{
|
||||
DEBUG_PRINTLN("XML settings response");
|
||||
String resp;
|
||||
resp = resp + "<?xml version = \"1.0\" ?>";
|
||||
resp = resp + "<vs>";
|
||||
resp = resp + "<cssid>";
|
||||
resp = resp + clientssid;
|
||||
resp = resp + "</cssid>";
|
||||
resp = resp + "<cpass>";
|
||||
DEBUG_PRINTLN("settings resp");
|
||||
|
||||
String resp = "";
|
||||
String ds = "d.Sf.";
|
||||
String dg = "d.getElementsByClassName";
|
||||
String v = ".value=";
|
||||
String c = ".checked=";
|
||||
String ih = ".innerHTML=";
|
||||
|
||||
resp += ds + "CSSID" + v + "\"" + clientssid + "\";";
|
||||
resp += ds + "CPASS" + v + "\"";
|
||||
for (int i = 0; i < clientpass.length(); i++)
|
||||
{
|
||||
resp = resp + "*";
|
||||
resp += "*";
|
||||
}
|
||||
resp = resp + "</cpass>";
|
||||
for (int i = 0; i < 4; i++)
|
||||
resp += "\";";
|
||||
resp += ds + "CSIP0" + v + staticip[0] +";";
|
||||
resp += ds + "CSIP1" + v + staticip[1] +";";
|
||||
resp += ds + "CSIP2" + v + staticip[2] +";";
|
||||
resp += ds + "CSIP3" + v + staticip[3] +";";
|
||||
resp += ds + "CSGW0" + v + staticgateway[0] +";";
|
||||
resp += ds + "CSGW1" + v + staticgateway[1] +";";
|
||||
resp += ds + "CSGW2" + v + staticgateway[2] +";";
|
||||
resp += ds + "CSGW3" + v + staticgateway[3] +";";
|
||||
resp += ds + "CSSN0" + v + staticsubnet[0] +";";
|
||||
resp += ds + "CSSN1" + v + staticsubnet[1] +";";
|
||||
resp += ds + "CSSN2" + v + staticsubnet[2] +";";
|
||||
resp += ds + "CSSN3" + v + staticsubnet[3] +";";
|
||||
resp += ds + "CMDNS" + v + "\"" + cmdns + "\";";
|
||||
resp += ds + "APWTM" + v + apWaitTimeSecs +";";
|
||||
resp += ds + "APSSID" + v + "\"" + apssid + "\";";
|
||||
resp += ds + "APHSSID" + c + aphide + ";";
|
||||
resp += ds + "APPASS" + v + "\"";
|
||||
for (int i = 0; i < clientpass.length(); i++)
|
||||
{
|
||||
resp = resp + "<csips>";
|
||||
resp = resp + staticip[i];
|
||||
resp = resp + "</csips>";
|
||||
resp += "*";
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
resp = resp + "<csgws>";
|
||||
resp = resp + staticgateway[i];
|
||||
resp = resp + "</csgws>";
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
resp = resp + "<cssns>";
|
||||
resp = resp + staticsubnet[i];
|
||||
resp = resp + "</cssns>";
|
||||
}
|
||||
resp = resp + "<cmdns>";
|
||||
resp = resp + cmdns;
|
||||
resp = resp + "</cmdns>";
|
||||
resp = resp + "<apssid>";
|
||||
resp = resp + apssid;
|
||||
resp = resp + "</apssid>";
|
||||
resp = resp + "<aphssid>";
|
||||
resp = resp + aphide;
|
||||
resp = resp + "</aphssid>";
|
||||
resp = resp + "<appass>";
|
||||
for (int i = 0; i < appass.length(); i++)
|
||||
{
|
||||
resp = resp + "*";
|
||||
}
|
||||
resp = resp + "</appass>";
|
||||
resp = resp + "<apchan>";
|
||||
resp = resp + apchannel;
|
||||
resp = resp + "</apchan>";
|
||||
resp = resp + "<desc>";
|
||||
resp = resp + serverDescription;
|
||||
resp = resp + "</desc>";
|
||||
resp = resp + "<colmd>";
|
||||
resp = resp + useHSBDefault;
|
||||
resp = resp + "</colmd>";
|
||||
resp = resp + "<ledcn>";
|
||||
resp = resp + ledcount;
|
||||
resp = resp + "</ledcn>";
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
resp = resp + "<cldef>";
|
||||
resp = resp + col_s[i];
|
||||
resp = resp + "</cldef>";
|
||||
}
|
||||
resp = resp + "<cldfw>";
|
||||
resp += "\";";
|
||||
resp += ds + "APCHAN" + v + apchannel +";";
|
||||
|
||||
resp += ds + "DESC" + v + "\"" + serverDescription + "\";";
|
||||
resp += ds + "COLMD" + c + useHSBDefault + ";";
|
||||
resp += ds + "LEDCN" + v + ledcount +";";
|
||||
resp += ds + "CLDFR" + v + col_s[0] +";";
|
||||
resp += ds + "CLDFG" + v + col_s[1] +";";
|
||||
resp += ds + "CLDFB" + v + col_s[2] +";";
|
||||
resp += ds + "CLDFA" + v + bri_s +";";
|
||||
if (useRGBW) {
|
||||
resp = resp + white_s;
|
||||
} else {
|
||||
resp = resp + "-1";
|
||||
}
|
||||
resp = resp + "</cldfw><cldfa>";
|
||||
resp = resp + bri_s;
|
||||
resp = resp + "</cldfa>";
|
||||
resp = resp + "<bootn>";
|
||||
resp = resp + turnOnAtBoot;
|
||||
resp = resp + "</bootn>";
|
||||
resp = resp + "<fxdef>";
|
||||
resp = resp + effectDefault;
|
||||
resp = resp + "</fxdef>";
|
||||
resp = resp + "<sxdef>";
|
||||
resp = resp + effectSpeedDefault;
|
||||
resp = resp + "</sxdef>";
|
||||
resp = resp + "<gcbri>";
|
||||
resp = resp + useGammaCorrectionBri;
|
||||
resp = resp + "</gcbri><gcrgb>";
|
||||
resp = resp + useGammaCorrectionRGB;
|
||||
resp = resp + "</gcrgb>";
|
||||
resp = resp + "<btnon>";
|
||||
resp = resp + buttonEnabled;
|
||||
resp = resp + "</btnon><tfade>";
|
||||
resp = resp + fadeTransition;
|
||||
resp = resp + "</tfade><tdlay>";
|
||||
resp = resp + transitionDelay;
|
||||
resp = resp + "</tdlay><tswee>";
|
||||
resp = resp + sweepTransition;
|
||||
resp = resp + "</tswee><tsdir>";
|
||||
resp = resp + !sweepDirection;
|
||||
resp = resp + "</tsdir><tlbri>";
|
||||
resp = resp + bri_nl;
|
||||
resp = resp + "</tlbri>";
|
||||
resp = resp + "<tldur>";
|
||||
resp = resp + nightlightDelayMins;
|
||||
resp = resp + "</tldur>";
|
||||
resp = resp + "<tlfde>";
|
||||
resp = resp + nightlightFade;
|
||||
resp = resp + "</tlfde>";
|
||||
resp = resp + "<nudpp>";
|
||||
resp = resp + udpPort;
|
||||
resp = resp + "</nudpp>";
|
||||
resp = resp + "<nrcve>";
|
||||
resp = resp + receiveNotificationsDefault;
|
||||
resp = resp + "</nrcve><nrbri>";
|
||||
resp = resp + bri_n;
|
||||
resp = resp + "</nrbri><nsdir>";
|
||||
resp = resp + notifyDirectDefault;
|
||||
resp = resp + "</nsdir><nsbtn>";
|
||||
resp = resp + notifyButton;
|
||||
resp = resp + "</nsbtn><nsfwd>0</nsfwd>"; //legacy
|
||||
resp = resp + "<ntpon>";
|
||||
resp = resp + ntpEnabled;
|
||||
resp = resp + "</ntpon>";
|
||||
resp = resp + "<alexa>";
|
||||
resp = resp + alexaEnabled;
|
||||
resp = resp + "</alexa><ainvn>";
|
||||
resp = resp + alexaInvocationName;
|
||||
resp = resp + "</ainvn><nsalx>";
|
||||
resp = resp + alexaNotify;
|
||||
resp = resp + "</nsalx>";
|
||||
DEBUG_PRINTLN("pretime");
|
||||
resp = resp + "<times>";
|
||||
resp = resp + getTimeString();
|
||||
resp = resp + "</times>";
|
||||
resp = resp + "<oldef>";
|
||||
resp = resp + overlayDefault;
|
||||
resp = resp + "</oldef>";
|
||||
resp = resp + "<woffs>";
|
||||
resp = resp + abs(arlsOffset);
|
||||
resp = resp + "</woffs>";
|
||||
resp = resp + "<woffn>";
|
||||
resp = resp + !arlsSign;
|
||||
resp = resp + "</woffn>";
|
||||
resp = resp + "<noota>";
|
||||
resp = resp + ota_lock;
|
||||
resp = resp +"</noota>";
|
||||
resp = resp + "<norap>0</norap>"; //NI
|
||||
resp = resp + "<sip>";
|
||||
resp += ds + "CLDFW" + v + white_s +";";
|
||||
} else {
|
||||
resp += ds + "CLDFW" + v + "-1;";
|
||||
}
|
||||
resp += ds + "BOOTN" + c + turnOnAtBoot +";";
|
||||
resp += ds + "FXDEF" + v + effectDefault +";";
|
||||
resp += ds + "FXDEF" + v + effectDefault +";";
|
||||
resp += ds + "GCBRI" + c + useGammaCorrectionBri +";";
|
||||
resp += ds + "GCRGB" + c + useGammaCorrectionRGB +";";
|
||||
resp += ds + "BTNON" + c + buttonEnabled +";";
|
||||
resp += ds + "TFADE" + c + fadeTransition +";";
|
||||
resp += ds + "TSWEE" + c + sweepTransition +";";
|
||||
resp += ds + "TSDIR" + c + !sweepDirection +";";
|
||||
resp += ds + "TDLAY" + v + transitionDelay +";";
|
||||
resp += ds + "TLBRI" + v + bri_nl +";";
|
||||
resp += ds + "TLDUR" + v + nightlightDelayMins +";";
|
||||
resp += ds + "TLFDE" + c + nightlightFade +";";
|
||||
resp += ds + "NUDPP" + v + udpPort +";";
|
||||
resp += ds + "NRBRI" + v + bri_n +";";
|
||||
resp += ds + "NRCVE" + c + receiveNotificationsDefault +";";
|
||||
resp += ds + "NSDIR" + c + notifyDirectDefault +";";
|
||||
resp += ds + "NSBTN" + c + notifyButton +";";
|
||||
resp += ds + "NTPON" + c + ntpEnabled +";";
|
||||
resp += ds + "ALEXA" + c + alexaEnabled +";";
|
||||
resp += ds + "AINVN" + v + "\"" + alexaInvocationName + "\";";
|
||||
resp += ds + "NSALX" + c + alexaNotify +";";
|
||||
resp += dg + "(\"times\")[0]" + ih + "\"" + getTimeString() + "\";";
|
||||
resp += ds + "OLDEF" + v + overlayDefault +";";
|
||||
resp += ds + "WOFFS" + v + abs(arlsOffset) +";";
|
||||
resp += ds + "WOFFN" + c + !arlsSign +";";
|
||||
resp += ds + "NOOTA" + c + otaLock +";";
|
||||
resp += ds + "NORAP" + c + recoveryAPDisabled +";";
|
||||
resp += dg + "(\"sip\")[0]" + ih + "\"";
|
||||
if (!WiFi.localIP()[0] == 0)
|
||||
{
|
||||
resp = resp + WiFi.localIP()[0];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.localIP()[1];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.localIP()[2];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.localIP()[3];
|
||||
resp += WiFi.localIP()[0];
|
||||
resp += + ".";
|
||||
resp += WiFi.localIP()[1];
|
||||
resp += ".";
|
||||
resp += WiFi.localIP()[2];
|
||||
resp += ".";
|
||||
resp += WiFi.localIP()[3];
|
||||
} else
|
||||
{
|
||||
resp = resp + "Not connected";
|
||||
resp += "Not connected";
|
||||
}
|
||||
resp = resp + "</sip><sip>";
|
||||
resp += "\";";
|
||||
resp += dg + "(\"sip\")[1]" + ih + "\"";
|
||||
if (!WiFi.softAPIP()[0] == 0)
|
||||
{
|
||||
resp = resp + WiFi.softAPIP()[0];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.softAPIP()[1];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.softAPIP()[2];
|
||||
resp = resp + ".";
|
||||
resp = resp + WiFi.softAPIP()[3];
|
||||
resp += WiFi.softAPIP()[0];
|
||||
resp += + ".";
|
||||
resp += WiFi.softAPIP()[1];
|
||||
resp += ".";
|
||||
resp += WiFi.softAPIP()[2];
|
||||
resp += ".";
|
||||
resp += WiFi.softAPIP()[3];
|
||||
} else
|
||||
{
|
||||
resp = resp + "Not active";
|
||||
resp += "Not active";
|
||||
}
|
||||
resp = resp + "</sip>";
|
||||
resp = resp + "<msg>WLED 0.4p (build ";
|
||||
resp = resp + VERSION;
|
||||
resp = resp + ") OK</msg>";
|
||||
resp = resp + "</vs>";
|
||||
DEBUG_PRINTLN(resp);
|
||||
server.send(200, "text/xml", resp);
|
||||
resp += "\";";
|
||||
resp += dg + "(\"msg\")[0]" + ih + "\"WLED 0.4p (build " + VERSION + ") OK\";";
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
@ -14,14 +14,13 @@ void handleSettingsSet()
|
||||
}
|
||||
}
|
||||
if (server.hasArg("CMDNS")) cmdns = server.arg("CMDNS");
|
||||
if (server.hasArg("APSSID")) apssid = server.arg("APSSID");
|
||||
if (server.hasArg("APHSSID"))
|
||||
if (server.hasArg("APWTM"))
|
||||
{
|
||||
aphide = 1;
|
||||
} else
|
||||
{
|
||||
aphide = 0;
|
||||
int i = server.arg("APWTM").toInt();
|
||||
if (i >= 0 && i <= 255) apWaitTimeSecs = i;
|
||||
}
|
||||
if (server.hasArg("APSSID")) apssid = server.arg("APSSID");
|
||||
aphide = server.hasArg("APHSSID");
|
||||
if (server.hasArg("APPASS"))
|
||||
{
|
||||
if (!server.arg("APPASS").indexOf('*') == 0) appass = server.arg("APPASS");
|
||||
@ -34,7 +33,7 @@ void handleSettingsSet()
|
||||
if (server.hasArg("RESET")) //might be dangerous in case arg is always sent
|
||||
{
|
||||
clearEEPROM();
|
||||
server.send(200, "text/plain", "Settings erased. Please wait for light to turn back on, then go to main page...");
|
||||
server.send(200, "text/plain", "Settings erased. Rebooting...");
|
||||
reset();
|
||||
}
|
||||
if (server.hasArg("CSIP0"))
|
||||
@ -218,7 +217,7 @@ void handleSettingsSet()
|
||||
}
|
||||
if (server.hasArg("OPASS"))
|
||||
{
|
||||
if (!ota_lock)
|
||||
if (!otaLock)
|
||||
{
|
||||
if (server.arg("OPASS").length() > 0)
|
||||
otapass = server.arg("OPASS");
|
||||
@ -226,11 +225,16 @@ void handleSettingsSet()
|
||||
{
|
||||
if (otapass.equals(server.arg("OPASS")))
|
||||
{
|
||||
ota_lock = false;
|
||||
otaLock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (server.hasArg("NOOTA")) ota_lock = true;
|
||||
if (server.hasArg("NOOTA")) otaLock = true;
|
||||
if (server.hasArg("NORAP")) {
|
||||
if (!otaLock) recoveryAPDisabled = true;
|
||||
} else {
|
||||
recoveryAPDisabled = false;
|
||||
}
|
||||
saveSettingsToEEPROM();
|
||||
}
|
||||
|
||||
@ -238,11 +242,6 @@ boolean handleSet(String req)
|
||||
{
|
||||
boolean effectUpdated = false;
|
||||
if (!(req.indexOf("win") >= 0)) {
|
||||
if (req.indexOf("get-settings") >= 0)
|
||||
{
|
||||
XML_response_settings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int pos = 0;
|
||||
|
@ -55,7 +55,7 @@ void wledInit()
|
||||
DEBUG_PRINTLN(WiFi.localIP());
|
||||
|
||||
// Set up mDNS responder:
|
||||
if (cmdns != NULL && !only_ap && !MDNS.begin(cmdns.c_str())) {
|
||||
if (cmdns != NULL && !onlyAP && !MDNS.begin(cmdns.c_str())) {
|
||||
DEBUG_PRINTLN("Error setting up MDNS responder!");
|
||||
down();
|
||||
}
|
||||
@ -71,7 +71,12 @@ void wledInit()
|
||||
//SERVER INIT
|
||||
//settings page
|
||||
server.on("/settings", HTTP_GET, [](){
|
||||
if(!handleFileRead("/settings.htm")) server.send(200, "text/html", PAGE_settings);
|
||||
String settingsBuffer = getSettings();
|
||||
server.setContentLength(strlen_P(PAGE_settings0) + strlen_P(PAGE_settings1) + settingsBuffer.length());
|
||||
server.send(200, "text/html", "");
|
||||
server.sendContent_P(PAGE_settings0);
|
||||
server.sendContent(settingsBuffer);
|
||||
server.sendContent_P(PAGE_settings1);
|
||||
});
|
||||
server.on("/favicon.ico", HTTP_GET, [](){
|
||||
if(!handleFileRead("/favicon.ico")) server.send(200, "image/x-icon", favicon);
|
||||
@ -80,7 +85,7 @@ void wledInit()
|
||||
if(!handleFileRead("/index.htm")) server.send(200, "text/html", PAGE_index);
|
||||
});
|
||||
server.on("/reset", HTTP_GET, [](){
|
||||
server.send(200, "text/plain", "Rebooting... Please wait a few seconds and refresh page.");
|
||||
server.send(200, "text/plain", "Rebooting...");
|
||||
reset();
|
||||
});
|
||||
server.on("/set-settings", HTTP_POST, [](){
|
||||
@ -96,7 +101,7 @@ void wledInit()
|
||||
server.on("/freeheap", HTTP_GET, [](){
|
||||
server.send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||
});
|
||||
if (!ota_lock){
|
||||
if (!otaLock){
|
||||
server.on("/edit", HTTP_GET, [](){
|
||||
if(!handleFileRead("/edit.htm")) server.send(200, "text/html", PAGE_edit);
|
||||
});
|
||||
@ -168,12 +173,12 @@ void initCon()
|
||||
delay(500);
|
||||
DEBUG_PRINTLN("C_NC");
|
||||
fail_count++;
|
||||
if (fail_count > 32)
|
||||
if (!recoveryAPDisabled && fail_count > apWaitTimeSecs*2)
|
||||
{
|
||||
WiFi.disconnect();
|
||||
DEBUG_PRINTLN("Can't connect to network. Opening AP...");
|
||||
DEBUG_PRINTLN("Can't connect. Opening AP...");
|
||||
String save = apssid;
|
||||
only_ap = true;
|
||||
onlyAP = true;
|
||||
if (apssid.length() <1) apssid = "WLED-AP";
|
||||
initAP();
|
||||
apssid = save;
|
||||
|
Loading…
Reference in New Issue
Block a user