FAILED: Started to implement Sweep transition, revert for now

This commit is contained in:
cschwinne 2017-10-28 22:22:37 +02:00
parent d5a766a49f
commit 221ebfd8f1
11 changed files with 54 additions and 19 deletions

View File

@ -43,10 +43,11 @@ auto update (get from server)
ifLed feature -> set triggers for reqs.? ifLed feature -> set triggers for reqs.?
BUGS BUGS
general forced reset (usually around 48h) opening settings causes crash after long runtime
NTP crash (1-48h) flashing random (fixed?)
general forced reset (usually around 48h) (fixed?)
NTP crash (1-48h) (fixed?)
losing connectivity losing connectivity
off after forced reset (system query?)
udp notifier doesn't work all the time udp notifier doesn't work all the time
static ip disables mdns static ip disables mdns
? authentification for security relevant areas ([/settings, /reset]) ? authentification for security relevant areas ([/settings, /reset])

View File

@ -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. Contents in the /data directory may be uploaded to SPIFFS.
Features: (V0.3) Features: (V0.4)
- RGB, HSB, and brightness sliders - RGB, HSB, and brightness sliders
- Settings page - configuration over network - Settings page - configuration over network
- Access Point and station mode - automatic failsafe AP - Access Point and station mode - automatic failsafe AP
- WS2812FX library integrated for nearly 50 special effects! - WS2812FX library integrated for nearly 50 special effects!
- Support for RGBW strips
- Nightlight function (gradually dims down) - Nightlight function (gradually dims down)
- Notifier function (multiple ESPs sync color via UDP broadcast) - Notifier function (multiple ESPs sync color via UDP broadcast)
- Support for power pushbutton - Support for power pushbutton
@ -21,8 +22,8 @@ Features: (V0.3)
Compile settings: Compile settings:
Board: WeMos D1 mini (untested with other HW, should work though) Board: WeMos D1 mini (untested with other HW, should work though)
CPU frequency: 80 MHz CPU frequency: 80 MHz
Flash size : 4MB (1MB SPIFFS) Flash size : 4MB (3MB SPIFFS)
Upload speed: 115200 Upload speed: 921600
Quick start guide: 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) "&R=<0-255>" set LED red value (red slider)
"&G=<0-255>" set LED green value (green slider) "&G=<0-255>" set LED green value (green slider)
"&B=<0-255>" set LED blue value (blue 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 "&T=<0 or 1 or 2-255>" 0: switch off, on, toggle
"&FX=<0-47>" set LED effect (refer to WS2812FX library) "&FX=<0-47>" set LED effect (refer to WS2812FX library)
"&SX=<0-255>" set LED effect speed (refer to WS2812FX library) "&SX=<0-255>" set LED effect speed (refer to WS2812FX library)

File diff suppressed because one or more lines are too long

View File

@ -46,6 +46,8 @@
document.S_form.GCRGB.checked = (this.responseXML.getElementsByTagName('gcrgb')[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.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.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.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML;
document.S_form.TLBRI.value = this.responseXML.getElementsByTagName('tlbri')[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.TLDUR.value = this.responseXML.getElementsByTagName('tldur')[0].innerHTML;
@ -140,6 +142,7 @@
On/Off button enabled: <input type="checkbox" name="BTNON"> <br> On/Off button enabled: <input type="checkbox" name="BTNON"> <br>
<h3>Transitions</h3> <h3>Transitions</h3>
Fade: <input type="checkbox" name="TFADE"> <br> Fade: <input type="checkbox" name="TFADE"> <br>
Sweep: <input type="checkbox" name="TSWEE"> Invert direction: <input type="checkbox" name="TSDIR"><br>
Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br> Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br>
<h3>Timed light</h3> <h3>Timed light</h3>
Target brightness: <input name="TLBRI" maxlength="3" size="2"> (0-255) <br> Target brightness: <input name="TLBRI" maxlength="3" size="2"> (0-255) <br>

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
#include "CallbackFunction.h" #include "CallbackFunction.h"
//version in format yymmddb (b = daily build) //version in format yymmddb (b = daily build)
#define VERSION 1710280 #define VERSION 1710283
//uncomment if you have an RGBW strip //uncomment if you have an RGBW strip
#define RGBW #define RGBW
@ -72,8 +72,8 @@ TimeChangeRule *tcr; //pointer to the time change rule, use to get the TZ
time_t local; time_t local;
//Default CONFIG //Default CONFIG
uint8_t ledcount = 255; uint8_t ledcount = 93;
String serverDescription = "WLED 0.3pd"; String serverDescription = "WLED 0.4p";
String clientssid = "Your_Network_Here"; String clientssid = "Your_Network_Here";
String clientpass = "Dummy_Pass"; String clientpass = "Dummy_Pass";
String cmdns = "led"; String cmdns = "led";
@ -92,6 +92,7 @@ byte white_s = 0;
byte bri_s = 127; byte bri_s = 127;
uint8_t bri_nl = 0, bri_nls; uint8_t bri_nl = 0, bri_nls;
boolean fadeTransition = true; boolean fadeTransition = true;
boolean sweepTransition = false; boolean sweepDirection = true;
uint16_t transitionDelay = 1200; uint16_t transitionDelay = 1200;
boolean ota_lock = true; boolean ota_lock = true;
boolean only_ap = false; boolean only_ap = false;

View File

@ -103,6 +103,8 @@ void saveSettingsToEEPROM()
EEPROM.write(370, useHSBDefault); EEPROM.write(370, useHSBDefault);
EEPROM.write(371, white_s); EEPROM.write(371, white_s);
EEPROM.write(372, useRGBW); EEPROM.write(372, useRGBW);
EEPROM.write(373, sweepTransition);
EEPROM.write(374, sweepDirection);
EEPROM.commit(); EEPROM.commit();
} }
@ -216,5 +218,7 @@ void loadSettingsFromEEPROM()
useHSBDefault = EEPROM.read(370); useHSBDefault = EEPROM.read(370);
white_s = EEPROM.read(371); white_s = EEPROM.read(371);
useRGBW = EEPROM.read(372); useRGBW = EEPROM.read(372);
sweepTransition = EEPROM.read(373);
sweepDirection = EEPROM.read(374);
useHSB = useHSBDefault; useHSB = useHSBDefault;
} }

