Skip to content

Journal Bluetooth bench motor state changes - #59

Merged
mcroomp merged 1 commit into
mainfrom
motor-journal
Nov 18, 2026
Merged

mcroomp merged 1 commit into
mainfrom
motor-journal

Conversation

@mcroomp

@mcroomp mcroomp commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

The Bluetooth bench motor bypassed the journal, so motor activity was missing from experiment mavlog.json files and from linkhub query. The motor controller now journals its own state changes as diagnostics (source linkhub.motor, category motor) on the same timeline as MAVLink traffic.

Events:

  • motor.connected: device, device_id
  • motor.command: device_id, speed_percent, direction, timeout_ms. Only when a command starts the motor or changes its target or direction; lease renewals that keep the same target are not journaled, to avoid flooding the journal every 500 ms.
  • motor.stop_requested: reason = request | command_expired | disconnect
  • motor.stopped: the ramp reached zero and the safe-stop command was written
  • motor.disconnected: device, error (warning level if the disconnect failed)
  • motor.error: Bluetooth failure leaving motor state unconfirmed (error level)

Journaling happens inside the controller rather than the HTTP routes, so it also captures stops triggered by an expired command lease (the watchdog), by a disconnect or shutdown, and by Bluetooth write failures.

This is independent of #58.

Testing: new test journals_state_changes_but_not_lease_renewals; cargo test --workspace and cargo fmt --check pass. Not exercised against a physical motor.

The motor controller now journals connect, commanded speed/direction
changes, stop requests (with reason: request, command_expired,
disconnect), completed stops, disconnects and Bluetooth errors as
linkhub.motor diagnostics, so they share the MAVLink timeline and land in
experiment mavlog.json files. Lease renewals that keep the same target are
not journaled.
@mcroomp
mcroomp merged commit 9c52a30 into main Nov 18, 2026
13 checks passed
@mcroomp
mcroomp deleted the motor-journal branch November 18, 2026 11:16
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