Full segment syncing.
- removed setEffectConfig() - rate limit handleNightlight() - fixes in colorUpdated() - segment color fix in UDP routine
This commit is contained in:
parent
72a6681ac1
commit
3da70c3e8b
@ -390,7 +390,7 @@ uint8_t WS2812FX::getPaletteCount()
|
|||||||
|
|
||||||
//TODO effect transitions
|
//TODO effect transitions
|
||||||
|
|
||||||
|
/*
|
||||||
bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) {
|
bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) {
|
||||||
Segment& seg = _segments[getMainSegmentId()];
|
Segment& seg = _segments[getMainSegmentId()];
|
||||||
uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette;
|
uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette;
|
||||||
@ -425,7 +425,7 @@ bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) {
|
|||||||
void WS2812FX::setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
|
void WS2812FX::setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
|
||||||
setColor(slot, RGBW32(r, g, b, w));
|
setColor(slot, RGBW32(r, g, b, w));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void WS2812FX::setColor(uint8_t slot, uint32_t c) {
|
void WS2812FX::setColor(uint8_t slot, uint32_t c) {
|
||||||
if (slot >= NUM_COLORS) return;
|
if (slot >= NUM_COLORS) return;
|
||||||
|
|
||||||
|
3206
wled00/html_ui.h
3206
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,6 @@ void toggleOnOff()
|
|||||||
briLast = bri;
|
briLast = bri;
|
||||||
bri = 0;
|
bri = 0;
|
||||||
}
|
}
|
||||||
colorChanged = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,8 +44,8 @@ byte scaledBri(byte in)
|
|||||||
|
|
||||||
|
|
||||||
void setAllLeds() {
|
void setAllLeds() {
|
||||||
strip.setColor(0, col[0], col[1], col[2], col[3]);
|
strip.setColor(0, RGBW32(col[0], col[1], col[2], col[3]));
|
||||||
strip.setColor(1, colSec[0], colSec[1], colSec[2], colSec[3]);
|
strip.setColor(1, RGBW32(colSec[0], colSec[1], colSec[2], colSec[3]));
|
||||||
if (!realtimeMode || !arlsForceMaxBri)
|
if (!realtimeMode || !arlsForceMaxBri)
|
||||||
{
|
{
|
||||||
strip.setBrightness(scaledBri(briT));
|
strip.setBrightness(scaledBri(briT));
|
||||||
@ -66,17 +65,18 @@ void colorUpdated(int callMode)
|
|||||||
{
|
{
|
||||||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
||||||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 11: ws send only 12: button preset
|
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 11: ws send only 12: button preset
|
||||||
if (callMode != CALL_MODE_INIT &&
|
// if (callMode != CALL_MODE_INIT &&
|
||||||
callMode != CALL_MODE_DIRECT_CHANGE &&
|
// callMode != CALL_MODE_DIRECT_CHANGE &&
|
||||||
callMode != CALL_MODE_NO_NOTIFY &&
|
// callMode != CALL_MODE_NO_NOTIFY &&
|
||||||
callMode != CALL_MODE_BUTTON_PRESET) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
// callMode != CALL_MODE_BUTTON_PRESET) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
||||||
|
|
||||||
if (effectChanged || colorChanged) {
|
if (effectChanged || colorChanged) {
|
||||||
effectChanged = false;
|
effectChanged = false;
|
||||||
|
colorChanged = false;
|
||||||
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
||||||
currentPreset = 0; //something changed, so we are no longer in the preset
|
currentPreset = 0; //something changed, so we are no longer in the preset
|
||||||
|
|
||||||
notify(callMode);
|
if (callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) notify(callMode);
|
||||||
|
|
||||||
//set flag to update blynk, ws and mqtt
|
//set flag to update blynk, ws and mqtt
|
||||||
interfaceUpdateCallMode = callMode;
|
interfaceUpdateCallMode = callMode;
|
||||||
@ -87,9 +87,6 @@ void colorUpdated(int callMode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colorChanged) return; //following code is for e.g. initiating transitions
|
|
||||||
colorChanged = false;
|
|
||||||
|
|
||||||
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE)) {
|
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE)) {
|
||||||
briNlT = bri;
|
briNlT = bri;
|
||||||
nightlightDelayMs -= (millis() - nightlightStartTime);
|
nightlightDelayMs -= (millis() - nightlightStartTime);
|
||||||
@ -110,7 +107,9 @@ void colorUpdated(int callMode)
|
|||||||
jsonTransitionOnce = false;
|
jsonTransitionOnce = false;
|
||||||
strip.setTransition(transitionDelayTemp);
|
strip.setTransition(transitionDelayTemp);
|
||||||
if (transitionDelayTemp == 0) {
|
if (transitionDelayTemp == 0) {
|
||||||
setLedsStandard();
|
//setLedsStandard();
|
||||||
|
briOld = briT = bri;
|
||||||
|
if (!realtimeMode || !arlsForceMaxBri) strip.setBrightness(scaledBri(briT));
|
||||||
strip.trigger();
|
strip.trigger();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -124,7 +123,9 @@ void colorUpdated(int callMode)
|
|||||||
transitionStartTime = millis();
|
transitionStartTime = millis();
|
||||||
} else {
|
} else {
|
||||||
strip.setTransition(0);
|
strip.setTransition(0);
|
||||||
setLedsStandard();
|
//setLedsStandard();
|
||||||
|
briOld = briT = bri;
|
||||||
|
if (!realtimeMode || !arlsForceMaxBri) strip.setBrightness(scaledBri(briT));
|
||||||
strip.trigger();
|
strip.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,6 +183,12 @@ void handleTransitions()
|
|||||||
|
|
||||||
void handleNightlight()
|
void handleNightlight()
|
||||||
{
|
{
|
||||||
|
static unsigned long lastNlUpdate;
|
||||||
|
unsigned long now = millis();
|
||||||
|
if (now < 100 && lastNlUpdate > 0) lastNlUpdate = 0; //take care of millis() rollover
|
||||||
|
if (now - lastNlUpdate < 100) return; //allow only 10 NL updates per second
|
||||||
|
lastNlUpdate = now;
|
||||||
|
|
||||||
if (nightlightActive)
|
if (nightlightActive)
|
||||||
{
|
{
|
||||||
if (!nightlightActiveOld) //init
|
if (!nightlightActiveOld) //init
|
||||||
|
@ -282,24 +282,23 @@ void handleNotifications()
|
|||||||
|
|
||||||
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||||
//apply colors from notification
|
//apply colors from notification
|
||||||
if (receiveNotificationColor || !someSel)
|
if (receiveNotificationColor || !someSel) {
|
||||||
{
|
if (version < 11 || !receiveSegmentOptions) {
|
||||||
col[0] = udpIn[3];
|
col[0] = udpIn[3];
|
||||||
col[1] = udpIn[4];
|
col[1] = udpIn[4];
|
||||||
col[2] = udpIn[5];
|
col[2] = udpIn[5];
|
||||||
|
}
|
||||||
if (version > 0) //sending module's white val is intended
|
if (version > 0) //sending module's white val is intended
|
||||||
{
|
{
|
||||||
col[3] = udpIn[10];
|
if (version < 11 || !receiveSegmentOptions) col[3] = udpIn[10];
|
||||||
if (version > 1)
|
if (version > 1 && (version < 11 || !receiveSegmentOptions)) {
|
||||||
{
|
|
||||||
colSec[0] = udpIn[12];
|
colSec[0] = udpIn[12];
|
||||||
colSec[1] = udpIn[13];
|
colSec[1] = udpIn[13];
|
||||||
colSec[2] = udpIn[14];
|
colSec[2] = udpIn[14];
|
||||||
colSec[3] = udpIn[15];
|
colSec[3] = udpIn[15];
|
||||||
}
|
}
|
||||||
if (version > 6)
|
if (version > 6 && (version < 11 || !receiveSegmentOptions)) {
|
||||||
{
|
strip.setColor(2, RGBW32(udpIn[20], udpIn[21], udpIn[22], udpIn[23])); //tertiary color
|
||||||
strip.setColor(2, udpIn[20], udpIn[21], udpIn[22], udpIn[23]); //tertiary color
|
|
||||||
}
|
}
|
||||||
if (version > 9 && version < 200 && udpIn[37] < 255) { //valid CCT/Kelvin value
|
if (version > 9 && version < 200 && udpIn[37] < 255) { //valid CCT/Kelvin value
|
||||||
uint8_t cct = udpIn[38];
|
uint8_t cct = udpIn[38];
|
||||||
|
Loading…
Reference in New Issue
Block a user