Repository navigation
fix(ui): make Race's running-screen rule testable and drop the delta it never drew - #231
Merged
Merged
Conversation
…it never drew Issue #219 and #221 are the same road test: a Race session started on pit exit, timed laps, and showed none of them. #221 was fixed in #224, which gave Race its own screen. Three of #219's acceptance criteria were still open. The routing was the important one. Track Day withholding live lap times is a compliance rule, and the screen it draws has no lap labels anywhere in it - so the mode comparison inside the router's screen lookup was the only thing enforcing that rule, and nothing asserted it. ui::running_screen_for states it once, defaults to the screen that cannot show a lap time, and the tests pin it for every mode plus the invariant that ties the two rules together: a mode is drawn on the Race screen exactly when it is permitted lap times. Grant laps to a mode routed to TrackdayScreen and they would never appear, which is the bug this issue reported. lap_delta is now false everywhere. Race was granted it when its running screen had no lap fields at all; the screen it has shows three figures and no delta, and the reference mapping a trustworthy delta needs is still #58. A permission for something nothing draws describes a display that does not exist. The Race screen's track name is written only when it changes. The router handed it over every display tick while the armed track cannot change during a session, and lv_label_set_text invalidates whether or not the text differs - a repaint of the widest label on the screen 25 times a second, beside three lap rows already change-gated for that reason (#213). Closes #219 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #219.
#219 was already half fixed
#219 and #221 are the same road test, filed twice. #221 was closed by #224, which gave Race its own screen — so the headline complaint is fixed and on the device:
mm:ss.sssRaceScreen, nine cells;update_elapsedadvances it on every observation--:--.---before the first crossingtest_ui_foundationTrackdayScreenuntouchedlap_deltaThis closes the three.
The routing was never asserted
running_screen()compared the mode toDeviceMode::raceinside a private member ofscreen_router.cpp. That comparison is the only thing keeping a Track Day session off a screen with lap figures on it, and no test could reach it.ui::running_screen_for(DeviceMode)now states the rule in the component, and the router asks it. The default is deliberately the withholding screen: a mode added without a thought for this rule gets the one that cannot show a lap time.Four assertions, the last of them the one worth having:
Grant laps to a mode routed to
TrackdayScreenand they silently never appear — which is exactly the bug this issue reported. Route a mode without them toRaceScreenand it shows what #132 forbids. Neither can now land without failing a test.lap_delta: the flag goesRace was granted
lap_deltawhen its running screen had no lap fields at all. The screen it has now shows three figures and no delta, and #58 — the reference mapping and validity rules a delta worth trusting needs — is still open.So it is false for every mode, with a test holding it there. A permission for something nothing draws describes a display that does not exist, which is the same mistake as a plausible reading. The field stays in
ModeVisibilitybecause #58 is what flips it back.One real repaint
set_track_namewas called on every display tick, andlv_label_set_textinvalidates whether or not the text differs. The armed track cannot change during a session, so that was a repaint of the widest label on the screen 25 times a second — sitting next to three lap rows that were already change-gated for precisely that reason (#213). Same gate, same place.Verification
make check→CHECK_RC=0, including the four new assertions indevice-mode-testmake firmware-container-build→FW_RC=0, 32% of the app partition free🤖 Generated with Claude Code