extruder: Add new SYNC_EXTRUDER_MOTION command

This command is a rename of SYNC_STEPPER_TO_EXTRUDER.  This change is
in preparation for the removal of SYNC_STEPPER_TO_EXTRUDER.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-01-29 19:45:40 -05:00
parent 9ec9742484
commit 2af8c5aa86
3 changed files with 24 additions and 6 deletions

View File

@ -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 calibration with filament before use. If 'DISTANCE' value is not
included command will return current rotation distance. included command will return current rotation distance.
#### SYNC_EXTRUDER_MOTION
`SYNC_EXTRUDER_MOTION EXTRUDER=<name> MOTION_QUEUE=<name>`: 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
`SET_EXTRUDER_STEP_DISTANCE EXTRUDER=<config_name> `SET_EXTRUDER_STEP_DISTANCE EXTRUDER=<config_name>
[DISTANCE=<distance>]`: Set a new value for the provided extruder's [DISTANCE=<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. included command will return current step distance.
#### SYNC_STEPPER_TO_EXTRUDER #### SYNC_STEPPER_TO_EXTRUDER
`SYNC_STEPPER_TO_EXTRUDER STEPPER=<name> [EXTRUDER=<name>]`: This `SYNC_STEPPER_TO_EXTRUDER STEPPER=<name> EXTRUDER=<name>`: This
command will cause the given extruder STEPPER (as specified in an command will cause the given extruder STEPPER (as specified in an
[extruder](Config_Reference#extruder) or [extruder](Config_Reference#extruder) or
[extruder stepper](Config_Reference#extruder_stepper) config section) [extruder stepper](Config_Reference#extruder_stepper) config section)

View File

@ -31,6 +31,9 @@ class ExtruderStepper:
gcode.register_mux_command("SET_EXTRUDER_ROTATION_DISTANCE", "EXTRUDER", gcode.register_mux_command("SET_EXTRUDER_ROTATION_DISTANCE", "EXTRUDER",
self.name, self.cmd_SET_E_ROTATION_DISTANCE, self.name, self.cmd_SET_E_ROTATION_DISTANCE,
desc=self.cmd_SET_E_ROTATION_DISTANCE_help) 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", gcode.register_mux_command("SET_EXTRUDER_STEP_DISTANCE", "EXTRUDER",
self.name, self.cmd_SET_E_STEP_DISTANCE, self.name, self.cmd_SET_E_STEP_DISTANCE,
desc=self.cmd_SET_E_STEP_DISTANCE_help) desc=self.cmd_SET_E_STEP_DISTANCE_help)
@ -111,6 +114,11 @@ class ExtruderStepper:
rotation_dist = -rotation_dist rotation_dist = -rotation_dist
gcmd.respond_info("Extruder '%s' rotation distance set to %0.6f" gcmd.respond_info("Extruder '%s' rotation distance set to %0.6f"
% (self.name, rotation_dist)) % (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" cmd_SET_E_STEP_DISTANCE_help = "Set extruder step distance"
def cmd_SET_E_STEP_DISTANCE(self, gcmd): def cmd_SET_E_STEP_DISTANCE(self, gcmd):
step_dist = gcmd.get_float('DISTANCE', None, above=0.) step_dist = gcmd.get_float('DISTANCE', None, above=0.)

View File

@ -21,20 +21,20 @@ SET_EXTRUDER_ROTATION_DISTANCE EXTRUDER=extruder DISTANCE=-33.1
G1 X30 Y30 E8.2 G1 X30 Y30 E8.2
# Disable extruder stepper motor # Disable extruder stepper motor
SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER= SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE=
G1 X35 Y35 E8.5 G1 X35 Y35 E8.5
# Disable my_extra_stepper stepper motor # 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 G1 X40 Y40 E9.0
# Enable extruder stepper motor # 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 G1 X45 Y45 E9.5
# Switch to just my_extra_stepper stepper motor # Switch to just my_extra_stepper stepper motor
SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER= SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE=
SYNC_STEPPER_TO_EXTRUDER STEPPER=my_extra_stepper EXTRUDER=extruder SYNC_EXTRUDER_MOTION EXTRUDER=my_extra_stepper MOTION_QUEUE=extruder
G1 X50 Y50 E10.0 G1 X50 Y50 E10.0
# Test pressure advance move # Test pressure advance move