View File

@ -144,8 +144,11 @@ void XML_response_settings()
resp = resp + fadeTransition; resp = resp + fadeTransition;
resp = resp + "</tfade><tdlay>"; resp = resp + "</tfade><tdlay>";
resp = resp + transitionDelay; resp = resp + transitionDelay;
resp = resp + "</tdlay>"; resp = resp + "</tdlay><tswee>";
resp = resp + "<tlbri>"; resp = resp + sweepTransition;
resp = resp + "</tswee><tsdir>";
resp = resp + !sweepDirection;
resp = resp + "</tsdir><tlbri>";
resp = resp + bri_nl; resp = resp + bri_nl;
resp = resp + "</tlbri>"; resp = resp + "</tlbri>";
resp = resp + "<tldur>"; resp = resp + "<tldur>";

View File

@ -163,6 +163,8 @@ void handleSettingsSet()
useGammaCorrectionRGB = server.hasArg("GCRGB"); useGammaCorrectionRGB = server.hasArg("GCRGB");
buttonEnabled = server.hasArg("BTNON"); buttonEnabled = server.hasArg("BTNON");
fadeTransition = server.hasArg("TFADE"); fadeTransition = server.hasArg("TFADE");
sweepTransition = server.hasArg("TSWEE");
sweepDirection = !server.hasArg("TSDIR");
if (server.hasArg("TDLAY")) if (server.hasArg("TDLAY"))
{ {
int i = server.arg("TDLAY").toInt(); int i = server.arg("TDLAY").toInt();

View File

@ -26,6 +26,7 @@ void notify(uint8_t callMode)
udpOut[8] = effectCurrent; udpOut[8] = effectCurrent;
udpOut[9] = effectSpeed; udpOut[9] = effectSpeed;
udpOut[10] = white; udpOut[10] = white;
udpOut[11] = 1; //boolean byte, lowest bit to confirm white value compatibility
IPAddress broadcastIp; IPAddress broadcastIp;
broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP(); broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP();
@ -47,7 +48,7 @@ void handleNotifications()
col[0] = udpIn[3]; col[0] = udpIn[3];
col[1] = udpIn[4]; col[1] = udpIn[4];
col[2] = udpIn[5]; 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) if (udpIn[8] != effectCurrent)
{ {
effectCurrent = udpIn[8]; effectCurrent = udpIn[8];

View File

@ -65,9 +65,9 @@ void colorUpdated(int callMode)
bri_it = bri; bri_it = bri;
if (bri > 0) bri_last = bri; if (bri > 0) bri_last = bri;
notify(callMode); notify(callMode);
if (fadeTransition) if (fadeTransition || sweepTransition)
{ {
if (transitionActive) if (transitionActive && fadeTransition)
{ {
col_old[0] = col_t[0]; col_old[0] = col_t[0];
col_old[1] = col_t[1]; col_old[1] = col_t[1];
@ -93,6 +93,7 @@ void handleTransitions()
{ {
transitionActive = false; transitionActive = false;
tper_last = 0; tper_last = 0;
if (sweepTransition) strip.unlockAll();
setLedsStandard(); setLedsStandard();
return; return;
} }
@ -109,7 +110,22 @@ void handleTransitions()
white_t = white_old +((white - white_old )*tper); white_t = white_old +((white - white_old )*tper);
bri_t = bri_old +((bri - bri_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();
} }
} }