Skip to content

feat: Gyro Controller — Active/Inactive state, auto-lock every 5s, in-place save, drop Send Lock button #801

@SlyWombat

Description

@SlyWombat

Summary

Rework the Gyro Controller configuration UX on the Setup tab. Switch to a state-driven enable/disable model — the orchestrator only attempts to bind a gyro to its assigned mover when the controller is explicitly Active. Remove the manual "Send Lock" button; replace with automatic re-bind attempts every 5 seconds while Active+disconnected.

Configuration page UX

When the operator opens a Gyro Controller's config on the Setup tab, the page presents:

  • Enable switch at the top — toggles the controller between Active and Inactive. Default: Inactive for newly added gyros.
  • Mover assignment — picker for the moving-head fixture this gyro drives.
  • Save button — persists the current Enable + mover assignment.
  • Unassign button — clears the mover assignment without leaving the page.
  • Smoothing slider — current behaviour kept; persisted with the rest of the config.

Removed: the "Send Lock" button. The orchestrator handles lock packets automatically based on Active state (see below).

Save behaviour

After Save, the screen does not navigate away. It updates in place to show the current saved state (Active toggle position, assigned mover, smoothing value, plus a live status indicator showing whether the gyro is currently connected). The operator can adjust and re-save without re-navigating; the Enable switch / mover picker / smoothing / save / unassign buttons all stay on the page.

Active vs Inactive — orchestrator behaviour

Gyro state Connected? Lock packet behaviour Connections accepted?
Active No Send lock every 5 seconds (until connection establishes or state changes to Inactive) Yes
Active Yes No lock packets needed (connection already live) Yes (re-connect if dropped)
Inactive No No lock packets sent No
Inactive Yes Connection forcibly broken on transition to Inactive No

Active + disconnected — auto re-bind every 5 s

The orchestrator's gyro-control loop checks each Active gyro every 5 seconds. If the gyro hasn't reported in (no recent UDP traffic, claim not registered server-side, or connection dropped), the orchestrator sends a fresh lock packet to the gyro's last-known IP/hostname (or broadcasts if unknown). The gyro firmware receives the lock, registers a claim against the assigned mover, and resumes orient streaming.

Inactive — no traffic, force-disconnect

Setting the gyro to Inactive must:

  1. Stop the auto-lock-every-5s loop for that gyro immediately.
  2. Refuse any incoming connection attempt from that gyro's device ID — the orchestrator returns a "device not active" response.
  3. If a connection is already live, break it: release the mover-control claim, send a "release" packet to the gyro, and stop the engine pump's writes for that mover.

Acceptance

  1. Newly added gyro defaults to Inactive. Orchestrator sends zero lock packets to it. Powering up the device produces no claim binding.
  2. Operator toggles Enable to Active, picks a mover, clicks Save. Page does not navigate; updates in place to show saved state with Enable=Active.
  3. Within 5 seconds of save, the orchestrator's lock-loop sends a lock packet. If the device is online, claim binds and the gyro starts streaming.
  4. If the gyro is offline at save time, the orchestrator sends a lock every 5 seconds. Once the gyro powers up, it picks up the next lock and binds.
  5. Operator toggles Enable to Inactive during an active connection. Orchestrator releases the claim, sends a release packet, gyro disconnects. Subsequent gyro power-cycles do NOT result in a claim — orchestrator refuses.
  6. Operator changes the assigned mover via the picker → clicks Save → page stays put → next 5-second lock cycle binds the gyro to the new mover (releasing the old binding atomically).
  7. The Send Lock button is gone from the config page.

Implementation notes

  • The 5-second lock cadence sits in the orchestrator's main background loop (or a dedicated gyro-control thread). State change to Active starts the loop; state change to Inactive stops it.
  • "Lock packet" is the existing UDP-port-4210 binding-handshake message the gyro firmware already understands; no protocol change. Just automation of when it's sent.
  • The "device not active" refusal on Inactive is implemented at the orchestrator's UDP claim-handshake handler — same handler that processes incoming gyro connection requests.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions