diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index 5e688df2..6c8ce598 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -104,6 +104,11 @@ void WS2812FX::setColor(uint8_t r, uint8_t g, uint8_t b) { setColor(((uint32_t)r << 16) | ((uint32_t)g << 8) | b); } + +void WS2812FX::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { + setColor(((uint32_t)w << 24)|((uint32_t)r << 16) | ((uint32_t)g << 8) | b); +} + void WS2812FX::setColor(uint32_t c) { _color = c; _mode_color = _color; @@ -1686,6 +1691,13 @@ void WS2812FX::setPixelColor(uint16_t i, uint32_t c) NeoPixelBrightnessBus::SetPixelColor(i, RgbColor((c>>16) & 0xFF, (c>>8) & 0xFF, (c) & 0xFF)); } +void WS2812FX::setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b, uint8_t w) +{ + #ifdef RGBW + + NeoPixelBrightnessBus::SetPixelColor(i, RgbColor(r,g,b)); +} + void WS2812FX::setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b) { NeoPixelBrightnessBus::SetPixelColor(i, RgbColor(r,g,b)); diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index 1e41cd73..9e7a65ca 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -103,13 +103,19 @@ #define FX_MODE_DUAL_COLOR_WIPE_OUT_IN 51 #define FX_MODE_CIRCUS_COMBUSTUS 52 +#ifdef RGBW +class WS2812FX : public NeoPixelBrightnessBus { +#else class WS2812FX : public NeoPixelBrightnessBus { - +#endif typedef void (WS2812FX::*mode_ptr)(void); public: - +#ifdef RGBW + WS2812FX(uint16_t n) : NeoPixelBrightnessBus(n) { +#else WS2812FX(uint16_t n) : NeoPixelBrightnessBus(n) { +#endif _mode[FX_MODE_STATIC] = &WS2812FX::mode_static; _mode[FX_MODE_BLINK] = &WS2812FX::mode_blink; _mode[FX_MODE_BREATH] = &WS2812FX::mode_breath; @@ -242,6 +248,7 @@ class WS2812FX : public NeoPixelBrightnessBus"; resp = resp + effectSpeed; - resp = resp + ""; - resp = resp + ""; + resp = resp + ""; + if (rgbwEnabled) {resp = resp + whiteVal;} + else {resp = resp + "-1";} + resp = resp + ""; resp = resp + useHSB; resp = resp + ""; resp = resp + serverDescription; diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index c4d0bd41..1894940f 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -25,6 +25,7 @@ void notify(uint8_t callMode) udpOut[7] = nightlightDelayMins; udpOut[8] = effectCurrent; udpOut[9] = effectSpeed; + udpOut[10] = whiteVal; IPAddress broadcastIp; broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP(); @@ -46,6 +47,7 @@ void handleNotifications() col[0] = udpIn[3]; col[1] = udpIn[4]; col[2] = udpIn[5]; + whiteVal = udpIn[10]; if (udpIn[8] != effectCurrent) { effectCurrent = udpIn[8];