diff --git a/wled00/const.h b/wled00/const.h index 421747a4..ee675536 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -71,6 +71,7 @@ #define DMX_MODE_EFFECT 3 //trigger standalone effects of WLED (11 channels) #define DMX_MODE_MULTIPLE_RGB 4 //every LED is addressed with its own RGB (ledCount * 3 channels) #define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels) +#define DMX_MODE_MULTIPLE_RGBW 6 //every LED is addressed with its own RGBW (ledCount * 4 channels) //Light capability byte (unused) 0bRRCCTTTT //bits 0/1/2/3: specifies a type of LED driver. A single "driver" may have different chip models but must have the same protocol/behavior diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 89030c3c..bd34c75f 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -64,6 +64,7 @@ DMX mode: +
E1.31 info
Timeout: ms
diff --git a/wled00/e131.cpp b/wled00/e131.cpp index b4252d34..58d63779 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -1,6 +1,7 @@ #include "wled.h" -#define MAX_LEDS_PER_UNIVERSE 170 +#define MAX_3_CH_LEDS_PER_UNIVERSE 170 +#define MAX_4_CH_LEDS_PER_UNIVERSE 128 #define MAX_CHANNELS_PER_UNIVERSE 512 /* @@ -161,8 +162,12 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ case DMX_MODE_MULTIPLE_DRGB: case DMX_MODE_MULTIPLE_RGB: + case DMX_MODE_MULTIPLE_RGBW: { realtimeLock(realtimeTimeoutMs, mde); + bool is4Chan = (DMXMode == DMX_MODE_MULTIPLE_RGBW); + const uint16_t dmxChannelsPerLed = is4Chan ? 4 : 3; + const uint16_t ledsPerUniverse = is4Chan ? MAX_4_CH_LEDS_PER_UNIVERSE : MAX_3_CH_LEDS_PER_UNIVERSE; if (realtimeOverride) return; uint16_t previousLeds, dmxOffset; if (previousUniverses == 0) { @@ -176,12 +181,18 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ } else { // All subsequent universes start at the first channel. dmxOffset = (protocol == P_ARTNET) ? 0 : 1; - uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / 3; - previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * MAX_LEDS_PER_UNIVERSE; + uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / dmxChannelsPerLed; + previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * ledsPerUniverse; } - uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / 3; - for (uint16_t i = previousLeds; i < ledsTotal; i++) { - setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0); + uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsPerLed; + if (!is4Chan) { + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0); + } + } else { + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); + } } break; } diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 183a9e11..23b840ca 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -238,7 +238,8 @@ type="checkbox" name="ES">
DMX start address:
DMX mode:

E1.31 info
Timeout: ms
Force max brightness:
diff --git a/wled00/set.cpp b/wled00/set.cpp index e2b8ff1b..0de8d553 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -152,7 +152,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) t = request->arg(F("DA")).toInt(); if (t >= 0 && t <= 510) DMXAddress = t; t = request->arg(F("DM")).toInt(); - if (t >= DMX_MODE_DISABLED && t <= DMX_MODE_MULTIPLE_DRGB) DMXMode = t; + if (t >= DMX_MODE_DISABLED && t <= DMX_MODE_MULTIPLE_RGBW) DMXMode = t; t = request->arg(F("ET")).toInt(); if (t > 99 && t <= 65000) realtimeTimeoutMs = t; arlsForceMaxBri = request->hasArg(F("FB"));