From 221ebfd8f110b81a6e012f8034964e9422d63176 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 28 Oct 2017 22:22:37 +0200 Subject: [PATCH] FAILED: Started to implement Sweep transition, revert for now --- TODO.txt | 7 +++--- readme.md | 12 +++++----- .../{settings-min.htm => settings-min.html} | 3 ++- wled00/data/settings.htm | 3 +++ wled00/htmls01.h | 3 ++- wled00/wled00.ino | 7 +++--- wled00/wled01_eeprom.ino | 4 ++++ wled00/wled02_xml.ino | 7 ++++-- wled00/wled03_set.ino | 2 ++ wled00/wled07_notify.ino | 3 ++- wled00/wled08_led.ino | 22 ++++++++++++++++--- 11 files changed, 54 insertions(+), 19 deletions(-) rename wled00/data/{settings-min.htm => settings-min.html} (76%) diff --git a/TODO.txt b/TODO.txt index 4b7b8c1f..1d7d7698 100644 --- a/TODO.txt +++ b/TODO.txt @@ -43,10 +43,11 @@ auto update (get from server) ifLed feature -> set triggers for reqs.? BUGS -general forced reset (usually around 48h) -NTP crash (1-48h) +opening settings causes crash after long runtime +flashing random (fixed?) +general forced reset (usually around 48h) (fixed?) +NTP crash (1-48h) (fixed?) losing connectivity -off after forced reset (system query?) udp notifier doesn't work all the time static ip disables mdns ? authentification for security relevant areas ([/settings, /reset]) diff --git a/readme.md b/readme.md index 4f282cfc..3ba7f887 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,14 @@ -WLED is a basic, fast and (relatively) (ok, VERY relatively) secure implementation of a ESP8266 webserver to control Neopixel (WS2812B) leds +WLED is a basic, fast and (relatively) secure implementation of a ESP8266 webserver to control Neopixel (WS2812B) leds -Uses ESP arduino version 2.3.0 (latest as of May 2017). +Uses ESP arduino version 2.3.0 (latest as of October 2017). Contents in the /data directory may be uploaded to SPIFFS. -Features: (V0.3) +Features: (V0.4) - RGB, HSB, and brightness sliders - Settings page - configuration over network - Access Point and station mode - automatic failsafe AP - WS2812FX library integrated for nearly 50 special effects! +- Support for RGBW strips - Nightlight function (gradually dims down) - Notifier function (multiple ESPs sync color via UDP broadcast) - Support for power pushbutton @@ -21,8 +22,8 @@ Features: (V0.3) Compile settings: Board: WeMos D1 mini (untested with other HW, should work though) CPU frequency: 80 MHz -Flash size : 4MB (1MB SPIFFS) -Upload speed: 115200 +Flash size : 4MB (3MB SPIFFS) +Upload speed: 921600 Quick start guide: @@ -54,6 +55,7 @@ Add one or multiple of the following parameters after the base url to change val "&R=<0-255>" set LED red value (red slider) "&G=<0-255>" set LED green value (green slider) "&B=<0-255>" set LED blue value (blue slider) +"&W=<0-255>" set LED white value (white slider) (only when RGBW enabled) "&T=<0 or 1 or 2-255>" 0: switch off, on, toggle "&FX=<0-47>" set LED effect (refer to WS2812FX library) "&SX=<0-255>" set LED effect speed (refer to WS2812FX library) diff --git a/wled00/data/settings-min.htm b/wled00/data/settings-min.html similarity index 76% rename from wled00/data/settings-min.htm rename to wled00/data/settings-min.html index f8af246b..939aba0f 100644 --- a/wled00/data/settings-min.htm +++ b/wled00/data/settings-min.html @@ -3,7 +3,7 @@ Settings - + @@ -63,6 +63,7 @@ Brightness factor: %
On/Off button enabled:

Transitions

Fade:
+Sweep: Invert direction:
Transition Delay: ms

Timed light

Target brightness: (0-255)
diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index 551dac09..019e92ef 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -46,6 +46,8 @@ 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; @@ -140,6 +142,7 @@ On/Off button enabled:

Transitions

Fade:
+ Sweep: Invert direction:
Transition Delay: ms

Timed light

Target brightness: (0-255)
diff --git a/wled00/htmls01.h b/wled00/htmls01.h index 860ddbe6..ceb24f19 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -7,7 +7,7 @@ const char PAGE_settings[] PROGMEM = R"=====( Settings - + @@ -67,6 +67,7 @@ Brightness factor: %
On/Off button enabled:

