Repository navigation
feat(ui): add a TRIGGER menu and start the session on a launch - #158
Merged
Merged
Conversation
START was the only way to begin a session. A driver leaving the pits had to press it at the right moment, which is a poor thing to ask of someone joining a circuit, and the LAUNCH setting that should have automated it was stored, editable, and read by nothing. TRIGGER sits between TRACK and SETUP, because both are set at the circuit before going out rather than buried among the rarely-touched options. MANUAL behaves as before. IMU and GPS arm the timer instead, showing the session screen with the clock held at the configured duration and PENDING where the lap estimate goes, so the driver can see the device is ready and waiting rather than wondering whether the press registered. The IMU trigger reads forward acceleration only. A launch is acceleration down the road, so braking, cornering and kerb strikes cannot start a session; a test asserts that -3 g does not fire. GravityCalibration already returns exactly this, gravity removed and resolved into vehicle axes, with the attitude tracking keeping it honest under body roll. TRIGGER owns pit_exit_auto_start_enabled rather than sitting beside it. That setting already meant "start when the car leaves the pits", with tested automation behind it, so GPS derives it and the boolean leaves the device settings list. Offering one behaviour in two places invites the two disagreeing, which is the rule Mode established. pit_entry_auto_stop_enabled is untouched: ending a session is a different question. A trigger that cannot fire is worse than no trigger, because the device simply sits there. LAUNCH at zero means off, so IMU refuses to arm and says so; GPS refuses because no receiver exists. Both report rather than waiting silently. Arming lives in the router. A pending session is one that has not been started yet, so SessionController needs no new state and stays as tested. A double tap disarms, the same gesture that ends a session and ends a rest period. Also fixes two things found on the way. Section menus opened on their first item rather than the one in force, so returning to TRIGGER showed MANUAL however IMU was set - and the same was true of Mode and Track, which the carousel title partly hid for Mode by showing the live value beside the wrong highlight. The value level already resolved its current entry and called select_value; the section level had no equivalent to call. Tracks are matched by identifier rather than a remembered position, since the catalog is rebuilt from the card at boot. Separately, the menu carousel was passed a count of four against five entries, so Diagnostics was selectable by the shell and never drawn; a static_assert now ties the array to the shell's count. Settings reach v6 for the trigger. Everything before it predates the trigger, so migrating defaults to MANUAL, which is what those devices were doing. Closes #155 Closes #157 Co-Authored-By: Claude Opus 5 (1M context) <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 #155. Closes #157.
What it does
TRIGGER sits between TRACK and SETUP — both are set at the circuit before going out, rather
than buried among the rarely-touched options.
The
LAUNCHsetting was stored, editable, and read by nothing. It now has a purpose.Forward acceleration only
A launch is acceleration down the road, so braking, cornering and kerb strikes cannot start a
session — there's a test asserting −3 g does not fire.
GravityCalibration::resolvealready returns exactly this, gravity removed and resolved into vehicle axes, with the
attitude tracking from #143 keeping it honest under body roll.
TRIGGER owns pit-exit auto-start
pit_exit_auto_start_enabledalready meant "start when the car leaves the pits", with testedautomation behind it. GPS derives it, and the boolean leaves the device settings list —
offering one behaviour in two places invites the two disagreeing, the rule Mode set in #132.
The tested automation is reused unchanged; the trigger is simply the only thing that writes
it now.
pit_entry_auto_stop_enabledis untouched: ending a session is a different question.A trigger that cannot fire is worse than no trigger
The device would just sit there. LAUNCH at zero means off, so IMU refuses to arm and says
SET LAUNCH G TO ARM; GPS refuses withGPS UNAVAILABLE. Both report rather than waitingsilently. Confirmed on the panel.
Two defects found on the way
Section menus opened on their first item. Returning to TRIGGER showed MANUAL however IMU
was set — and the same was true of Mode and Track, which the carousel title partly hid for
Mode by showing the live value beside the wrong highlight. The value level already resolved
its current entry and called
select_value; the section level had no equivalent to call.Tracks match by identifier, not a remembered position, since the catalog is rebuilt from
the card at boot.
The menu carousel was passed a count of 4 against 5 entries, so Diagnostics was selectable
by the shell and never drawn. Pre-existing; adding TRIGGER would have made it worse. A
static_assertnow ties the array tokMenuItemCount.Design notes
Arming lives in the router. A pending session is one that has not been started yet, so
SessionControllerneeds no new state and stays as tested. Double tap disarms — the samegesture that ends a session and ends a rest period.
Settings reach v6. Everything before it predates the trigger, so migrating defaults to
MANUAL, which is what those devices were doing.
Verification
36 host suites and 70 simulator tests, with a new suite covering the ownership of pit-exit
auto-start, every refusal-to-arm case, and forward-only launch detection including the braking
and zero-threshold cases.
Confirmed on the panel end to end: the refusal at LAUNCH 0, arming after setting it, a real
launch starting the session, double tap disarming, and GPS reporting no receiver.
Follow-up
#156: as forward acceleration a car reaches roughly 0.3–1.0 G, but the LAUNCH ladder runs
0, 0.5, 1.0, 1.25 … 4.0, so six of ten choices can never fire and the useful region below
0.5 G is not offered. Not changed here because
valid_launch_sensitivitywhitelists exactvalues, so a new ladder invalidates stored settings and resets everything — it needs a
migration of its own.