Skip to content

fix(runner): disarm FicTrac closed-loop apply at sequence start, end and abort (v0.71) - #177

Merged
mbreiser merged 1 commit into
mainfrom
fix/runner-reset-fictrac-apply
Sep 4, 2026
Merged

fix(runner): disarm FicTrac closed-loop apply at sequence start, end and abort (v0.71)#177
mbreiser merged 1 commit into
mainfrom
fix/runner-reset-fictrac-apply

Conversation

@mbreiser

@mbreiser mbreiser commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Diagnosed from a rig log today (rig03-sr, run 8u5v10jg): 304 SET_FRAME_POSITION (0x70) commands were rejected with firmware status 1 during the first 3 s — the Mode-2 start_bg step — before the runner emitted its first fictracApply true at 3.02 s. The bridge's closed-loop apply flag had been left on (Console use or an earlier aborted run), and the shared apply gate (stepperLoaded || session.running) opens the moment a run starts, so FicTrac frames flowed into a non-Mode-3 step. Harmless to the data, but hundreds of error lines in the Studio log.

(The run's later abort at step 33 was a separate controller/USB stall — 12 s of unanswered commands then a trial-params timeout — not addressed here; the same protocol completed on re-run.)

Change

js/arena-runner-g6.js: new private _disarmClosedLoop() (idempotent, guarded, never throws) called

  • in runSequence() right after _abort = false — before the first step,
  • in the sequence finally block — sequence end or abort,
  • in _clear()abort() / involuntary disconnect.

Protocol timing and data are unchanged; the protocol's own startClosedLoop/stopClosedLoop still toggle apply as before.

Tests

  • Existing closed-loop test now expects [false, true, false, false] (start disarm, protocol on/off, end disarm).
  • New: stale apply=true is cleared before the first controller send; abort mid-closed-loop leaves apply off.
  • pixi run test green (runner suite 235/235). Studio footer → v0.71 + release-notes entry.

🤖 Generated with Claude Code

…and abort (Studio v0.71)

A stale bridge apply=true (left on by Console closed-loop use or a run that
aborted mid-trial) leaked into the next run: the shared apply gate opens as
soon as session.running is set, so FicTrac frames were pushed into the opening
Mode-2 step and the firmware rejected every SET_FRAME_POSITION (0x70) with
status 1 — 304 error lines in the first 3 s of rig03-sr run 8u5v10jg
(2026-09-04). Harmless to the data, but it floods the Studio log and confuses
operators.

ArenaRunner gains a private _disarmClosedLoop() (idempotent, never throws)
called from runSequence() before the first step, from its finally block, and
from _clear() (abort()/disconnect). Existing closed-loop test updated for the
two safety falses; two new regression tests: stale apply is cleared BEFORE the
first controller send, and an abort mid-closed-loop leaves apply off.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mbreiser
mbreiser merged commit 00092b7 into main Sep 4, 2026
3 checks passed
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.

1 participant