@@ -152,17 +152,18 @@ void WS2812FX::service() {
152152 _colors_t [slot] = transitions[t].currentColor (SEGMENT.colors [slot]);
153153 }
154154 if (!cctFromRgb || correctWB) busses.setSegmentCCT (_cct_t , correctWB);
155- _no_rgb = !(SEGMENT.getLightCapabilities () & 0x01 );
156155 for (uint8_t c = 0 ; c < NUM_COLORS; c++) {
157- // if segment is not RGB capable, treat RGB channels of main segment colors as if 0
158- // this prevents Dual mode with white value 0 from setting White channel from inaccessible RGB values
159- // If not RGB capable, also treat palette as if default (0), as palettes set white channel to 0
160- if (_no_rgb) _colors_t [c] = _colors_t [c] & 0xFF000000 ;
161156 _colors_t [c] = gamma32 (_colors_t [c]);
162157 }
163158 handle_palette ();
159+
160+ // if segment is not RGB capable, force None auto white mode
161+ // If not RGB capable, also treat palette as if default (0), as palettes set white channel to 0
162+ _no_rgb = !(SEGMENT.getLightCapabilities () & 0x01 );
163+ if (_no_rgb) Bus::setAutoWhiteMode (RGBW_MODE_MANUAL_ONLY);
164164 delay = (this ->*_mode[SEGMENT.mode ])(); // effect function
165165 if (SEGMENT.mode != FX_MODE_HALLOWEEN_EYES) SEGENV.call ++;
166+ Bus::setAutoWhiteMode (strip.autoWhiteMode );
166167 }
167168
168169 SEGENV.next_time = nowUp + delay;
@@ -573,21 +574,23 @@ void WS2812FX::Segment::refreshLightCapabilities() {
573574 _capabilities = 0 ; return ;
574575 }
575576 uint8_t capabilities = 0 ;
576- uint8_t awm = Bus::getAutoWhiteMode () ;
577+ uint8_t awm = instance-> autoWhiteMode ;
577578 bool whiteSlider = (awm == RGBW_MODE_DUAL || awm == RGBW_MODE_MANUAL_ONLY);
579+ bool segHasValidBus = false ;
578580
579581 for (uint8_t b = 0 ; b < busses.getNumBusses (); b++) {
580582 Bus *bus = busses.getBus (b);
581583 if (bus == nullptr || bus->getLength ()==0 ) break ;
582584 if (bus->getStart () >= stop) continue ;
583585 if (bus->getStart () + bus->getLength () <= start) continue ;
584586
587+ segHasValidBus = true ;
585588 uint8_t type = bus->getType ();
586- if (!whiteSlider || ( type != TYPE_ANALOG_1CH && (cctFromRgb || type != TYPE_ANALOG_2CH) ))
589+ if (type != TYPE_ANALOG_1CH && (cctFromRgb || type != TYPE_ANALOG_2CH))
587590 {
588- capabilities |= 0x01 ; // segment supports RGB (full color)
591+ capabilities |= 0x01 ; // segment supports RGB (full color)
589592 }
590- if (bus->isRgbw () && whiteSlider) capabilities |= 0x02 ; // segment supports white channel
593+ if (bus->isRgbw () && whiteSlider) capabilities |= 0x02 ; // segment supports white channel
591594 if (!cctFromRgb) {
592595 switch (type) {
593596 case TYPE_ANALOG_5CH:
@@ -597,6 +600,9 @@ void WS2812FX::Segment::refreshLightCapabilities() {
597600 }
598601 if (correctWB && type != TYPE_ANALOG_1CH) capabilities |= 0x04 ; // white balance correction (uses CCT slider)
599602 }
603+ // if seg has any bus, but no bus has RGB, it by definition supports white (at least for now)
604+ // In case of no RGB, disregard auto white mode and always show a white slider
605+ if (segHasValidBus && !(capabilities & 0x01 )) capabilities |= 0x02 ; // segment supports white channel
600606 _capabilities = capabilities;
601607}
602608
0 commit comments