Repository navigation
Stop the DT indicator jumping on a well-synced rig - #915
Merged
Merged
Conversation
The clock-sync pill showed the raw arithmetic MEAN of a slot's decode DTs, re-posted on every decode pass. On a rig working stations perfectly it would announce "+2.5 s" and turn red, which reads as an unstable app. Three separate reasons it did that: - A mean has no defence against one bad decode. DT is per-station: a station transmitting late, or a marginal decode placed a couple of seconds off, carries its own large DT. Three good decodes at +0.1 s plus one at +7 s average to +1.8 s — a red "clock off" verdict produced entirely by somebody else's clock. - Every pass re-posted. A slot is decoded several times (fast, then deep and late passes that dig out the weakest signals — exactly the ones with the sloppiest DT), so the number visibly jumped several times per slot. - No slot-to-slot smoothing at all. Meanwhile the estimator that actually corrects the clock (ClockSelfSync) has always been robust — median, MAD rejection, multi-slot confirmation — so the display and the correction openly disagreed: the pill flashed "clock off" while auto-sync, reading the same decodes, correctly did nothing. New DecodeDtDisplay puts the display on the same footing: MAD-rejected median per slot, passes accumulating into their slot instead of replacing the reading, the median of the last 3 slots, and a 0.05 s publish deadband so the last digit stops twitching. A deliberate clock change (manual, GPS/NTP or self-sync) drops the window so the reading re-acquires instead of averaging across a correction. A real, sustained error is still followed within ~2 slots. Also logs "DT: raw=... shown=... n=..." once per slot, so a debug.log shows directly whether a wandering raw mean is being smoothed or a clock is genuinely drifting. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #915 +/- ##
=========================================
Coverage 41.50% 41.50%
Complexity 252 252
=========================================
Files 280 280
Lines 33973 33973
Branches 4033 4033
=========================================
Hits 14100 14100
Misses 19584 19584
Partials 289 289
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
4 tasks
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.
Why
Reported: "my Delta time indicator will say it's 2.5 seconds off or 1.5 or whatever even though it seems like it's working stations perfectly. It makes the app look unstable and bad."
It was. The clock-sync pill showed the raw arithmetic mean of a slot's decode DTs, re-posted on every decode pass:
The kicker:
ClockSelfSync, the estimator that actually corrects the clock, has always been robust (median + MAD rejection + multi-slot confirmation). So the display and the correction openly disagreed — the pill flashed "2.5 s off" while auto-sync, looking at the same decodes, correctly concluded there was nothing to do.What changed
New
DecodeDtDisplay(pure Java, next toClockSelfSync, reusing its median/MAD helpers so both paths measure the same way):A real, sustained error is still followed within ~2 slots (tested). The manual "suggested correction" in Settings → Time Sync reads the same value, so it gets steadier too.
Also logs
DT: raw=+2.31 shown=+0.12 n=5once per slot — a debug.log now shows directly whether a wandering raw mean is being smoothed or a clock is genuinely drifting.Verification
testDebugUnitTestsuite — pass.DecodeDtDisplayTestadds 12 cases, including the exact reported shape (three in-time decodes + one station 7 s late must not move the reading) and the converse (a genuine +1 s drift must still be followed).Not verified against live signals — the emulator decodes nothing and no rig/phone was attached to this machine. Worth a session on the air before merging: the
DT: raw=… shown=…lines make it easy to confirm fromdebug.log.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg