diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 50c7dbf60..c9c89e80e 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -205,14 +205,14 @@ Receive UDP realtime:

E1.31 (sACN)
Use E1.31 multicast:
E1.31 start universe:
-Reboot required. Check out LedFx!

+Reboot required. Check out LedFx!
DMX start address:
DMX mode: disabled
Single RGB (3 Channels for all LEDs: Red Green Blue)
Single DRGB (4 Channels for all LEDs: Dimmer Red Green Blue)
- Effect (11 Channels parametrizing Effects: Dimmer Effect Speed Intensity Palette PriRed PriGreen PriBlue SecRed SecGreen SecBlue)
+ Effect (11 Channels for properties: Dimmer FX Speed Intensity Palette PriR PriG PriB SecR SecG SecB)
Multiple RGB (3 Channels for each LED: Red Green Blue)
- Multiple DRGB (1+3 Channels for each LED: Dimmer Red1 Green1 Blue1 Red2 Green2 Blue2...)
+ Multiple DRGB (1+3 Channels for each LED: Dimmer R1 G1 B1 R2 G2 B2...)

Timeout: ms
Force max brightness:
Disable realtime gamma correction:
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 7d44092f0..62a082618 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -191,8 +191,6 @@ uint16_t DMXAddress; //DMX start address of fixture, a. uint8_t DMXOldDimmer = 0; //only update brightness on change uint8_t e131LastSequenceNumber = 0; //to detect packet loss bool e131Multicast = false; //multicast or unicast -IPAddress e131ClientIP; //E1.31 client IP -String e131ClientUA; //E1.31 client User Agent bool mqttEnabled = false; char mqttDeviceTopic[33] = ""; //main MQTT topic (individual per device, default is wled/mac) @@ -366,10 +364,17 @@ bool presetApplyBri = false, presetApplyCol = true, presetApplyFx = true; bool saveCurrPresetCycConf = false; //realtime -bool realtimeActive = false; +#define REALTIME_MODE_INACTIVE 0 +#define REALTIME_MODE_GENERIC 1 +#define REALTIME_MODE_UDP 2 +#define REALTIME_MODE_HYPERION 3 +#define REALTIME_MODE_E131 4 +#define REALTIME_MODE_ADALIGHT 5 +byte realtimeMode = 0; IPAddress realtimeIP = (0,0,0,0); unsigned long realtimeTimeout = 0; + //mqtt long lastMqttReconnectAttempt = 0; long lastInterfaceUpdate = 0; @@ -431,6 +436,7 @@ AsyncMqttClient* mqtt = NULL; void colorFromUint32(uint32_t,bool=false); void serveMessage(AsyncWebServerRequest*,uint16_t,String,String,byte); void handleE131Packet(e131_packet_t*, IPAddress); +void arlsLock(uint32_t,byte); void handleOverlayDraw(); #define E131_MAX_UNIVERSE_COUNT 9 @@ -531,7 +537,7 @@ void loop() { yield(); if (doReboot) reset(); - if (!realtimeActive) //block stuff if WARLS/Adalight is enabled + if (!realtimeMode) //block stuff if WARLS/Adalight is enabled { if (apActive) dnsServer.processNextRequest(); #ifndef WLED_DISABLE_OTA diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 285b9bf6d..ec4ea2a3a 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -479,6 +479,9 @@ void loadSettingsFromEEPROM(bool first) { DMXAddress = EEPROM.read(2197) + ((EEPROM.read(2198) << 8) & 0xFF00); DMXMode = EEPROM.read(2199); + } else { + DMXAddress = 1; + DMXMode = DMX_MODE_MULTIPLE_RGB; } diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 9062afebd..aac4a9be0 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -58,27 +58,25 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr) oappend(""); oappendi(presetCyclingEnabled); oappend(""); - if (realtimeActive) + if (realtimeMode) { String mesg = "Live "; - if (realtimeIP[0] == 0) + if (realtimeMode == REALTIME_MODE_E131) { mesg += "E1.31 mode "; mesg += DMXMode; - mesg += " at fixture DMX Address "; + mesg += " at DMX Address "; mesg += DMXAddress; - mesg += " from '"; - mesg += e131ClientUA; - mesg += "' ("; - mesg += e131ClientIP[0]; + mesg += " from "; + mesg += realtimeIP[0]; for (int i = 1; i < 4; i++) { mesg += "."; - mesg += e131ClientIP[i]; + mesg += realtimeIP[i]; } - mesg += ") seq="; + mesg += " seq="; mesg += e131LastSequenceNumber; - } else { + } else if (realtimeMode == REALTIME_MODE_UDP || realtimeMode == REALTIME_MODE_HYPERION) { mesg += "UDP from "; mesg += realtimeIP[0]; for (int i = 1; i < 4; i++) @@ -86,6 +84,10 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr) mesg += "."; mesg += realtimeIP[i]; } + } else if (realtimeMode == REALTIME_MODE_ADALIGHT) { + mesg += "USB Adalight"; + } else { //generic + mesg += "data"; } oappend((char*)mesg.c_str()); } else { diff --git a/wled00/wled04_file.ino b/wled00/wled04_file.ino index 155337ba0..de7523281 100644 --- a/wled00/wled04_file.ino +++ b/wled00/wled04_file.ino @@ -67,8 +67,8 @@ void handleSerial() setRealtimePixel(pixel++, red, green, blue, 0); if (--count > 0) state = AdaState::Data_Red; else { - if (!realtimeActive && bri == 0) strip.setBrightness(briLast); - arlsLock(realtimeTimeoutMs); + if (!realtimeMode && bri == 0) strip.setBrightness(briLast); + arlsLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT); strip.show(); state = AdaState::Header_A; diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index 870c5a853..ab55df28d 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -72,14 +72,14 @@ void notify(byte callMode, bool followUp=false) } -void arlsLock(uint32_t timeoutMs) +void arlsLock(uint32_t timeoutMs, byte md = REALTIME_MODE_GENERIC) { - if (!realtimeActive){ + if (!realtimeMode){ for (uint16_t i = 0; i < ledCount; i++) { strip.setPixelColor(i,0,0,0,0); } - realtimeActive = true; + realtimeMode = md; } realtimeTimeout = millis() + timeoutMs; if (timeoutMs == 255001 || timeoutMs == 65000) realtimeTimeout = UINT32_MAX; @@ -103,8 +103,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ e131LastSequenceNumber = p->sequence_number; // update status info - e131ClientIP = clientIP; - e131ClientUA = String((char *)p->source_name); + realtimeIP = clientIP; uint16_t uni = htons(p->universe); uint8_t previousUniverses = uni - e131Universe; @@ -141,7 +140,6 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ if (DMXOldDimmer != p->property_values[DMXAddress+0]) { DMXOldDimmer = p->property_values[DMXAddress+0]; bri = p->property_values[DMXAddress+0]; - strip.setBrightness(bri); } if (p->property_values[DMXAddress+1] < MODE_COUNT) effectCurrent = p->property_values[DMXAddress+ 1]; @@ -154,8 +152,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ colSec[0] = p->property_values[DMXAddress+ 8]; colSec[1] = p->property_values[DMXAddress+ 9]; colSec[2] = p->property_values[DMXAddress+10]; - fadeTransition = false; // act fast - colorUpdated(5); // don't send UDP + if (dmxChannels-DMXAddress+1 > 11) + { + col[3] = p->property_values[DMXAddress+11]; //white + colSec[3] = p->property_values[DMXAddress+12]; + } + transitionDelayTemp = 0; // act fast + colorUpdated(3); // don't send UDP return; // don't activate realtime live mode break; @@ -212,7 +215,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ break; } - arlsLock(realtimeTimeoutMs); + arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); e131NewData = true; } @@ -231,12 +234,10 @@ void handleNotifications() } //unlock strip when realtime UDP times out - if (realtimeActive && millis() > realtimeTimeout) + if (realtimeMode && millis() > realtimeTimeout) { strip.setBrightness(bri); - realtimeActive = false; - //strip.setMode(effectCurrent); - realtimeIP[0] = 0; + realtimeMode = REALTIME_MODE_INACTIVE; } //receive UDP notifications @@ -253,7 +254,7 @@ void handleNotifications() DEBUG_PRINTLN(rgbUdp.remoteIP()); uint8_t lbuf[packetSize]; rgbUdp.read(lbuf, packetSize); - arlsLock(realtimeTimeoutMs); + arlsLock(realtimeTimeoutMs, REALTIME_MODE_HYPERION); uint16_t id = 0; for (uint16_t i = 0; i < packetSize -2; i += 3) { @@ -273,7 +274,7 @@ void handleNotifications() notifierUdp.read(udpIn, packetSize); //wled notifier, block if realtime packets active - if (udpIn[0] == 0 && !realtimeActive && receiveNotifications) + if (udpIn[0] == 0 && !realtimeMode && receiveNotifications) { //ignore notification if received within a second after sending a notification ourselves if (millis() - notificationSentTime < 1000) return; @@ -340,7 +341,7 @@ void handleNotifications() realtimeTimeout = 0; return; } else { - arlsLock(udpIn[1]*1000 +1); + arlsLock(udpIn[1]*1000 +1, REALTIME_MODE_UDP); } if (udpIn[0] == 1) //warls { diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 786049a08..7aa79c167 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -33,7 +33,7 @@ void toggleOnOff() void setAllLeds() { - if (!realtimeActive || !arlsForceMaxBri) + if (!realtimeMode || !arlsForceMaxBri) { double d = briT*briMultiplier; int val = d/100; diff --git a/wled00/wled19_json.ino b/wled00/wled19_json.ino index 5f36c58b4..0a9328bad 100644 --- a/wled00/wled19_json.ino +++ b/wled00/wled19_json.ino @@ -255,7 +255,7 @@ void serializeInfo(JsonObject root) root["name"] = serverDescription; root["udpport"] = udpPort; - root["live"] = realtimeActive; + root["live"] = (bool)realtimeMode; root["fxcount"] = strip.getModeCount(); root["palcount"] = strip.getPaletteCount();