diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 960ba56b6..070121f2b 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -26,7 +26,7 @@ struct BusConfig { uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255}; BusConfig(uint8_t busType, uint8_t* ppins, uint16_t pstart, uint16_t len = 1, uint8_t pcolorOrder = COL_ORDER_GRB, bool rev = false, uint8_t skip = 0) { rgbwOverride = (bool) GET_BIT(busType,7); - type = busType & 0x7F; // bit 7 is hacked to include RGBW info (1=RGBW, 0=RGB) + type = busType & 0x7F; // bit 7 may be/is hacked to include RGBW info (1=RGBW, 0=RGB) count = len; start = pstart; colorOrder = pcolorOrder; reversed = rev; skipAmount = skip; uint8_t nPins = 1; if (type > 47) nPins = 2; @@ -93,6 +93,12 @@ class Bus { return _valid; } + static bool isRgbw(uint8_t type) { + if (type == TYPE_SK6812_RGBW || type == TYPE_TM1814) return true; + if (type > TYPE_ONOFF && type <= TYPE_ANALOG_5CH && type != TYPE_ANALOG_3CH) return true; + return false; + } + bool reversed = false; protected: @@ -119,7 +125,7 @@ class BusDigital : public Bus { reversed = bc.reversed; _skip = bc.skipAmount; //sacrificial pixels _len = bc.count + _skip; - _rgbw = bc.rgbwOverride; // RGBW override in bit 7 + _rgbw = bc.rgbwOverride || Bus::isRgbw(type); // RGBW override in bit 7 _iType = PolyBus::getI(type, _pins, nr, _rgbw); if (_iType == I_NONE) return; _busPtr = PolyBus::create(_iType, _pins, _len); @@ -440,10 +446,9 @@ class BusManager { return len; } - static bool isRgbw(uint8_t type) { - if (type == TYPE_SK6812_RGBW || type == TYPE_TM1814) return true; - if (type > TYPE_ONOFF && type <= TYPE_ANALOG_5CH && type != TYPE_ANALOG_3CH) return true; - return false; + // a workaround + static inline bool isRgbw(uint8_t type) { + return Bus::isRgbw(type); } private: diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 834deb1b7..d1fcf9fd9 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -127,8 +127,9 @@ void deserializeConfig() { uint8_t ledType = elm["type"] | TYPE_WS2812_RGB; bool reversed = elm["rev"]; //RGBW mode is enabled if at least one of the strips is RGBW - if ((bool)elm[F("rgbw")]) SET_BIT(ledType,7); else UNSET_BIT(ledType,7); // hack bit 7 to indicate RGBW (as an override if necessary) - strip.isRgbw |= (bool)elm[F("rgbw")]; //(strip.isRgbw || BusManager::isRgbw(ledType)); +// if ((bool)elm[F("rgbw")]) SET_BIT(ledType,7); else UNSET_BIT(ledType,7); // hack bit 7 to indicate RGBW (as an override if necessary) +// strip.isRgbw |= (bool)elm[F("rgbw")]; + strip.isRgbw = (strip.isRgbw || Bus::isRgbw(ledType)); s++; lC += length; BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst); diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 78182ea83..e91e15095 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -132,11 +132,11 @@ d.getElementById("ls"+n).readOnly = !(type > 31 && type < 48); // not analog d.getElementById("LC").readOnly = !(type > 31 && type < 48); // not analog if (change) { - d.getElementById("ew"+n).checked = (type == 30 || type == 31 || type == 44 || type == 45); // RGBW checkbox, TYPE_xxxx values from const.h +// d.getElementById("ew"+n).checked = (type == 30 || type == 31 || type == 44 || type == 45); // RGBW checkbox, TYPE_xxxx values from const.h d.getElementById("ls"+n).value = n+1; } - d.getElementById("ew"+n).onclick = (type > 31 && type < 48) ? (function(){return false}) : (function(){}); // prevent change for analog - isRGBW |= d.getElementById("ew"+n).checked; +// d.getElementById("ew"+n).onclick = (type > 31 && type < 48) ? (function(){return false}) : (function(){}); // prevent change for analog +// isRGBW |= d.getElementById("ew"+n).checked; d.getElementById("dig"+n).style.display = (type > 31 && type < 48) ? "none":"inline"; d.getElementById("psd"+n).innerHTML = (type > 31 && type < 48) ? "Index:":"Start:"; } @@ -255,8 +255,8 @@ Color Order: