diff --git a/wled00/const.h b/wled00/const.h index 8dc1a286..d7148a57 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..af0ae770 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -185,6 +185,28 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ } break; } + case DMX_MODE_MULTIPLE_RGBW: //Implementation of RGBW leds + { + const byte dmxChannelsperLed=4; //4 DMX Channels/Led + const byte ledsPerUniverse=128; //Max.128 leds/Universe + realtimeLock(realtimeTimeoutMs, mde); + if (realtimeOverride) return; + uint16_t previousLeds, dmxOffset; + if (previousUniverses == 0) { + if (dmxChannels-DMXAddress < 1) return; + dmxOffset = DMXAddress; + previousLeds = 0; + } else{ + dmxOffset = (protocol == P_ARTNET) ? 0 : 1; + uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / dmxChannelsperLed; + previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * ledsPerUniverse; // Max leds/universe is only 128 with 4 Ch./led + } + uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsperLed; + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); + } + break; + } default: DEBUG_PRINTLN(F("unknown E1.31 DMX mode")); return; // nothing to do diff --git a/wled00/set.cpp b/wled00/set.cpp index 96e0b85f..2e9eff3a 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")); diff --git a/wled00/wled.h b/wled00/wled.h index e2add60b..61ff6a38 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -262,7 +262,7 @@ WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this #endif WLED_GLOBAL uint16_t e131Universe _INIT(1); // settings for E1.31 (sACN) protocol (only DMX_MODE_MULTIPLE_* can span over consequtive universes) WLED_GLOBAL uint16_t e131Port _INIT(5568); // DMX in port. E1.31 default is 5568, Art-Net is 6454 -WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGB); // DMX mode (s.a.) +WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGBW-1); // DMX mode (s.a.) WLED_GLOBAL uint16_t DMXAddress _INIT(1); // DMX start address of fixture, a.k.a. first Channel [for E1.31 (sACN) protocol] WLED_GLOBAL byte DMXOldDimmer _INIT(0); // only update brightness on change WLED_GLOBAL byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; // to detect packet loss