Skip to content

fix(settings): put the launch ladder inside what a car can actually pull - #159

Merged
PurpleSentinel merged 1 commit into
mainfrom
fix/launch-sensitivity-scale
Aug 20, 2026
Merged

PurpleSentinel merged 1 commit into
mainfrom
fix/launch-sensitivity-scale

Conversation

@PurpleSentinel

Copy link
Copy Markdown
Contributor

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:

0, 0.50, 1.00, 1.25, 1.50, 1.75, 2.00, 2.50, 3.50, 4.00   (g)

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 MANUAL is how you decline it.

Stored settings are snapped, not rejected

This is the part that matters. valid_launch_sensitivity whitelists exact values, so a stored
2.50 g under 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_sensitivity maps every old value onto the new ladder. Zero maps to the
default, 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_full was still restored afterwards — a non-default value that a reset to
defaults 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 the
encoders refuse to produce one is itself reassuring, but it does leave the seam untested.

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>
@PurpleSentinel
PurpleSentinel merged commit 6c0ab48 into main Aug 20, 2026
3 checks passed
@PurpleSentinel
PurpleSentinel deleted the fix/launch-sensitivity-scale branch August 20, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LAUNCH sensitivity ladder cannot be reached as forward acceleration

2 participants