perf(comdelay): DIVIDER=0 passes comStatus straight through (TX-done-paced downlink) - #475
Draft
Mikefly123 wants to merge 1 commit into
Draft
perf(comdelay): DIVIDER=0 passes comStatus straight through (TX-done-paced downlink)#475Mikefly123 wants to merge 1 commit into
Mikefly123 wants to merge 1 commit into
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 25, 2026
Problem: file downlink over the USP LoRa radio is throughput-capped by ComDelay. comStatusIn_handler only latched the radio's comStatus, and run_handler (10 Hz via rateGroup10Hz -> downlinkDelay.run) released at most one status per tick even with DIVIDER=0, quantizing the whole downlink to ~10 frames/s (~2 kB/s at 248 B frames) regardless of air rate. Mechanism/fix: when DIVIDER == 0, comStatusIn_handler now forwards the status to comStatusOut immediately instead of latching it, so ComQueue is paced purely by radio TX-done. DIVIDER > 0 keeps the existing latched/tick-paced behavior unchanged. Coherence: in passthrough mode the valid flag is never set, so a status can't also be emitted by run_handler (no duplication); a status latched under DIVIDER > 0 before a runtime switch to 0 is still consumed by run_handler's compare_exchange (no loss). ComDelay is passive, so the forward runs on the radio-side caller thread; that is safe because comStatusOut feeds ComQueue's async input (enqueue only). A grep-able image-currency marker string is included. HWIL A/B on the v5e + GRC-USP bench (P4_GFSK_75K both ends, radio-only downlink path, 178,704 B FileDownlink SendFile, SendStarted->FileSent): - baseline (latched, DIVIDER=0): 90.19 s = 1981 B/s (matches the ~105 s / 200 kB manual measurement) - passthrough: 69.75 s = 2562 B/s and 71.47 s = 2500 B/s (~1.28x) - received files byte-identical to baseline (same cksum); no QueueOverflow storms, no panics/wedges; DIVIDER=9 still tick-paces (~0.8 frame/s observed); profile sweep + NO_OP commanding unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mikefly123
added a commit
that referenced
this pull request
Jul 31, 2026
Adds the passthrough test cases that belong with perf/comdelay-divider0-passthrough (#475), mirroring the coverage intended by closed PR #478: - divider-0 forwards immediately (both SUCCESS and FAILURE values) without ever setting the latch, so run ticks cannot double-emit - divider 0 -> N runtime transition latches/tick-paces again - N -> 0 transition with a status already latched neither loses the latched status nor double-emits it (exactly one tick emission) - invalid DIVIDER parameter falls back to the nonzero default and therefore latches, never passthroughs Kept as a separate commit so the extraction/refactor layer diff of this branch stays reviewable on its own. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mikefly123
force-pushed
the
perf/comdelay-divider0-passthrough
branch
from
July 31, 2026 03:07
3f89a2a to
e6d22bc
Compare
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.
Problem
File downlink over the USP LoRa radio is throughput-capped by ComDelay:
comStatusIn_handleronly latchesm_last_status, andrun_handler(10 Hz viarateGroup10Hz -> downlinkDelay.run, topology.fpp:233) releases at most one comStatus per tick even whenDIVIDER=0— a ~10 frames/s ceiling (~2 kB/s at 248 B frames) regardless of air rate.Fix
DIVIDER == 0-> forwardcomStatusIntocomStatusOutimmediately (TX-done-paced, no rate-group quantization).DIVIDER > 0-> existing latched/tick-paced behavior unchanged.Coherence: in passthrough mode the valid flag is never set, so a status cannot also be emitted by
run_handler(no double emit). A status latched underDIVIDER > 0before a runtime switch to 0 is still consumed byrun_handler'scompare_exchange(no loss). ComDelay is passive, so the forward executes on the radio-side caller thread — safe becausecomStatusOutfeeds ComQueue's async input (enqueue only). A grep-able image-currency marker string is included (comdelay-div0-passthrough-20260723).No existing ComDelay UT harness in the repo (CMakeLists UT block is the commented template), so no UT was added per scope; behavior was bench-validated instead.
HWIL A/B (2026-07-23, v5e flight + GRC-USP ground, P4_GFSK_75K both ends)
Radio-only downlink path (
downlinkRepeater.CHANNEL_ENABLED=[DISABLED,ENABLED,ENABLED],downlinkDelay.DIVIDER=0), 178,704 B file viaFileDownlink.SendFile, timed SendStarted->FileSent; flashed image currency verified by reading the marker string back from board flash (0x100b3b87).~1.28x speedup; the link is now air-rate/TX-done-limited instead of tick-limited. Received files byte-identical to baseline (identical cksum). No QueueOverflow storms (baseline itself showed one benign ComCcsdsLora QueueOverflow; passthrough runs showed none), no panics/wedges/reboots. Cycle-slip warnings rose 42 -> ~200 per run (warnings only, known under RF+TM load). Regression checks on the passthrough image:
DIVIDER=9still tick-paces (~0.8 frame/s observed on a 3 kB partial), profile sweep P1->P2->P3->P4 + NO_OP all green.🤖 Generated with Claude Code
Stack note (2026-07-30): rebased onto post-#477
feat/usp-radio(patch-collapse; now atc6df588), resolving the stale base. This PR is now the bottom of a native GitHub stack:feat/usp-radio<- #475 <- #479. The passthrough unit-test coverage lives in #479 (which stacks on this branch and ports the passthrough intoComDelayLogic).