From 336af2f28db0031974dcba3bb06c63374e1207ad Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 28 Mar 2020 09:56:07 -0400 Subject: [PATCH] stepper: No need to pass stepper_kinematics to set_step_dist() Also, no need to log in stepper.py as the update is already logged in extruder.py. Signed-off-by: Kevin O'Connor --- klippy/kinematics/extruder.py | 10 +++++----- klippy/stepper.py | 5 ++--- test/klippy/extruders.test | 4 ++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index f0264e1e..6e3e917d 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -194,14 +194,14 @@ class PrinterExtruder: toolhead = self.printer.lookup_object('toolhead') if 'DISTANCE' not in params: step_dist = self.stepper.get_step_dist() - gcode.respond_info("%s E step distance: %f" % (self.name, step_dist)) + gcode.respond_info("Extruder '%s' step distance is %0.6f" + % (self.name, step_dist)) return dist = gcode.get_float('DISTANCE', params, 0.) toolhead.flush_step_generation() - self.stepper.set_step_dist(self.sk_extruder, dist) - step_dist = self.stepper.get_step_dist() - gcode.respond_info("%s E step distance set: %f" % - (self.name, step_dist)) + self.stepper.set_step_dist(dist) + gcode.respond_info("Extruder '%s' step distance set to %0.6f" + % (self.name, dist)) cmd_ACTIVATE_EXTRUDER_help = "Change the active extruder" def cmd_ACTIVATE_EXTRUDER(self, params): gcode = self.printer.lookup_object('gcode') diff --git a/klippy/stepper.py b/klippy/stepper.py index bbe57ca5..5cf4ee4f 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -94,10 +94,9 @@ class MCU_stepper: return self._oid def get_step_dist(self): return self._step_dist - def set_step_dist(self, sk, dist): + def set_step_dist(self, dist): self._step_dist = dist - self.set_stepper_kinematics(sk) - logging.info("%s manually set to =%.6f", (self._name, dist)) + self.set_stepper_kinematics(self._stepper_kinematics) def is_dir_inverted(self): return self._invert_dir def calc_position_from_coord(self, coord): diff --git a/test/klippy/extruders.test b/test/klippy/extruders.test index 034b0559..22dc6ab5 100644 --- a/test/klippy/extruders.test +++ b/test/klippy/extruders.test @@ -11,3 +11,7 @@ G1 E7 G28 G1 X20 Y20 Z1 G1 X25 Y25 E7.5 + +# Update step_distance +SET_EXTRUDER_STEP_DISTANCE EXTRUDER=extruder DISTANCE=.005 +G1 X30 Y30 E8.0