Repository navigation
fix(settings): put the launch ladder inside what a car can actually pull - #159
Merged
Merged
Conversation
The IMU trigger reads forward acceleration, which a car reaches at roughly 0.3 to 1.0 g. The ladder ran 0, 0.5, 1.0, 1.25 up to 4.0 g, so six of its ten choices could never fire, and nothing was offered below 0.5 g where a deliberate pit exit actually sits. The setting was stored and edited but read by nothing until the trigger landed, so the values had never been checked against a measurement. The new ladder spans 0.15 to 1.0 g. Zero is gone: it meant "off", which as a trigger threshold is a device that never starts a session, and TRIGGER is the on/off now. Stored settings are snapped onto the ladder rather than rejected. Refusing a value that is no longer offered would fail the whole blob and take every unrelated setting back to defaults with it, which is a far worse outcome than a threshold moving one step. Zero maps to the default rather than to the lowest value, which would be the most trigger-happy setting of all. The ladder existed in three places - the picker, the stepping editor and the validator - which is how it drifted away from anything measurable without anyone noticing. There is one definition now, and the editor's test reads it rather than restating it, so a test can no longer describe a ladder the device does not offer. Verified on the device: settings written by the previous firmware migrated in place and the selected circuit was still restored afterwards, which a reset to defaults would have lost. Closes #156 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 #156.
The scale was mostly decorative
The IMU trigger reads forward acceleration, which a car reaches at roughly 0.3 to 1.0 g.
The ladder ran:
Six of ten choices could never fire, and nothing was offered below 0.5 g, where a
deliberate pit exit actually sits. The setting was stored and editable but read by nothing
until #155 wired the trigger, so the values had never been checked against a measurement.
New ladder:
0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.50, 0.60, 0.80, 1.00, default 0.30 g.Zero is gone
It meant "off", which as a trigger threshold is a device that never starts a session. TRIGGER
is the on/off now, so the threshold is always a real value and
MANUALis how you decline it.Stored settings are snapped, not rejected
This is the part that matters.
valid_launch_sensitivitywhitelists exact values, so a stored2.50 gunder the new rules would fail validation — and validation is on the whole blob,so the device would fall back to defaults and lose every unrelated setting with it. A
threshold moving one step is a far better outcome than losing the session duration, the
selected circuit and the trigger.
nearest_launch_sensitivitymaps every old value onto the new ladder. Zero maps to thedefault, not the nearest — nearest would be 0.15 g, the most trigger-happy setting of all,
which is a poor thing to hand someone who had it switched off.
One definition instead of three
The ladder lived in the picker, the stepping editor and the validator. Three copies is how
it drifted away from anything measurable without anyone noticing. There is one now, and the
editor's test reads it rather than restating it — so a test can no longer describe a ladder
the device does not offer, which is exactly what the old test was doing.
Verification
36 host suites and 70 simulator tests. The snapping is covered directly: every old ladder value
lands on a valid new one, values above the top land on the top, nearest is checked either side,
values already on the ladder are untouched, and the ladder's own bounds are asserted against
what a car can pull.
On the device, settings written by the previous firmware migrated in place and the selected
circuit
gb_croft_fullwas still restored afterwards — a non-default value that a reset todefaults would have lost.
An honest gap in the tests
I could not build an end-to-end test that decodes a v6 blob holding an out-of-range launch
value, because every encoder validates before writing, so such a blob cannot be constructed
through the public API. The snapping is therefore unit-tested at the function and confirmed on
real stored settings on the panel, rather than driven through
decode_settings. That theencoders refuse to produce one is itself reassuring, but it does leave the seam untested.