diff --git a/wled00/wled00.ino b/wled00/wled00.ino index ae57bef2..9b97af75 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -58,7 +58,7 @@ //version code in format yymmddb (b = daily build) -#define VERSION 1810271 +#define VERSION 1810311 char versionString[] = "0.8.1"; diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index 7f03b403..c4ed2622 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -76,6 +76,27 @@ void initE131(){ } } +void handleE131(){ + //E1.31 protocol support + if(e131Enabled) { + uint16_t len = e131->parsePacket(); + if (!len || e131->universe < e131Universe || e131->universe > e131Universe +4) return; + len /= 3; //one LED is 3 DMX channels + + uint16_t multipacketOffset = (e131->universe - e131Universe)*170; //if more than 170 LEDs (510 channels), client will send in next higher universe + if (ledCount <= multipacketOffset) return; + + arlsLock(realtimeTimeoutMs); + if (len + multipacketOffset > ledCount) len = ledCount - multipacketOffset; + + for (uint16_t i = 0; i < len; i++) { + int j = i * 3; + setRealtimePixel(i + multipacketOffset, e131->data[j], e131->data[j+1], e131->data[j+2], 0); + } + strip.show(); + } +} + void handleNotifications() { //send second notification if enabled @@ -83,20 +104,7 @@ void handleNotifications() notify(notificationSentCallMode,true); } - //E1.31 protocol support - if(e131Enabled) { - uint16_t len = e131->parsePacket(); - if (len && e131->universe == e131Universe) { - arlsLock(realtimeTimeoutMs); - if (len > ledCount) len = ledCount; - for (uint16_t i = 0; i < len; i++) { - int j = i * 3; - - setRealtimePixel(i, e131->data[j], e131->data[j+1], e131->data[j+2], 0); - } - strip.show(); - } - } + handleE131(); //unlock strip when realtime UDP times out if (realtimeActive && millis() > realtimeTimeout) @@ -227,9 +235,9 @@ void handleNotifications() uint16_t id = ((udpIn[3] << 0) & 0xFF) + ((udpIn[2] << 8) & 0xFF00); for (uint16_t i = 4; i < packetSize -2; i += 3) { + if (id >= ledCount) break; setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3]); - - id++; if (id >= ledCount) break; + id++; } } strip.show();