diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 4c78b550..fd77f9e3 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -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: diff --git a/docs/G-Codes.md b/docs/G-Codes.md index 119f1fbb..6450f0ef 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -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= 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 diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index e3db152b..e3bc8916 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -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): diff --git a/test/klippy/extruders.test b/test/klippy/extruders.test index 22dc6ab5..ff7c5917 100644 --- a/test/klippy/extruders.test +++ b/test/klippy/extruders.test @@ -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