Update!
Hey folks! I have completed the stepper control updates. The code has been completely rewritten. Here are the primary improvements:
Three stepper control devices:
cone_stepper(relative spin),spout_stepper(absolute arc), andboth_steppersfor synchronized motion.both_steppershas the motors start in the same Arduino loop tick so the cone/spout choreography stays tightly locked.Motion-complete events from firmware: The legacy firmware only ack’d when commands hit its queue, with no way to know when a move actually finished. The new firmware emits
cone_motion_complete/spout_motion_completewhen AccelStepper reports the motor stopped.One
move_completeper synchronized move: Aboth_steppersmove fires one event once both moves finish, so recipe step transitions stay clean.Per-motor busy tracking with cross-stepper safety: Solo cone or spout commands during a
both_steppersmove get rejected with a clear "stepper busy" message. No stray command can de-sync a choreographed pour.Async-first transport: New
ArduinoTransportuses asyncio plus a new custom CmdMessenger codec instead of the unmaintainedPyCmdMessengerlib we used previously.E-stop integrated:
force_stopsendspause_steppersto the firmware and motors halt in place, with move targets preserved. The firmware suppresses motion complete events while paused so a halted move can't act as a real completion.Cleaner protocol: Dropped the redundant
directionfield, the sign ofstepsorposition_degreescarries directional information. Newhomeaction for spout zeroing. Rules are enforced at the dispatcher level with clearinvalid_commandmessages instead of wonky firmware errors.Per-stepper speed bounds in
hardware.toml: Out of range speeds are rejected with named limits, matching the pump’s pattern.30 new unit tests: ArduinoTransport, stepper devices (including cross-device busy and concurrency), dispatcher validation for the new fields, and settings parsing. All of them can be run on your dev machine with no pi hardware running.
Now that this is wrapped I will be releasing this refactored Operator in the next week or so. This week I will have new demos out running the updated code. I’m like 50/50 on DECAF being completed this week as well.
Ok, that is all for now, look forward to sharing more this weekend.
Cheers!