|
ControlWidget._write() called dev.write_channel() directly on the GUI
thread from Qt signal handlers — for CML (CoolMuscle), write() does 2-3
blocking serial round-trips, and a slider fires valueChanged on every drag
tick, so each tick froze the whole app until the device responded or timed
out. Replaced with a coalescing background dispatch: writes are keyed by
(device, channel) in a dict instead of a plain FIFO queue, so re-writing
the same channel while a write is still pending updates its value in place
rather than piling up — a strict FIFO was observed backing up 30+ deep
during a single drag, meaning the motor kept "moving" to seconds-old
positions long after the slider stopped, which looked like a freeze even
once off the GUI thread.
Separately, the motor never actually moved because it was never enabled:
per docs/CM1-C_ASCII_Command_Cheatsheet.md, a CM1-C motor stays disabled
("shaft free") until sent "(", and nothing in CMLLayer.write()'s VS/MA
handling ever sent it — enable only existed as a separate M1_ME channel
the generic MotorControl widget has no concept of. VS/MA now send enable
unconditionally before the move sequence (a no-op if already enabled).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|