From 62f845a94e7f84b1e2525c18ac3c9f5c0ae63010 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Mon, 18 Mar 2024 19:46:33 -0400 Subject: [PATCH] DDP: Support sources that don't push If the source never sends the push flag, WLED buffers the update but never publishes it to the LEDs. This causes the confusing case where the peek display shows one thing but the LEDs themselves something else. Add a static flag that tracks if we've seen a push from the source; until we do, apply every update as soon as it's received, per the DDP specification. --- wled00/e131.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index ec2efb50e..a67a672c2 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -11,6 +11,7 @@ //DDP protocol support, called by handleE131Packet //handles RGB data only void handleDDPPacket(e131_packet_t* p) { + static bool ddpSeenPush = false; // have we seen a push yet? int lastPushSeq = e131LastSequenceNumber[0]; //reject late packets belonging to previous frame (assuming 4 packets max. before push) @@ -34,6 +35,7 @@ void handleDDPPacket(e131_packet_t* p) { uint16_t c = 0; if (p->flags & DDP_TIMECODE_FLAG) c = 4; //packet has timecode flag, we do not support it, but data starts 4 bytes later + if (realtimeMode != REALTIME_MODE_DDP) ddpSeenPush = false; // just starting, no push yet realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP); if (!realtimeOverride || (realtimeMode && useMainSegmentOnly)) { @@ -44,7 +46,8 @@ void handleDDPPacket(e131_packet_t* p) { } bool push = p->flags & DDP_PUSH_FLAG; - if (push) { + ddpSeenPush |= push; + if (!ddpSeenPush || push) { // if we've never seen a push, or this is one, render display e131NewData = true; byte sn = p->sequenceNum & 0xF; if (sn) e131LastSequenceNumber[0] = sn;