Various state changed logic simplifications

Changed main segment, must be selected
This commit is contained in:
cschwinne
2022-02-16 21:12:33 +01:00
parent 7aef551292
commit 7b969bb8c2
34 changed files with 279 additions and 373 deletions

View File

@@ -44,7 +44,7 @@ void onAlexaChange(EspalexaDevice* dev)
if (bri == 0)
{
bri = briLast;
colorUpdated(CALL_MODE_ALEXA);
stateUpdated(CALL_MODE_ALEXA);
}
} else {
applyPreset(macroAlexaOn, CALL_MODE_ALEXA);
@@ -58,7 +58,7 @@ void onAlexaChange(EspalexaDevice* dev)
{
briLast = bri;
bri = 0;
colorUpdated(CALL_MODE_ALEXA);
stateUpdated(CALL_MODE_ALEXA);
}
} else {
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
@@ -67,7 +67,7 @@ void onAlexaChange(EspalexaDevice* dev)
} else if (m == EspalexaDeviceProperty::bri)
{
bri = espalexaDevice->getValue();
colorUpdated(CALL_MODE_ALEXA);
stateUpdated(CALL_MODE_ALEXA);
} else //color
{
if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white
@@ -79,9 +79,7 @@ void onAlexaChange(EspalexaDevice* dev)
if (strip.hasCCTBus()) {
uint8_t segid = strip.getMainSegmentId();
WS2812FX::Segment& seg = strip.getSegment(segid);
uint8_t cctPrev = seg.cct;
seg.setCCT(k, segid);
if (seg.cct != cctPrev) effectChanged = true; //send UDP
col[0]= 0; col[1]= 0; col[2]= 0; col[3]= 255;
} else if (strip.hasWhiteChannel()) {
switch (ct) { //these values empirically look good on RGBW