feat(console): analog-input calibration UI (two-point, deadband) + wire 0xA5/0xA6/0xA7 + ai_cal (S2) — Studio v0.75 - #191
Open
mbreiser wants to merge 2 commits into
Open
Conversation
…o-point, deadband, clear, read) + wire 0xA5/0xA6/0xA7 + ai_cal capability (S2) — Studio v0.75
Studio half S2 of docs/development/analog-input-plan.md § 4. Stacked on S1
(feat/console-analog-in). Pairs with firmware F2 (feat/ai-calibration).
- js/arena-wire-g6.js: OPCODES SET_ANALOG_CAL 0xA5 / GET_ANALOG_CAL 0xA6 /
GET_ANALOG_IN_RAW 0xA7; ANALOG_CAL_ACTIONS {sampleGround 0, sampleOpen 1,
setDeadband 2, clear 0xFF}; encodeSetAnalogCal(ch, action, mv) with range
checks, encodeGetAnalogCal, encodeGetAnalogInRaw; decodeAnalogCal (18-byte
record -> {version, adcBits, source, sdMirrorOk, channels[{valid, rawOpen,
rawGnd, deadbandMv, gainMvPerCount, offsetMv}]}), decodeAnalogInRaw;
CAPABILITY_BITS bit 6 'ai_cal'. Tests 186 -> 204.
- js/studio-analog-in.js: nominalMv, calLine, calMv, calStepsText,
describeCalSource, calTableRows.
- arena_studio.html: "calibrate" row in the Analog In panel — channel select,
Read (0xA6 + 0xA7 -> table with both points, mV/count, offset, deadband, live
raw on the calibrated and nominal scales), "1 · Sample +10 V (open)",
"2 · Sample 0 V (ground cap)", deadband Set, Clear (confirm). Writes are
advanced-only (SAFE_BLOCKED_CMDS) and gated on the ai_cal capability; every
write is logged to the Console and to the bridge run log (event analog_cal),
and refreshes the 0xA4 flags text. Warns when the +10 V point reads low
(BNC not open / un-reworked board). HELP text updated; footer v0.75.
- tests/test-studio-analog-in.js 105 -> 148: calibration math + wiring incl.
the safe-mode set (writes blocked, read allowed) and the ai_cal gate.
- Release notes v0.75.
Not bench-tested (no hardware). Browser check offline: panel renders, handlers
wired; the real two-point flow needs a board with ai_cal firmware.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… 0xA5 get-analog-in-raw, 0xA6 set-analog-cal, 0xA7 get-analog-cal (matches firmware feat/ai-calibration) Co-Authored-By: Claude Fable 5.1 <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.
Studio half S2 of docs/development/analog-input-plan.md § 4. Stacks on S1 (#190) — retarget to
mainas #190 merges. Pairs with firmware F2 (reiserlab/LED-Display_G6_Firmware_Arena branchfeat/ai-calibration); without that firmware the panel says "needs ai_cal firmware" and the calibration controls do nothing.What changed (Studio v0.75)
Analog In panel → calibrate row
calibrated (both points)/+10 V point ✓ · 0 V point —/no points), the two raw points, mV per count and offset, deadband, and the live raw count evaluated on the calibrated and the nominal scale so the effect of the calibration is visible.SAFE_BLOCKED_CMDS; Read stays available), gated on theai_calcapability, logged to the Console and to the bridge run log (event: 'analog_cal'with the returned record), and they refresh the panel's flags text.Wire (
js/arena-wire-g6.js):GET_ANALOG_IN_RAW0xA5 /SET_ANALOG_CAL0xA6 /GET_ANALOG_CAL0xA7,ANALOG_CAL_ACTIONS,encodeSetAnalogCal(ch, action, mv)with range checks,decodeAnalogCal(18-byte record → channels with the implied linea/b),decodeAnalogInRaw, capability bit 6ai_cal.Module (
js/studio-analog-in.js):nominalMv,calLine,calMv,calStepsText,describeCalSource,calTableRows.Tests
tests/test-arena-wire-g6.js186 → 204: encoders (names and codes, deadband bytes), rejections (ch 3, unknown action, deadband range/type), record decode (header, valid channel line a/b, invalid channel, short payload), raw decode, capability name.tests/test-studio-analog-in.js105 → 148: nominal/calibrated math, step text, source text, table rows with and without live raws; HTML wiring — element ids, all five handlers, the safe-mode set blocks the four writes and not the read, theai_calgate, theanalog_callog event, the clear confirmation, footer v0.75.pixi run testpasses; touched JS Prettier-clean; inline Studio scripts parse.🤖 Generated with Claude Code