From 8e5f2d91e80d697c6db602c261560644e4bd7722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Fri, 11 Mar 2022 12:20:48 +0100 Subject: [PATCH] Added hasRGB() and hasWhite() methods to Bus class --- wled00/bus_manager.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index baabf394..34a09dde 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -166,6 +166,15 @@ class Bus { if (type > TYPE_ONOFF && type <= TYPE_ANALOG_5CH && type != TYPE_ANALOG_3CH) return true; return false; } + virtual bool hasRGB() { + if (_type == TYPE_WS2812_1CH || _type == TYPE_WS2812_WWA || _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ONOFF) return false; + return true; + } + virtual bool hasWhite() { + if (_type == TYPE_SK6812_RGBW || _type == TYPE_TM1814 || _type == TYPE_WS2812_1CH || _type == TYPE_WS2812_WWA || + _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ANALOG_4CH || _type == TYPE_ANALOG_5CH) return true; + return false; + } static void setCCT(uint16_t cct) { _cct = cct; } @@ -510,6 +519,9 @@ class BusNetwork : public Bus { _valid = true; }; + bool hasRGB() { return true; } + bool hasWhite() { return _rgbw; } + void setPixelColor(uint16_t pix, uint32_t c) { if (!_valid || pix >= _len) return; if (isRgbw()) c = autoWhiteCalc(c);