fix: say which GPS milestone is outstanding on the status page - #129
Merged
Conversation
"FIX (time sync)" parses as a KIND of fix — a time-only, position-less one — when it meant the opposite: the position fix is good and the clock isn't ready yet. So a healthy device looked broken. That cost a bench session today, and the instinctive response to it, a power cycle, is actively harmful: it restarts the ~12.5-minute UTC decode being waited on. The line now reads "FIX ok UTC..", and line 3 names the outstanding milestone instead of leaving the user with nothing to wait for: "UTC: no date/time", then "UTC: resolving <=12m" once date and time are valid but fullyResolved is not. That second state is the slow, normal one — the leap-second parameters live in nav-message subframe 4 page 18, which repeats every ~12.5 minutes, so a clean 3D fix minutes ahead of timeValid is expected rather than a fault. The bound is worst case, not an estimate; seeing a number at all is what stops the power-cycling. Nothing is lost: the constellation readout keeps that line once the clock is locked, so the diagnostic only takes the space while there is something to diagnose. gpsData gains the two halves of timeValid so the page can tell them apart, and the three-way classification is a pure timeSyncState() in gps_status_page rather than branching in the renderer. One of its tests asserts kLocked agrees with timeValid across all four input combinations — a page claiming a lock while logging still waits would be the same confusion wearing a different hat. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESkRRtF4vRrANPL6huSgmD
Coverage — host-testable units📂 Overall coverage
📄 File coverage
|
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.
Summary
Found while bench-testing: a logger showing
Sats:10/12 HDOP:1.5andFIX (time sync)looked like it had failed to get a lock. It hadn't — it had a perfectly good position fix and was waiting on the clock.FIX (time sync)parses as a kind of fix — a time-only, position-less one, which is a real and bad u-blox state — when it meant the opposite. Worse, HDOP only renders at all whengpsData.fixis true (display_pages.ino:59), so the screen was already carrying the proof and nobody could see it. The natural response to "it's not locking" is a power cycle, which is the single most harmful thing to do here: it restarts the ~12.5-minute UTC decode being waited on.The line now reads
FIX ok UTC.., and line 3 names the milestone that's actually outstanding rather than leaving the user with nothing to wait for:validDate/validTimeyetUTC: no date/timefullyResolvedpendingUTC: resolving <=12mMode:GPS-only(as before)That middle one is the slow, normal case.
timeValidrequiresvalidDate && validTime && fullyResolved(gps_functions.ino:210), andfullyResolvedneeds the UTC/leap-second parameters decoded out of the GPS navigation message — subframe 4 page 18, which repeats every ~12.5 minutes. A clean 3D fix in under a minute followed by several more minutes of waiting is expected, not a fault, and weak signal makes it worse: tracking a satellite well enough to range off it is a far lower bar than decoding its data bits cleanly. Cold starts are the common case here too, since the SAM-M10Q has no flash and sleep is System OFF (gps_functions.ino:284-288).The
<=12mis a bound, not an estimate — most of the time it resolves much faster. Showing a number at all is what stops the power-cycling.Nothing was lost. The constellation readout keeps that line once the clock is locked, so the diagnostic only occupies space while there's something to diagnose — and
Mode:GPS-onlywas a hardcoded literal that couldn't be wrong, so trading it for live state while waiting is a strict upgrade.Type of change
Display-only. No timing, logging, or protocol behaviour changes —
timeValidis still exactlyvalidDate && validTime && fullyResolved, now derived from the two halves rather than computed separately so they can't drift.How it was verified
timeSyncStateclang-tidyclean — not run locally (CI covers it)arduino-clihereUTC: resolving <=12min the wildChecklist
CHANGELOG.mdupdated under[Unreleased]CLAUDE.mdupdated — file map entry + the ~12.5 min constanttests/Notes for reviewers
Split out of #128 (on-device course creator) so it can merge on its own — it's independent of that work and useful immediately, and #128 is still unverified on hardware. #128 currently also carries this commit; once this merges I'll rebase it out so its diff is single-concern again.
The classification is a pure
gps_status_page::timeSyncState()rather than branching in the renderer. One of its tests assertskLockedagrees withtimeValidacross all four input combinations — a page claiming a lock while log-file creation still waits would be the same confusion wearing a different hat.gpsDatagainstimeDateValid+timeResolved, withtimeValidnow derived from them. Two extra bools; no behaviour change for any existing reader.One gap I'll name rather than paper over: there's no golden fixture for the
resolvingstate specifically — the one that actually caused this. The sim'sSimPvt.fix = 1sets every validity bit at once, so producing "fix but not fully resolved" would mean extending the sim's PVT injection contract, which is documented as the WASM API v1. Not worth that surface for a three-arm switch whose classifier is exhaustively unit-tested, but nobody should assume that pixel path is locked.Related issues
Follows the diagnosis in the bench session that produced #128.
Generated by Claude Code