Offer the simulator one input per metric, not one per source - #26
Merged
Conversation
Pre-existing on main — the button's attributes sit on one over-long line and `oxfmt --check` has been failing on it, which is why CI is red here too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLHPEnYV5UMkne4WBTCk5s
The firmware answers eight different source ids out of `steps` alone, and the panel listed all of them: a face with a steps ring showed a "Steps" field, a "Steps goal" field, and three more inputs (0x26, 0x49, 0x6c) that all stand for the same number — with whichever was typed last silently winning, since idValue reads an override before anything else. The grid is now built from the metrics the open document actually reads, with its goal beside it: Combo drops from eleven fields to three, Steps / Steps goal / Battery. The per-id inputs are still there — they are the only way to drive two widgets on one metric apart, or to pin a hand — but folded into a <details> that says how many are set, so an override can't shadow a field unnoticed. Which metric each id reads was implicit in idValue's switch and duplicated as hint strings in the panel; it is now the ID_METRIC table, which idValue reads for every source that is a plain passthrough (the derived ones — distance's km/mi, integer and fraction splits — still compute in the switch, and are listed so the panel can group them). A test asserts the two agree, per id. Also: the /max hint was the WIDGET's declared max, not the metric's range, which is why the panel offered "day of month /60". It reads "max 60" now, with a title saying whose max it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLHPEnYV5UMkne4WBTCk5s
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.
The Simulator panel listed one input per data source, and the firmware answers many ids out of one
metric —
stepsalone covers eight (0x19, 0x25, 0x26, 0x49, 0x6a, 0x6c, 0x6f, 0x82, allNumber(sim.steps)inidValue). So Combo showed a Steps field, a Steps goal field, andthree more inputs —
steps (slot) (0x26),(0x49),(0x6c)— for the same number. Worse, a valuetyped in one of those wins over the field above (
idValuereadssim.overrides[id]first) withnothing in the UI saying so.
On top of that the grid was a fixed list of eleven metrics regardless of the document: Combo has no
AQI, temperature or distance widget and got fields for all three.
After
The grid is derived from what the open document reads, each metric with its goal beside it. Combo
goes from eleven fields to three:
per-source overridesThe per-id inputs are still there — they are the only way to drive two widgets on one metric apart,
or to pin a hand — but inside a
<details>whose summary counts how many are set, so a shadowingoverride is visible instead of silent.
Where the mapping lives
Which metric an id reads was implicit in
idValue's switch and duplicated as hint strings in thepanel (
"0x19, 0x26, 0x49, 0x6a, 0x6c"). It is now theID_METRICtable, whichidValueitselfreads for every source that is a plain passthrough; the derived ones (distance's km/mi, integer and
fraction splits) still compute in the switch and are listed only so the panel can group them.
tests/sim-sources.test.tsasserts per id that the two agree — each mapped id must move when, andonly when, the metric the panel files it under moves.
Also
/maxwas the widget's declared max (meta.max— a hand's 60 positions, a number's digit cap),not the metric's range, which is why the panel offered "day of month /60". It reads
max 60now, with a title saying whose max it is.
Verification
pnpm check0 errors,pnpm lintclean,oxfmt --checkclean, 185 tests pass (24 new). Checked ina real browser against Combo: three fields, the fold opens to the nine sources, typing 999 into
steps (slot) (0x26)flips the summary to "per-source overrides — 1 set".(The first commit is the same
format:checkfix as #25 —frame-thumb.svelteis unformatted onmain, so CI is red there for both branches until either lands.)
🤖 Generated with Claude Code
https://claude.ai/code/session_01QLHPEnYV5UMkne4WBTCk5s