Added setting to not turn on lights at boot

(due to random forced reboots since Alexa integration)
minor text changes
This commit is contained in:
cschwinne 2017-03-07 22:05:18 +01:00
parent 5748423942
commit 678765fc88
8 changed files with 55 additions and 37 deletions

View File

@ -101,6 +101,9 @@ The software now supports audio-reactive-led-strip!
m.append(2);
3. In config.py set your led amount, ESP IP and WLED UDP notifier port. For FPS, a setting between 15-30 is recommended.
4. Run visualization.py! If you have a low amount of LEDS (e.g. 10) try lowering the sigma values in line 129-131.
5. If you have multiple WLED devices, you can sync them all with music.
Use the led count of your largest device and set the IP to X.X.X.255 (UDP broadcast).
You can adjust the position of the amplitude with the WARLS offset setting.
Note that there is currently an issue preventing you from accessing the control web page while the script is running. HTTP requests work.

View File

@ -39,6 +39,7 @@
document.S_form.CLDFA.value = this.responseXML.getElementsByTagName('cldfa')[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;
@ -114,7 +115,7 @@
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>
Hide AP SSID: <input type="checkbox" name="APHSSID" value="0"> <br>
Hide AP SSID: <input type="checkbox" name="APHSSID"> <br>
AP password (leave empty for open): <br> <input type="password" name="APPASS" maxlength="63"> <br>
AP channel: <input name="APCHAN" maxlength="2" size="2"> <br>
AP IP: <span class="sip"> Not active </span> <br>
@ -131,47 +132,48 @@
Default brightness: <input name="CLDFA" maxlength="3" size="2"> (0-255) <br>
Default effect ID: <input name="FXDEF" maxlength="3" size="2"> <br>
Default effect speed: <input name="SXDEF" maxlength="3" size="2"> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR" value="0"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI" value="0"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB" value="0"> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR"> <br>
Turn on after power up/reset: <input type="checkbox" name="BOOTN"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB"> <br>
Brightness factor: <input name="NRBRI" maxlength="3" size="2"> % <br>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BTNON" value="0"> <br>
On/Off button enabled: <input type="checkbox" name="BTNON"> <br>
<h3>Transitions</h3>
Fade: <input type="checkbox" name="TFADE" value="0"> <br>
Fade: <input type="checkbox" name="TFADE"> <br>
Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br>
<h3>Timed light</h3>
Target brightness: <input name="TLBRI" maxlength="3" size="2"> (0-255) <br>
Change after: <input name="TLDUR" maxlength="3" size="2"> min <br>
Fade: <input type="checkbox" name="TLFDE" value="0"> <br>
Fade: <input type="checkbox" name="TLFDE"> <br>
<h3>Daisy chain</h3>
UDP Port: <input name="NUDPP" maxlength="5" size="2"><br>
Receive notifications: <input type="checkbox" name="NRCVE" value="0"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br>
Receive notifications: <input type="checkbox" name="NRCVE"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD"> <br>
<h3>Interfaces</h3>
Emulate Alexa device: <input type="checkbox" name="ALEXA" value="0"> <br>
Emulate Alexa device: <input type="checkbox" name="ALEXA"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX" value="0"> <br>
Send Alexa notifications: <input type="checkbox" name="NSALX"> <br>
<h3>Time (highly experimental!)</h3>
<b> Warning! </b>NTP was updated but still causes crashes. Requires reboot. <br>
It is really not recommended to use this! <br>
Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br>
Get time from NTP server: <input type="checkbox" name="NTPON"> <br>
Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" maxlength="3" size="2"> <br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN" value="0"><br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN"><br>
<h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br>
OTA locked: <input type="checkbox" name="NOOTA"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
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" value="0"> <br>
Disable recovery AP (<i>Not implemented</i>): <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>
Factory reset: <input type="checkbox" name="RESET" value="0"> <br>
Factory reset: <input type="checkbox" name="RESET"> <br>
All EEPROM content (settings) will be erased. <br> <br>
HTTP traffic is not encrypted. An attacker in the same network could intercept form data!<br>

View File

@ -43,6 +43,7 @@ const char PAGE_settings[] PROGMEM = R"=====(
document.S_form.CLDFA.value = this.responseXML.getElementsByTagName('cldfa')[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;
@ -118,7 +119,7 @@ const char PAGE_settings[] PROGMEM = R"=====(
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>
Hide AP SSID: <input type="checkbox" name="APHSSID" value="0"> <br>
Hide AP SSID: <input type="checkbox" name="APHSSID"> <br>
AP password (leave empty for open): <br> <input type="password" name="APPASS" maxlength="63"> <br>
AP channel: <input name="APCHAN" maxlength="2" size="2"> <br>
AP IP: <span class="sip"> Not active </span> <br>
@ -135,47 +136,48 @@ const char PAGE_settings[] PROGMEM = R"=====(
Default brightness: <input name="CLDFA" maxlength="3" size="2"> (0-255) <br>
Default effect ID: <input name="FXDEF" maxlength="3" size="2"> <br>
Default effect speed: <input name="SXDEF" maxlength="3" size="2"> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR" value="0"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI" value="0"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB" value="0"> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR"> <br>
Turn on after power up/reset: <input type="checkbox" name="BOOTN"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB"> <br>
Brightness factor: <input name="NRBRI" maxlength="3" size="2"> % <br>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BTNON" value="0"> <br>
On/Off button enabled: <input type="checkbox" name="BTNON"> <br>
<h3>Transitions</h3>
Fade: <input type="checkbox" name="TFADE" value="0"> <br>
Fade: <input type="checkbox" name="TFADE"> <br>
Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br>
<h3>Timed light</h3>
Target brightness: <input name="TLBRI" maxlength="3" size="2"> (0-255) <br>
Change after: <input name="TLDUR" maxlength="3" size="2"> min <br>
Fade: <input type="checkbox" name="TLFDE" value="0"> <br>
Fade: <input type="checkbox" name="TLFDE"> <br>
<h3>Daisy chain</h3>
UDP Port: <input name="NUDPP" maxlength="5" size="2"><br>
Receive notifications: <input type="checkbox" name="NRCVE" value="0"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br>
Receive notifications: <input type="checkbox" name="NRCVE"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD"> <br>
<h3>Interfaces</h3>
Emulate Alexa device: <input type="checkbox" name="ALEXA" value="0"> <br>
Emulate Alexa device: <input type="checkbox" name="ALEXA"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX" value="0"> <br>
Send Alexa notifications: <input type="checkbox" name="NSALX"> <br>
<h3>Time (highly experimental!)</h3>
<b> Warning! </b>NTP was updated but still causes crashes. Requires reboot. <br>
It is really not recommended to use this! <br>
Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br>
Get time from NTP server: <input type="checkbox" name="NTPON"> <br>
Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" maxlength="3" size="2"> <br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN" value="0"><br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN"><br>
<h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br>
OTA locked: <input type="checkbox" name="NOOTA"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
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" value="0"> <br>
Disable recovery AP (<i>Not implemented</i>): <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>
Factory reset: <input type="checkbox" name="RESET" value="0"> <br>
Factory reset: <input type="checkbox" name="RESET"> <br>
All EEPROM content (settings) will be erased. <br> <br>
HTTP traffic is not encrypted. An attacker in the same network could intercept form data!<br>

View File

@ -70,6 +70,7 @@ boolean useap = true;
IPAddress staticip(0, 0, 0, 0);
IPAddress staticgateway(0, 0, 0, 0);
IPAddress staticsubnet(255, 255, 255, 0);
boolean turnOnAtBoot = true;
byte col_s[]{255, 127, 0};
byte bri_s = 127;
uint8_t bri_nl = 0;

View File

@ -99,6 +99,7 @@ void saveSettingsToEEPROM()
EEPROM.write(366, alexaNotify);
EEPROM.write(367, arlsSign);
EEPROM.write(368, abs(arlsOffset));
EEPROM.write(369, turnOnAtBoot);
EEPROM.commit();
}
@ -166,6 +167,10 @@ void loadSettingsFromEEPROM()
col_s[1] = EEPROM.read(247); col[1] = col_s[1];
col_s[2] = EEPROM.read(248); col[2] = col_s[2];
bri_s = EEPROM.read(249); bri = bri_s;
if (!EEPROM.read(369))
{
bri = 0; bri_last = bri_s;
}
receiveNotifications = EEPROM.read(250);
receiveNotificationsDefault = receiveNotifications;
fadeTransition = EEPROM.read(251);
@ -204,4 +209,5 @@ void loadSettingsFromEEPROM()
arlsSign = EEPROM.read(367);
arlsOffset = EEPROM.read(368);
if (!arlsSign) arlsOffset = -arlsOffset;
turnOnAtBoot = EEPROM.read(369);
}

View File

@ -112,6 +112,9 @@ void XML_response_settings()
resp = resp + "<cldfa>";
resp = resp + bri_s;
resp = resp + "</cldfa>";
resp = resp + "<bootn>";
resp = resp + bool2int(turnOnAtBoot);
resp = resp + "</bootn>";
resp = resp + "<fxdef>";
resp = resp + effectDefault;
resp = resp + "</fxdef>";

View File

@ -133,6 +133,7 @@ void handleSettingsSet()
int i = server.arg("CLDFA").toInt();
if (i >= 0 && i <= 255) bri_s = i;
}
turnOnAtBoot = server.hasArg("BOOTN");
if (server.hasArg("FXDEF"))
{
int i = server.arg("FXDEF").toInt();

View File

@ -83,7 +83,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... Go to main page when lights turn on.");
server.send(200, "text/plain", "Rebooting... Please wait a few seconds and refresh page.");
reset();
});
server.on("/set-settings", HTTP_POST, [](){