Disabled auto white mode in segments with no RGB bus
This commit is contained in:
parent
5d90d8930e
commit
b626c7620e
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
### Builds after release 0.12.0
|
### Builds after release 0.12.0
|
||||||
|
|
||||||
|
#### Build 2203080
|
||||||
|
|
||||||
|
- Disabled auto white mode in segments with no RGB bus
|
||||||
|
- Fixed hostname string not 0-terminated
|
||||||
|
- Fixed Popcorn mode not lighting first LED on pop
|
||||||
|
|
||||||
#### Build 2203060
|
#### Build 2203060
|
||||||
|
|
||||||
- Dynamic hiding of unused color controls in UI (PR #2567)
|
- Dynamic hiding of unused color controls in UI (PR #2567)
|
||||||
|
@ -657,6 +657,7 @@ class WS2812FX {
|
|||||||
paletteFade = 0,
|
paletteFade = 0,
|
||||||
paletteBlend = 0,
|
paletteBlend = 0,
|
||||||
milliampsPerLed = 55,
|
milliampsPerLed = 55,
|
||||||
|
autoWhiteMode = RGBW_MODE_DUAL,
|
||||||
cctBlending = 0,
|
cctBlending = 0,
|
||||||
getBrightness(void),
|
getBrightness(void),
|
||||||
getModeCount(void),
|
getModeCount(void),
|
||||||
|
@ -152,17 +152,18 @@ void WS2812FX::service() {
|
|||||||
_colors_t[slot] = transitions[t].currentColor(SEGMENT.colors[slot]);
|
_colors_t[slot] = transitions[t].currentColor(SEGMENT.colors[slot]);
|
||||||
}
|
}
|
||||||
if (!cctFromRgb || correctWB) busses.setSegmentCCT(_cct_t, correctWB);
|
if (!cctFromRgb || correctWB) busses.setSegmentCCT(_cct_t, correctWB);
|
||||||
_no_rgb = !(SEGMENT.getLightCapabilities() & 0x01);
|
|
||||||
for (uint8_t c = 0; c < NUM_COLORS; c++) {
|
for (uint8_t c = 0; c < NUM_COLORS; c++) {
|
||||||
// if segment is not RGB capable, treat RGB channels of main segment colors as if 0
|
|
||||||
// this prevents Dual mode with white value 0 from setting White channel from inaccessible RGB values
|
|
||||||
// If not RGB capable, also treat palette as if default (0), as palettes set white channel to 0
|
|
||||||
if (_no_rgb) _colors_t[c] = _colors_t[c] & 0xFF000000;
|
|
||||||
_colors_t[c] = gamma32(_colors_t[c]);
|
_colors_t[c] = gamma32(_colors_t[c]);
|
||||||
}
|
}
|
||||||
handle_palette();
|
handle_palette();
|
||||||
|
|
||||||
|
// if segment is not RGB capable, force None auto white mode
|
||||||
|
// If not RGB capable, also treat palette as if default (0), as palettes set white channel to 0
|
||||||
|
_no_rgb = !(SEGMENT.getLightCapabilities() & 0x01);
|
||||||
|
if (_no_rgb) Bus::setAutoWhiteMode(RGBW_MODE_MANUAL_ONLY);
|
||||||
delay = (this->*_mode[SEGMENT.mode])(); //effect function
|
delay = (this->*_mode[SEGMENT.mode])(); //effect function
|
||||||
if (SEGMENT.mode != FX_MODE_HALLOWEEN_EYES) SEGENV.call++;
|
if (SEGMENT.mode != FX_MODE_HALLOWEEN_EYES) SEGENV.call++;
|
||||||
|
Bus::setAutoWhiteMode(strip.autoWhiteMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGENV.next_time = nowUp + delay;
|
SEGENV.next_time = nowUp + delay;
|
||||||
@ -573,8 +574,9 @@ void WS2812FX::Segment::refreshLightCapabilities() {
|
|||||||
_capabilities = 0; return;
|
_capabilities = 0; return;
|
||||||
}
|
}
|
||||||
uint8_t capabilities = 0;
|
uint8_t capabilities = 0;
|
||||||
uint8_t awm = Bus::getAutoWhiteMode();
|
uint8_t awm = instance->autoWhiteMode;
|
||||||
bool whiteSlider = (awm == RGBW_MODE_DUAL || awm == RGBW_MODE_MANUAL_ONLY);
|
bool whiteSlider = (awm == RGBW_MODE_DUAL || awm == RGBW_MODE_MANUAL_ONLY);
|
||||||
|
bool segHasValidBus = false;
|
||||||
|
|
||||||
for (uint8_t b = 0; b < busses.getNumBusses(); b++) {
|
for (uint8_t b = 0; b < busses.getNumBusses(); b++) {
|
||||||
Bus *bus = busses.getBus(b);
|
Bus *bus = busses.getBus(b);
|
||||||
@ -582,12 +584,13 @@ void WS2812FX::Segment::refreshLightCapabilities() {
|
|||||||
if (bus->getStart() >= stop) continue;
|
if (bus->getStart() >= stop) continue;
|
||||||
if (bus->getStart() + bus->getLength() <= start) continue;
|
if (bus->getStart() + bus->getLength() <= start) continue;
|
||||||
|
|
||||||
|
segHasValidBus = true;
|
||||||
uint8_t type = bus->getType();
|
uint8_t type = bus->getType();
|
||||||
if (!whiteSlider || (type != TYPE_ANALOG_1CH && (cctFromRgb || type != TYPE_ANALOG_2CH)))
|
if (type != TYPE_ANALOG_1CH && (cctFromRgb || type != TYPE_ANALOG_2CH))
|
||||||
{
|
{
|
||||||
capabilities |= 0x01; //segment supports RGB (full color)
|
capabilities |= 0x01; // segment supports RGB (full color)
|
||||||
}
|
}
|
||||||
if (bus->isRgbw() && whiteSlider) capabilities |= 0x02; //segment supports white channel
|
if (bus->isRgbw() && whiteSlider) capabilities |= 0x02; // segment supports white channel
|
||||||
if (!cctFromRgb) {
|
if (!cctFromRgb) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_ANALOG_5CH:
|
case TYPE_ANALOG_5CH:
|
||||||
@ -597,6 +600,9 @@ void WS2812FX::Segment::refreshLightCapabilities() {
|
|||||||
}
|
}
|
||||||
if (correctWB && type != TYPE_ANALOG_1CH) capabilities |= 0x04; //white balance correction (uses CCT slider)
|
if (correctWB && type != TYPE_ANALOG_1CH) capabilities |= 0x04; //white balance correction (uses CCT slider)
|
||||||
}
|
}
|
||||||
|
// if seg has any bus, but no bus has RGB, it by definition supports white (at least for now)
|
||||||
|
// In case of no RGB, disregard auto white mode and always show a white slider
|
||||||
|
if (segHasValidBus && !(capabilities & 0x01)) capabilities |= 0x02; // segment supports white channel
|
||||||
_capabilities = capabilities;
|
_capabilities = capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
|
|
||||||
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
|
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
|
||||||
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
|
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
|
||||||
Bus::setAutoWhiteMode(hw_led[F("rgbwm")] | Bus::getAutoWhiteMode());
|
CJSON(strip.autoWhiteMode, hw_led[F("rgbwm")]);
|
||||||
|
Bus::setAutoWhiteMode(strip.autoWhiteMode);
|
||||||
strip.fixInvalidSegments(); // refreshes segment light capabilities (in case auto white mode changed)
|
strip.fixInvalidSegments(); // refreshes segment light capabilities (in case auto white mode changed)
|
||||||
CJSON(correctWB, hw_led["cct"]);
|
CJSON(correctWB, hw_led["cct"]);
|
||||||
CJSON(cctFromRgb, hw_led[F("cr")]);
|
CJSON(cctFromRgb, hw_led[F("cr")]);
|
||||||
@ -579,7 +580,7 @@ void serializeConfig() {
|
|||||||
hw_led[F("cr")] = cctFromRgb;
|
hw_led[F("cr")] = cctFromRgb;
|
||||||
hw_led[F("cb")] = strip.cctBlending;
|
hw_led[F("cb")] = strip.cctBlending;
|
||||||
hw_led["fps"] = strip.getTargetFps();
|
hw_led["fps"] = strip.getTargetFps();
|
||||||
hw_led[F("rgbwm")] = Bus::getAutoWhiteMode();
|
hw_led[F("rgbwm")] = strip.autoWhiteMode;
|
||||||
|
|
||||||
JsonArray hw_led_ins = hw_led.createNestedArray("ins");
|
JsonArray hw_led_ins = hw_led.createNestedArray("ins");
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ void changeColor(uint32_t c, int16_t cct=-1)
|
|||||||
bool isCCT = GET_BIT(capabilities, 2);
|
bool isCCT = GET_BIT(capabilities, 2);
|
||||||
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
||||||
if (hasW) mask |= 0xFF000000; // white
|
if (hasW) mask |= 0xFF000000; // white
|
||||||
if (hasW && (Bus::getAutoWhiteMode() == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
|
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
|
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
|
||||||
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
||||||
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
||||||
@ -242,7 +242,7 @@ void changeColor(uint32_t c, int16_t cct=-1)
|
|||||||
bool isCCT = GET_BIT(capabilities, 2);
|
bool isCCT = GET_BIT(capabilities, 2);
|
||||||
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
||||||
if (hasW) mask |= 0xFF000000; // white
|
if (hasW) mask |= 0xFF000000; // white
|
||||||
if (hasW && (Bus::getAutoWhiteMode() == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
|
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
|
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
|
||||||
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
||||||
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
||||||
|
@ -497,15 +497,6 @@ void serializeInfo(JsonObject root)
|
|||||||
|
|
||||||
JsonObject leds = root.createNestedObject("leds");
|
JsonObject leds = root.createNestedObject("leds");
|
||||||
leds[F("count")] = strip.getLengthTotal();
|
leds[F("count")] = strip.getLengthTotal();
|
||||||
leds[F("rgbw")] = strip.hasRGBWBus(); //deprecated, use info.leds.lc
|
|
||||||
leds[F("wv")] = false; //deprecated, use info.leds.lc
|
|
||||||
leds["cct"] = correctWB || strip.hasCCTBus(); //deprecated, use info.leds.lc
|
|
||||||
switch (Bus::getAutoWhiteMode()) {
|
|
||||||
case RGBW_MODE_MANUAL_ONLY:
|
|
||||||
case RGBW_MODE_DUAL:
|
|
||||||
if (strip.hasWhiteChannel()) leds[F("wv")] = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
leds[F("pwr")] = strip.currentMilliamps;
|
leds[F("pwr")] = strip.currentMilliamps;
|
||||||
leds["fps"] = strip.getFps();
|
leds["fps"] = strip.getFps();
|
||||||
@ -524,6 +515,10 @@ void serializeInfo(JsonObject root)
|
|||||||
|
|
||||||
leds["lc"] = totalLC;
|
leds["lc"] = totalLC;
|
||||||
|
|
||||||
|
leds[F("rgbw")] = strip.hasRGBWBus(); // deprecated, use info.leds.lc
|
||||||
|
leds[F("wv")] = totalLC & 0x02; // deprecated, true if white slider should be displayed for any segment
|
||||||
|
leds["cct"] = totalLC & 0x04; // deprecated, use info.leds.lc
|
||||||
|
|
||||||
root[F("str")] = syncToggleReceive;
|
root[F("str")] = syncToggleReceive;
|
||||||
|
|
||||||
root[F("name")] = serverDescription;
|
root[F("name")] = serverDescription;
|
||||||
|
@ -86,7 +86,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
cctFromRgb = request->hasArg(F("CR"));
|
cctFromRgb = request->hasArg(F("CR"));
|
||||||
strip.cctBlending = request->arg(F("CB")).toInt();
|
strip.cctBlending = request->arg(F("CB")).toInt();
|
||||||
Bus::setCCTBlend(strip.cctBlending);
|
Bus::setCCTBlend(strip.cctBlending);
|
||||||
Bus::setAutoWhiteMode(request->arg(F("AW")).toInt());
|
strip.autoWhiteMode = (request->arg(F("AW")).toInt());
|
||||||
|
Bus::setAutoWhiteMode(strip.autoWhiteMode);
|
||||||
strip.setTargetFps(request->arg(F("FR")).toInt());
|
strip.setTargetFps(request->arg(F("FR")).toInt());
|
||||||
|
|
||||||
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
|
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2203061
|
#define VERSION 2203080
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
@ -384,7 +384,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappend('c',SET_F("CR"),cctFromRgb);
|
sappend('c',SET_F("CR"),cctFromRgb);
|
||||||
sappend('v',SET_F("CB"),strip.cctBlending);
|
sappend('v',SET_F("CB"),strip.cctBlending);
|
||||||
sappend('v',SET_F("FR"),strip.getTargetFps());
|
sappend('v',SET_F("FR"),strip.getTargetFps());
|
||||||
sappend('v',SET_F("AW"),Bus::getAutoWhiteMode());
|
sappend('v',SET_F("AW"),strip.autoWhiteMode);
|
||||||
|
|
||||||
for (uint8_t s=0; s < busses.getNumBusses(); s++) {
|
for (uint8_t s=0; s < busses.getNumBusses(); s++) {
|
||||||
Bus* bus = busses.getBus(s);
|
Bus* bus = busses.getBus(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user