stirrer: decode and report Pololu SMC status errors instead of guessing

Adds StatusError flags for the STATUS register and get_status_errors();
go() now reports if a fail-safe (safe-start violation or other error)
persists after GO instead of failing silently. _on_process uses the
same decoding to log any active error and only auto-recovers on a
safe-start violation, rather than the old narrow status & limit_status
heuristic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EU3NTwLygh8jkrnqPoHNXF
This commit is contained in:
2026-07-07 19:36:11 +02:00
co-authored by Claude Sonnet 5
parent d19f1066d1
commit a19d2504fb
2 changed files with 31 additions and 6 deletions
+5 -5
View File
@@ -75,11 +75,11 @@ class StirrerPololu1376(AStirrer):
if not self.connected:
return
try:
status = self.drv.get_variable(Varid.STATUS)
limit_status = self.drv.get_variable(Varid.STATUS_LIMIT_STATUS)
if status & 0x01 == 0x01:
if limit_status & 0x01 == 0x01:
print("Recover after motor error!")
errors = self.drv.get_status_errors()
if errors:
print(f"StirrerPololu1376: motor controller reports errors: {errors!r}")
if StatusError.SAFE_START_VIOLATION in errors:
print("Recover after safe start violation!")
self.drv.go()
except Exception as e:
print(f"StirrerPololu1376: comm error in _on_process: {e}")