Skip to content

Servomotor v0.10.1 — fixes a sketch freeze on an interrupted reply

Choose a tag to compare

@tomrodinger tomrodinger released this 30 Jul 08:03
· 2 commits to main since this release

Upgrade if you have ever seen a sketch stop responding

A reply from the motor that starts but never finishes could hang your sketch forever — no
timeout, no error, no error code. The call simply never returned.

That happens whenever the motor begins answering and is then cut off:

  • two motors sharing an alias answering at once (a bus collision)
  • a motor rebooting part-way through its reply
  • noise on an RS485 pair without bias resistors

Fixed. Such a reply now times out normally, returning -1
(COMMUNICATION_ERROR_TIMEOUT) after about one second, like any other communication failure.

A second, quieter bug fixed alongside it

The leftover bytes of the abandoned reply used to stay in the receive buffer and then be read as the
beginning of the next reply. So one interrupted answer caused two failures: the real one, and
a spurious -7 (bad first byte) on a following command that was itself perfectly fine. Those
leftovers are now discarded.

Behaviour is unchanged when nothing goes wrong.

Also in this release

  • goToClosedLoop() no longer claims it can raise fatal error 22 on M17. That current-sensor
    baseline check exists only on M1, M2 and M23; the M17 firmware performs none, so
    ERROR_CURRENT_SENSOR_FAILED cannot occur there.
  • The README example now compiles. It used the class name ServoMotor, which belongs to a
    different, unrelated library — the class is Servomotor. The sample debug output has also been
    replaced with what the library actually prints, and a short section on checking getError()
    added.
  • The Trapezoid Move example now checks getError() after every call. No command method returns
    a success flag, and a motor that has latched a fatal error silently ignores everything afterwards
    — so an unchecked sketch just stops moving, with no symptom to see.

Verified

63 of 63 on-device test modules (1042 assertions) against a real M17 driven from an ESP32-S3, plus a
dedicated regression test that reproduces the truncated reply deterministically and would have
caught this bug.

No API changes — a drop-in upgrade from v0.10.0.