trial-params gain widen (int16) + controller-run duration (arena-fw #4) - #154
trial-params gain widen (int16) + controller-run duration (arena-fw #4)#154floesche 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
|
Resolving as superseded: this PR's change landed on main in full via #155 — commit 737f7b3 there is line-for-line identical to 1f24458 here (same patch, rebased onto v0.38 with the duty byte stacked on top). GitHub couldn't auto-mark it merged because the commit object differs, but the content is 100% on main (verified by diffing the two patches). One heads-up on the duration half, @floesche: after bench testing on fw c3475fd we found controller-timed stops change trial behavior for protocols authored against host timing (the display blanks at Thanks for the wire work — closing this one; #155 carries the credit. |
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