bdwidth_status: keep a bdwidth USB dropout from shutting down Klipper

bdwidth reads its CH340 from a reactor timer without error handling, so
"write failed: [Errno 5] Input/output error" shut down Klipper mid print.
bdwidth_status now wraps the sensor's Read_bdwidth (bdwidth.py itself
unchanged): on a USB error it closes the port, reports once and returns
False, so bdwidth retries every 10 s; the port is reopened when the
device is back. New status fields usb_ok and usb_errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-12 18:03:18 +02:00
1 parent eb7e0d4482
commit e4d2230a57
3 files changed
+57 -1

No files matched your search

+1 -1
View File
@@ -50,7 +50,7 @@ everything below, grouped by topic. Comment out what you do not use there.
| File | For |
|---|---|
| `xy_drift.py` | `AFC_XY_SAFETY_CHECK`: measures lost XY steps from the stepper step counts at the endstop triggers (CoreXY). The toolhead position after homing cannot show lost steps. |
| `bdwidth_status.py` | exposes bdwidth's motion counter and width to macros |
| `bdwidth_status.py` | exposes bdwidth's motion counter and width to macros, and keeps a USB dropout of bdwidth (port: usb) from shutting down Klipper: the read is retried every 10 s and the port reopened |
| `bdpressure_check.py` | bd_pressure load check (`BDP_CHECK_START/STOP/QUERY`). Needs the load-check firmware from the bd_pressure `load-check-extension` branch; on stock firmware it reports "not available" and does nothing. |
### Scripts (`scripts/`)