Fix DDP fragmentation: add multi-packet handling and data offset support - #38
Open
andrewjswan wants to merge 1 commit into
Open
Fix DDP fragmentation: add multi-packet handling and data offset support#38andrewjswan wants to merge 1 commit into
andrewjswan wants to merge 1 commit into
Conversation
- Implement DDP data offset handling in DDPComponent::process_ to support fragmented multi-packet UDP streams. - Update virtual signature of LightEffect::process_ to accept LED offset parameter. - Refactor DDPAddressableLightEffect to map color payloads using incoming packet offset and optimize LED index calculation by replacing division with increment. - Fix single bulb DDPLightEffect to drop non-zero offset packets to prevent memory corruption in chained setups. - Add hardware state clearing to DDPAddressableLightEffect::start() to prevent erratic LED flashing on effect activation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves an issue where addressable LED strips with more than 480 pixels stop rendering after the first 480 LEDs. It addresses the bug where incoming fragmented DDP packets with a non-zero data offset were either ignored or caused memory mapping corruption.
Changes
ddp.cpp: Extracted 32-bitdata_offsetfrom DDP header bytes 4-7, converted byte offset to LED index, and passed it down to the effect processing chain.ddp_light_effect_base.h: Modified interface definition ofprocess_()method to support an optionaloffsetparameter defaulting to 0.ddp_addressable_light_effect.cpp:(i - used) / 3division inside the performance-critical loop with a fast pointer-styletarget_led++increment.breakstatement to prevent hardware buffer out-of-bounds access.ddp_light_effect.cpp: Added an early exit rule for packets whereoffset > 0to ensure single-bulb components ignore stream fragments meant for addressable strip installations.Verification
"Ignoring DDP Packet with non-zero data offset".