Skip to content

tools: zero_amp_offsets runs the current-amp server offset auto-zero - #1

Open
deanSLAC wants to merge 1 commit into
masterfrom
zero-amp-offsets
Open

deanSLAC wants to merge 1 commit into
masterfrom
zero-amp-offsets

Conversation

@deanSLAC

Copy link
Copy Markdown
Collaborator

Adds zero_amp_offsets (spec-write, mutating): an agent-callable wrapper around ssrl-current-amp's new Zero Offsets routine. That routine sets each SR570 input offset (I0/I1/I2/PIPS) to the smallest ladder step whose cscan box ADC reading is above +2 mV.

  • The server owns the algorithm and its guards. The new current_amp.py only POSTs /api/autozero/start, polls GET /api/autozero until the run ends, and POSTs /api/autozero/abort once wait_s has passed (default 360 s, just past the server's own 300 s limit). The server restores every offset on an error or abort.
  • The handler goes through audited_device_call: a justification is required, the safety switch is checked, and an action-log row is written before the request is sent.
  • BTH_CURRENT_AMP_URL defaults to http://192.168.41.6:8570 at BL4-1. It is unset at other stations, so the tool refuses there.
  • Pinned counts updated: MUTATING_COUNT 42 -> 43, and the tool counts in test_agent_surface.py. test_mutates.py's AST scan only looks at audited_call, so tests/test_current_amp.py checks the audited_device_call wiring for this handler.
  • Regenerated docs/tool_catalog.html. Added a CHANGELOG "Unreleased" entry (no version bump).

Full suite: 1615 passed, 5 skipped; ruff clean. A live GET /api/autozero against the BL4-1 server works. The tool has not been run on hardware.

🤖 Generated with Claude Code

ssrl-current-amp gained a Zero Offsets routine (devices/autozero.py there):
it sets each SR570's input offset to the smallest ladder step whose cscan
box ADC reading clears +2 mV, with its own guards and a restore on any
error or abort. Agents need to rerun it after gain changes, so it is now a
spec-write tool rather than a button only staff can press.

The server owns the algorithm; current_amp.py only POSTs start, polls GET
/api/autozero to the end and aborts past wait_s (the server then restores
every offset). It writes hardware outside SPEC, so the handler goes through
audited_device_call: justification, safety switch, action-log row first.

BTH_CURRENT_AMP_URL defaults to 192.168.41.6:8570 at BL4-1 and is unset
elsewhere, where the tool refuses. MUTATING_COUNT 42 -> 43 and the tool
counts in test_agent_surface.py move with it. test_mutates.py's AST scan
only reads audited_call, so test_current_amp.py checks this handler's
audited_device_call itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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