Drive manual_stepper with SYNC_EXTRUDER_MOTION

Feature request: I’d like to be able to sync any stepper, including manual_stepper's, to the extruder using the SYNC_EXTRUDER_MOTION gcode command. Currently, I can only sync steppers that are extruder_steppers.

I have not looked at the code to see if this is even possible. But then I don’t know Python so that probably wouldn’t help. xD

Is this something that could possibly be added to klipper in the future?

My use case is running a Prusa MMU2S with klipper. I’d like to sync the manual_stepper on the MMU2 to the extruder while it’s loading filament from the MMU2 to the extruder. This would allow me to stop the load once the filament sensor detects that the filament has reached the extruder.

3 Likes

I would like to have the same addon… I try to synch my ERCF Gear extruder with my main extruder to help the filament to go through the tube…

if anyone have a solution to that I’m in. I tried to do another extruder_stepper with the same pin number by duplicate_pin_override but it is not working I still have an error message.

Same here, I also need to sync a manual_stepper with the extruder motion.

I have two extra “extruder” steppers on the machine, for a pair of custom tools.

Both need homing. Either a manual_stepper should be able to sync with the extruder, or extruder steppers should be able to home.

Any hints on how this can be accomplished?

Thanks :slight_smile:

PS: there has been some discussion around this at Jubilees discord, here.

1 Like

I see a crude initial approach.

An “event” could be created after _process_moves is done sending stuff to the XYZ and E queues (see these lines in toolhead.py).

self.printer.send_event("toolhead:move_sent", self)

manual_stepper should have already registered a callback for this during startup, which would now call a modified do_move method, but passing it the current print time (see these lines at manual_stepper.py) and the other parameters.

To copy the extruder motion, the callback could be added around here, and provide the same values used in the call to trapq_append, to replicate it in manual_stepper.py (using its trapq instead of the extruder’s).

This benefits from the calculations done by the look-ahead feature (docs).


Now drifting offtopic:

To have an independent manual_stepper axis synced using this method, I imagine that to have do_move it end at the same time as the regular axis moves, the sum of accel_t, cruise_t, accel_t there should add up to the same value.

In this crudest way, there is no look-ahead, and any motion requiring it would be jerky (other than single, isolated start-stop moves). If this works, then perhaps it could do better by using the info from the look-ahead calculations (see these lines).

I stumbled on this, needing to sync Z movement with a manual stepper.

I’m leaning towards doing this though registering a new axis name:

MANUAL_STEPPER_ASSIGN_AXIS STEPPER=mystepper AXIS=A

G0 X100 A50 # Move X to 100 and the new axis A to 50.

Edit: The underlying work is likely quite nontrivial, just considering this conceptually for now.