trial-params gain widen (int16) + controller-run duration (arena-fw #4)#154
Open
floesche wants to merge 1 commit into
Open
trial-params gain widen (int16) + controller-run duration (arena-fw #4)#154floesche wants to merge 1 commit into
floesche wants to merge 1 commit into
Conversation
…ration (arena-fw reiserlab#4) Match the firmware's canonical trial-params re-layout: gain moves after init_pos and widens to int16, and a new duration field (seconds at the JS API boundary, encoded as 10ms ticks) lets the controller auto-stop a trial on its own. - encodeTrialParams: reordered params, gain now i16le, duration converts seconds -> ticks; dropped the now-dead int8Byte helper - buildTrialParams: carries duration through from the trialParams command (same seconds convention as conditionDuration's wait/trialParams math) - hostSideTrialEnd/SWAP POINT comment untouched — host-side timing stays authoritative for now; wire-side duration just unblocks the future swap - tests: rewrote trial-params golden vectors + runner fixtures for the new offsets and widened gain range
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.
Match the firmware's canonical
trial_params(0x08) re-layout from reiserlab/LED-Display_G6_Firmware_Arena#4:gainwidens from int8 to int16 and moves afterinit_pos, and a newdurationfield lets the controller auto-stop a trial on its own instead of relying on a host follow-up command.encodeTrialParams: reordered params (init_pos@5-6,gain@7-8,duration@9-10),gainnow uses the existingi16lehelper (int8 helper dropped),durationstays in seconds at the JS API boundary and converts to 10 ms ticks on the wire (AC::constants::duration_tick_ms, matching the firmware)buildTrialParams: carriesdurationthrough from thetrialParamscommand, same convention asconditionDuration's wait/trialParams mathhostSideTrialEnd/ArenaRunner._timer/thesetTimeoutmechanism is untouched — host-side timing stays authoritative for now; the wire-side duration just unblocks that swap for later, it isn't made here (kept the blast radius small until this is bench-verified)This is a breaking wire change — bytes 5-10 of the 0x08 payload are reinterpreted — and ships in lockstep with the companion Arena-Firmware PR. A stale pairing would silently misparse gain/init_pos/duration into garbage that still returns
status == 0.Verification
pixi run test: full suite passes, including the rewritten trial-params golden vectors intests/test-arena-wire-g6.jsandtests/test-arena-runner-g6.jspixi run format-checkencodeTrialParams()'s actual output bytes to a Teensy 4.1 over serial and confirmed Mode 2 (initPos=9, gain=-20, duration=1.5s) appliesinit_poscorrectly and auto-stops to ALL_OFF on its own, and Mode 4gain=2000(past the old int8 ceiling) is acceptedTest plan
pixi run testpixi run format-checkgh4-trial-params-relayoutThis is part of the reiserlab/LED-Display_G6_Firmware_Arena#35 PR