Skip to content

Name the motor a failed sync read stopped at; release 1.12.0 - #153

Merged
pierre-rouanet merged 2 commits into
developfrom
fast-sync-read-names-the-block
Oct 13, 2026
Merged

pierre-rouanet merged 2 commits into
developfrom
fast-sync-read-names-the-block

Conversation

@pierre-rouanet

@pierre-rouanet pierre-rouanet commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

A sync read asks every motor at once, and its error said only that the bus failed. On a bus of fifteen servos, that means checking every cable instead of one.

A failed sync read now returns SyncReadError { id, cause }, reached with downcast_ref and printed as motor 4: Timeout error.

  • Plain sync read: id is the motor whose own status packet did not come back.
  • Fast sync read: id is the first motor whose block in the combined packet is not there as asked. That covers a block that is missing, cut short, out of order (Incorrect id) or failing its running CRC. The packet is no longer read with read_exact, which threw away the bytes that arrived before a timeout; those bytes show where the packet stopped. If nothing at all comes back, the error names the first motor, because the header goes out with its block.

A motor behind a gap that answers in the missing motor's slot still has a valid CRC, since its CRC covers what it heard on the bus. The ID check catches it, so the error still names the missing motor. A test covers this case.

Behaviour change: a fast sync read that times out now reports CommunicationErrorKind::TimeoutError as the cause. It used to return the port's io::Error. Any other I/O error from the port is still returned unchanged, without a motor ID, because it is the port's fault and not a motor's.

Limit: the motors after the named one are not known to be fine. A cable that breaks at that motor silences everything past it as well.

Motivation: microduck's robotd reports "motor bus: N read failures running" with no way to say which servo. This is the first step toward reporting that.

Release: the second commit bumps the version to 1.12.0 and turns the Unreleased changelog section into the 1.12.0 notes, which also cover the STS3036 entry (#150). Tagging v1.12.0 after the merge publishes it to crates.io and PyPI.

🤖 Generated with Claude Code

A sync read asks every motor at once, and its error said the bus failed
without saying where. The error is now a `SyncReadError { id, cause }`.

A plain sync read names the motor whose status packet did not come back.
A fast sync read names the first motor whose block is not there as
asked. The packet is now read without `read_exact`, which threw away
the bytes that arrived before a timeout -- and those bytes are what say
where the packet stopped. Missing, cut short, out of order and failing
its CRC all name that block's motor.

Assisted-by: Claude:claude-opus-5-5
Bump the crate version and turn the Unreleased changelog section into the
1.12.0 release notes: a failed sync read names the motor it stopped at
(SyncReadError), and the Feetech STS3036 is registered under the STS3215
definition (#150).

A fast sync read that times out now reports TimeoutError inside a
SyncReadError, where it used to return the port's io::Error.

Assisted-by: Claude:claude-opus-5-5
@pierre-rouanet pierre-rouanet changed the title Name the motor a failed sync read stopped at Name the motor a failed sync read stopped at; release 1.12.0 Oct 13, 2026
@pierre-rouanet
pierre-rouanet merged commit 61829b2 into develop Oct 13, 2026
15 checks passed
@pierre-rouanet
pierre-rouanet deleted the fast-sync-read-names-the-block branch October 13, 2026 13:01
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