diff --git a/docs/G-Codes.md b/docs/G-Codes.md index d52294e2..2ff7b7bf 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -311,6 +311,16 @@ result in excessive pressure between extruder and hot end. Do proper calibration with filament before use. If 'DISTANCE' value is not included command will return current rotation distance. +#### SYNC_EXTRUDER_MOTION +`SYNC_EXTRUDER_MOTION EXTRUDER= MOTION_QUEUE=`: This +command will cause the stepper specified by EXTRUDER (as defined in an +[extruder](Config_Reference#extruder) or +[extruder_stepper](Config_Reference#extruder_stepper) config section) +to become synchronized to the movement of an extruder specified by +MOTION_QUEUE (as defined in an [extruder](Config_Reference#extruder) +config section). If MOTION_QUEUE is an empty string then the stepper +will be desynchronized from all extruder movement. + #### SET_EXTRUDER_STEP_DISTANCE `SET_EXTRUDER_STEP_DISTANCE EXTRUDER= [DISTANCE=]`: Set a new value for the provided extruder's @@ -322,7 +332,7 @@ calibration with filament before use. If 'DISTANCE' value is not included command will return current step distance. #### SYNC_STEPPER_TO_EXTRUDER -`SYNC_STEPPER_TO_EXTRUDER STEPPER= [EXTRUDER=]`: This +`SYNC_STEPPER_TO_EXTRUDER STEPPER= EXTRUDER=`: This command will cause the given extruder STEPPER (as specified in an [extruder](Config_Reference#extruder) or [extruder stepper](Config_Reference#extruder_stepper) config section) diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index 2749f63c..9b98eaf8 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -31,6 +31,9 @@ class ExtruderStepper: gcode.register_mux_command("SET_EXTRUDER_ROTATION_DISTANCE", "EXTRUDER", self.name, self.cmd_SET_E_ROTATION_DISTANCE, desc=self.cmd_SET_E_ROTATION_DISTANCE_help) + gcode.register_mux_command("SYNC_EXTRUDER_MOTION", "EXTRUDER", + self.name, self.cmd_SYNC_EXTRUDER_MOTION, + desc=self.cmd_SYNC_EXTRUDER_MOTION_help) gcode.register_mux_command("SET_EXTRUDER_STEP_DISTANCE", "EXTRUDER", self.name, self.cmd_SET_E_STEP_DISTANCE, desc=self.cmd_SET_E_STEP_DISTANCE_help) @@ -111,6 +114,11 @@ class ExtruderStepper: rotation_dist = -rotation_dist gcmd.respond_info("Extruder '%s' rotation distance set to %0.6f" % (self.name, rotation_dist)) + cmd_SYNC_EXTRUDER_MOTION_help = "Set extruder stepper motion queue" + def cmd_SYNC_EXTRUDER_MOTION(self, gcmd): + ename = gcmd.get('MOTION_QUEUE') + self.sync_to_extruder(ename) + gcmd.respond_info("Extruder stepper now syncing with '%s'" % (ename,)) cmd_SET_E_STEP_DISTANCE_help = "Set extruder step distance" def cmd_SET_E_STEP_DISTANCE(self, gcmd): step_dist = gcmd.get_float('DISTANCE', None, above=0.) diff --git a/test/klippy/extruders.test b/test/klippy/extruders.test index 889d5e34..a48d2dca 100644 --- a/test/klippy/extruders.test +++ b/test/klippy/extruders.test @@ -21,20 +21,20 @@ SET_EXTRUDER_ROTATION_DISTANCE EXTRUDER=extruder DISTANCE=-33.1 G1 X30 Y30 E8.2 # Disable extruder stepper motor -SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER= +SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE= G1 X35 Y35 E8.5 # Disable my_extra_stepper stepper motor -SYNC_STEPPER_TO_EXTRUDER STEPPER=my_extra_stepper EXTRUDER= +SYNC_EXTRUDER_MOTION EXTRUDER=my_extra_stepper MOTION_QUEUE= G1 X40 Y40 E9.0 # Enable extruder stepper motor -SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER=extruder +SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE=extruder G1 X45 Y45 E9.5 # Switch to just my_extra_stepper stepper motor -SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER= -SYNC_STEPPER_TO_EXTRUDER STEPPER=my_extra_stepper EXTRUDER=extruder +SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE= +SYNC_EXTRUDER_MOTION EXTRUDER=my_extra_stepper MOTION_QUEUE=extruder G1 X50 Y50 E10.0 # Test pressure advance move