Transitions

Fade:
+Sweep: Invert direction:
Transition Delay: ms

Timed light

Target brightness: (0-255)
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 1b51300b..494bdbf5 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -20,7 +20,7 @@ #include "CallbackFunction.h" //version in format yymmddb (b = daily build) -#define VERSION 1710280 +#define VERSION 1710283 //uncomment if you have an RGBW strip #define RGBW @@ -72,8 +72,8 @@ TimeChangeRule *tcr; //pointer to the time change rule, use to get the TZ time_t local; //Default CONFIG -uint8_t ledcount = 255; -String serverDescription = "WLED 0.3pd"; +uint8_t ledcount = 93; +String serverDescription = "WLED 0.4p"; String clientssid = "Your_Network_Here"; String clientpass = "Dummy_Pass"; String cmdns = "led"; @@ -92,6 +92,7 @@ byte white_s = 0; byte bri_s = 127; 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; diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 43047704..04ab101c 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -103,6 +103,8 @@ void saveSettingsToEEPROM() EEPROM.write(370, useHSBDefault); EEPROM.write(371, white_s); EEPROM.write(372, useRGBW); + EEPROM.write(373, sweepTransition); + EEPROM.write(374, sweepDirection); EEPROM.commit(); } @@ -216,5 +218,7 @@ void loadSettingsFromEEPROM() useHSBDefault = EEPROM.read(370); white_s = EEPROM.read(371); useRGBW = EEPROM.read(372); + sweepTransition = EEPROM.read(373); + sweepDirection = EEPROM.read(374); useHSB = useHSBDefault; } diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index e7490e9a..a9f34ed0 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -144,8 +144,11 @@ void XML_response_settings() resp = resp + fadeTransition; resp = resp + ""; resp = resp + transitionDelay; - resp = resp + ""; - resp = resp + ""; + resp = resp + ""; + resp = resp + sweepTransition; + resp = resp + ""; + resp = resp + !sweepDirection; + resp = resp + ""; resp = resp + bri_nl; resp = resp + ""; resp = resp + ""; diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 04cc5d2e..80a46d38 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -163,6 +163,8 @@ void handleSettingsSet() useGammaCorrectionRGB = server.hasArg("GCRGB"); buttonEnabled = server.hasArg("BTNON"); fadeTransition = server.hasArg("TFADE"); + sweepTransition = server.hasArg("TSWEE"); + sweepDirection = !server.hasArg("TSDIR"); if (server.hasArg("TDLAY")) { int i = server.arg("TDLAY").toInt(); diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index b39edb08..6cf7eb76 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -26,6 +26,7 @@ void notify(uint8_t callMode) udpOut[8] = effectCurrent; udpOut[9] = effectSpeed; udpOut[10] = white; + udpOut[11] = 1; //boolean byte, lowest bit to confirm white value compatibility IPAddress broadcastIp; broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP(); @@ -47,7 +48,7 @@ void handleNotifications() col[0] = udpIn[3]; col[1] = udpIn[4]; col[2] = udpIn[5]; - white = udpIn[10]; + if (udpIn[11] %2 == 1) white = udpIn[10]; //check if sending modules white val is inteded if (udpIn[8] != effectCurrent) { effectCurrent = udpIn[8]; diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 5e802d77..8b5713fd 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -65,9 +65,9 @@ void colorUpdated(int callMode) bri_it = bri; if (bri > 0) bri_last = bri; notify(callMode); - if (fadeTransition) + if (fadeTransition || sweepTransition) { - if (transitionActive) + if (transitionActive && fadeTransition) { col_old[0] = col_t[0]; col_old[1] = col_t[1]; @@ -93,6 +93,7 @@ void handleTransitions() { transitionActive = false; tper_last = 0; + if (sweepTransition) strip.unlockAll(); setLedsStandard(); return; } @@ -109,7 +110,22 @@ void handleTransitions() white_t = white_old +((white - white_old )*tper); bri_t = bri_old +((bri - bri_old )*tper); } - setAllLeds(); + if (sweepTransition) + { + strip.lockAll(); + if (sweepDirection) + { + strip.unlockRange(0, (int)(tper*(double)ledcount)); + } else + { + strip.unlockRange(ledcount - (int)(tper*(double)ledcount), ledcount); + } + if (!fadeTransition) + { + setLedsStandard(); + } + } + if (fadeTransition) setAllLeds(); } }