extruder: Support disassociating a stepper from all extruders

Support SYNC_STEPPER_TO_EXTRUDER commands with an EXTRUDER parameter
set to an empty string.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-01-11 18:13:21 -05:00
parent eb2a67cb95
commit 02d5f9754f
4 changed files with 40 additions and 5 deletions

View File

@ -1835,8 +1835,9 @@ more information.
```
[extruder_stepper my_extra_stepper]
#extruder: extruder
# The extruder this stepper is synchronized to. The default is
# "extruder".
# The extruder this stepper is synchronized to. If this is set to an
# empty string then the stepper will not be synchronized to an
# extruder. The default is "extruder".
#step_pin:
#dir_pin:
#enable_pin:

View File

@ -186,7 +186,9 @@ The following standard commands are supported:
command will cause the given extruder STEPPER (as specified in an
[extruder](Config_Reference#extruder) or
[extruder stepper](Config_Reference#extruder_stepper) config
section) to become synchronized to the given EXTRUDER.
section) to become synchronized to the given EXTRUDER. If EXTRUDER
is an empty string then the stepper will not be synchronized to an
extruder.
- `SET_STEPPER_ENABLE STEPPER=<config_name> ENABLE=[0|1]`: Enable or
disable only the given stepper. This is a diagnostic and debugging
tool and must be used with care. Disabling an axis motor does not

View File

@ -44,12 +44,15 @@ class ExtruderStepper:
mcu_pos = self.stepper.get_past_mcu_position(print_time)
return self.stepper.mcu_to_commanded_position(mcu_pos)
def sync_to_extruder(self, extruder_name):
toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation()
if not extruder_name:
self.stepper.set_trapq(None)
return
extruder = self.printer.lookup_object(extruder_name, None)
if extruder is None or not isinstance(extruder, PrinterExtruder):
raise self.printer.command_error("'%s' is not a valid extruder."
% (extruder_name,))
toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation()
self.stepper.set_position([extruder.last_position, 0., 0.])
self.stepper.set_trapq(extruder.get_trapq())
def _set_pressure_advance(self, pressure_advance, smooth_time):

View File

@ -15,3 +15,32 @@ G1 X25 Y25 E7.5
# Update step_distance
SET_EXTRUDER_STEP_DISTANCE EXTRUDER=extruder DISTANCE=.005
G1 X30 Y30 E8.0
# Disable extruder stepper motor
SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER=
G1 X35 Y35 E8.5
# Disable my_extra_stepper stepper motor
SYNC_STEPPER_TO_EXTRUDER STEPPER=my_extra_stepper EXTRUDER=
G1 X40 Y40 E9.0
# Enable extruder stepper motor
SYNC_STEPPER_TO_EXTRUDER STEPPER=extruder EXTRUDER=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
G1 X50 Y50 E10.0
# Test pressure advance move
SET_PRESSURE_ADVANCE EXTRUDER=my_extra_stepper ADVANCE=0.020
G1 X55 Y55 E0
G1 X55 Y55 E0.5
G1 X60 Y60 E1.1
G1 X50 Y50
SET_PRESSURE_ADVANCE EXTRUDER=extruder ADVANCE=0.025
G1 X55 Y55 E1.5
G1 X50 Y50
G1 X55 Y55 E2.0
G1 X50 Y50