From 678765fc88a7a24f027c370f37323a80015bc6f9 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Tue, 7 Mar 2017 22:05:18 +0100 Subject: [PATCH] Added setting to not turn on lights at boot (due to random forced reboots since Alexa integration) minor text changes --- readme.md | 3 +++ wled00/data/settings.htm | 38 ++++++++++++++++++++------------------ wled00/htmls01.h | 38 ++++++++++++++++++++------------------ wled00/wled00.ino | 1 + wled00/wled01_eeprom.ino | 6 ++++++ wled00/wled02_xml.ino | 3 +++ wled00/wled03_set.ino | 1 + wled00/wled05_init.ino | 2 +- 8 files changed, 55 insertions(+), 37 deletions(-) diff --git a/readme.md b/readme.md index 56ec4de6..dacf7982 100644 --- a/readme.md +++ b/readme.md @@ -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. diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index a66b7560..433db21a 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -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: Not connected

Configure Access Point

AP SSID (leave empty for no AP):

- Hide AP SSID:
+ Hide AP SSID:
AP password (leave empty for open):

AP channel:
AP IP: Not active
@@ -131,47 +132,48 @@ Default brightness: (0-255)
Default effect ID:
Default effect speed:
- Ignore and use current color, brightness and effects:
- Use Gamma correction for brightness:
- Use Gamma correction for color:
+ Ignore and use current color, brightness and effects:
+ Turn on after power up/reset:
+ Use Gamma correction for brightness:
+ Use Gamma correction for color:
Brightness factor: %

Button setup

- On/Off button enabled:
+ On/Off button enabled:

Transitions

- Fade:
+ Fade:
Transition Delay: ms

Timed light

Target brightness: (0-255)
Change after: min
- Fade:
+ Fade:

Daisy chain

UDP Port:
- Receive notifications:
- Send notifications on direct change:
- Send notifications on button press:
- Send nightlight notifications:
+ Receive notifications:
+ Send notifications on direct change:
+ Send notifications on button press:
+ Send nightlight notifications:

Interfaces

- Emulate Alexa device:
+ Emulate Alexa device:
Alexa invocation name:
- Send Alexa notifications:
+ Send Alexa notifications:

Time (highly experimental!)

Warning! NTP was updated but still causes crashes. Requires reboot.
It is really not recommended to use this!
- Get time from NTP server:
+ Get time from NTP server:
Current local time is unknown

Advanced

Default overlay ID:
- WARLS offset: negative
+ WARLS offset: negative

Security

- OTA locked:
+ OTA locked:
Passphrase:
To enable OTA, for security reasons you need to also enter the correct password!
The password may/should be changed when OTA is enabled.
Disable OTA when not in use, otherwise an attacker could reflash device software!

- Disable recovery AP (Not implemented):
+ Disable recovery AP (Not implemented):
In case of a connection error there will be no wireless recovery possible!
Completely disables all Access Point functions.

- Factory reset:
+ Factory reset:
All EEPROM content (settings) will be erased.

HTTP traffic is not encrypted. An attacker in the same network could intercept form data!
diff --git a/wled00/htmls01.h b/wled00/htmls01.h index 12276f59..c5f53308 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -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: Not connected

Configure Access Point

AP SSID (leave empty for no AP):

- Hide AP SSID:
+ Hide AP SSID:
AP password (leave empty for open):

AP channel:
AP IP: Not active
@@ -135,47 +136,48 @@ const char PAGE_settings[] PROGMEM = R"=====( Default brightness: (0-255)
Default effect ID:
Default effect speed:
- Ignore and use current color, brightness and effects:
- Use Gamma correction for brightness:
- Use Gamma correction for color:
+ Ignore and use current color, brightness and effects:
+ Turn on after power up/reset:
+ Use Gamma correction for brightness:
+ Use Gamma correction for color:
Brightness factor: %

Button setup

- On/Off button enabled:
+ On/Off button enabled:

Transitions

- Fade:
+ Fade:
Transition Delay: ms

Timed light

Target brightness: (0-255)
Change after: min
- Fade:
+ Fade:

Daisy chain

UDP Port:
- Receive notifications:
- Send notifications on direct change:
- Send notifications on button press:
- Send nightlight notifications:
+ Receive notifications:
+ Send notifications on direct change:
+ Send notifications on button press:
+ Send nightlight notifications:

Interfaces

- Emulate Alexa device:
+ Emulate Alexa device:
Alexa invocation name:
- Send Alexa notifications:
+ Send Alexa notifications:

Time (highly experimental!)

Warning! NTP was updated but still causes crashes. Requires reboot.
It is really not recommended to use this!
- Get time from NTP server:
+ Get time from NTP server:
Current local time is unknown

Advanced

Default overlay ID:
- WARLS offset: negative
+ WARLS offset: negative

Security

- OTA locked:
+ OTA locked:
Passphrase:
To enable OTA, for security reasons you need to also enter the correct password!
The password may/should be changed when OTA is enabled.
Disable OTA when not in use, otherwise an attacker could reflash device software!

- Disable recovery AP (Not implemented):
+ Disable recovery AP (Not implemented):
In case of a connection error there will be no wireless recovery possible!
Completely disables all Access Point functions.

- Factory reset:
+ Factory reset:
All EEPROM content (settings) will be erased.

HTTP traffic is not encrypted. An attacker in the same network could intercept form data!
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index a1bb99d4..a6dd33bf 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -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; diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index d2e8ce73..964850c8 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -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); } diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index c034ae4b..2911c76b 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -112,6 +112,9 @@ void XML_response_settings() resp = resp + ""; resp = resp + bri_s; resp = resp + ""; + resp = resp + ""; + resp = resp + bool2int(turnOnAtBoot); + resp = resp + ""; resp = resp + ""; resp = resp + effectDefault; resp = resp + ""; diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 63b86113..31cd66cf 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -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(); diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 63982908..fff701d4 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -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, [](){