Reintroduction of per bus auto white calculation.

JS/CSS UI optimizations.
This commit is contained in:
Blaž Kristan
2022-03-09 13:39:51 +01:00
parent ddadaa828a
commit 5b88894638
13 changed files with 2169 additions and 2164 deletions

View File

@@ -219,13 +219,14 @@ void changeColor(uint32_t c, int16_t cct=-1)
if (!seg.isActive() || !seg.isSelected()) continue;
byte capabilities = seg.getLightCapabilities();
uint32_t mask = 0;
bool isRGB = GET_BIT(capabilities, 0); // when RGBW_MODE_AUTO_ACCURATE this is always true
bool hasW = GET_BIT(capabilities, 1);
bool isCCT = GET_BIT(capabilities, 2);
bool isRGB = GET_BIT(capabilities, 0); // is segment RGB capable
bool hasW = GET_BIT(capabilities, 1); // do we have white/CCT channel
bool isCCT = GET_BIT(capabilities, 2); // is segment CCT capable
bool wSlider = GET_BIT(capabilities, 3); // is white auto calculated (white slider NOT shown in UI)
if (isRGB) mask |= 0x00FFFFFF; // RGB
if (hasW) mask |= 0xFF000000; // white
if (hasW && (strip.autoWhiteMode == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
if (hasW && !wSlider && (c & 0xFF000000)) { // segment has white channel & white channel is auto calculated & white specified
seg.setColor(0, c | 0xFFFFFF, i); // for accurate/brighter mode we fake white (since button may not set white color to 0xFFFFFF)
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
if (isCCT && cct >= 0) seg.setCCT(cct, i);
}
@@ -235,13 +236,14 @@ void changeColor(uint32_t c, int16_t cct=-1)
WS2812FX::Segment& seg = strip.getSegment(i);
byte capabilities = seg.getLightCapabilities();
uint32_t mask = 0;
bool isRGB = GET_BIT(capabilities, 0);
bool hasW = GET_BIT(capabilities, 1);
bool isCCT = GET_BIT(capabilities, 2);
bool isRGB = GET_BIT(capabilities, 0); // is segment RGB capable
bool hasW = GET_BIT(capabilities, 1); // do we have white/CCT channel
bool isCCT = GET_BIT(capabilities, 2); // is segment CCT capable
bool wSlider = GET_BIT(capabilities, 3); // is white auto calculated (white slider NOT shown in UI)
if (isRGB) mask |= 0x00FFFFFF; // RGB
if (hasW) mask |= 0xFF000000; // white
if (hasW && (strip.autoWhiteMode == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
if (hasW && !wSlider && (c & 0xFF000000)) { // segment has white channel & white channel is auto calculated & white specified
seg.setColor(0, c | 0xFFFFFF, i); // for accurate/brighter mode we fake white (since button may not set white color to 0xFFFFFF)
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
if (isCCT && cct >= 0) seg.setCCT(cct, i);
setValuesFromMainSeg();