diff options
Diffstat (limited to 'klippy/kinematics')
-rw-r--r-- | klippy/kinematics/cartesian.py | 9 | ||||
-rw-r--r-- | klippy/kinematics/corexy.py | 6 | ||||
-rw-r--r-- | klippy/kinematics/delta.py | 6 | ||||
-rw-r--r-- | klippy/kinematics/extruder.py | 4 | ||||
-rw-r--r-- | klippy/kinematics/none.py | 2 | ||||
-rw-r--r-- | klippy/kinematics/polar.py | 6 | ||||
-rw-r--r-- | klippy/kinematics/winch.py | 3 |
7 files changed, 12 insertions, 24 deletions
diff --git a/klippy/kinematics/cartesian.py b/klippy/kinematics/cartesian.py index b2176d5b..f8c50bb9 100644 --- a/klippy/kinematics/cartesian.py +++ b/klippy/kinematics/cartesian.py @@ -17,6 +17,8 @@ class CartKinematics: for s in self.get_steppers(): s.set_trapq(toolhead.get_trapq()) toolhead.register_step_generator(s.generate_steps) + self.printer.register_event_handler("stepper_enable:motor_off", + self._motor_off) # Setup boundary checks max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( @@ -84,12 +86,8 @@ class CartKinematics: self._activate_carriage(altc) else: self._home_axis(homing_state, axis, self.rails[axis]) - def motor_off(self, print_time): + def _motor_off(self, print_time): self.limits = [(1.0, -1.0)] * 3 - for rail in self.rails: - rail.motor_enable(print_time, 0) - for rail in self.dual_carriage_rails: - rail.motor_enable(print_time, 0) def _check_endstops(self, move): end_pos = move.end_pos for i in (0, 1, 2): @@ -131,7 +129,6 @@ class CartKinematics: toolhead.set_position(self.calc_position() + [extruder_pos]) if self.limits[dc_axis][0] <= self.limits[dc_axis][1]: self.limits[dc_axis] = dc_rail.get_range() - self.need_motor_enable = True cmd_SET_DUAL_CARRIAGE_help = "Set which carriage is active" def cmd_SET_DUAL_CARRIAGE(self, params): gcode = self.printer.lookup_object('gcode') diff --git a/klippy/kinematics/corexy.py b/klippy/kinematics/corexy.py index 9f9df91b..2c041a79 100644 --- a/klippy/kinematics/corexy.py +++ b/klippy/kinematics/corexy.py @@ -20,6 +20,8 @@ class CoreXYKinematics: for s in self.get_steppers(): s.set_trapq(toolhead.get_trapq()) toolhead.register_step_generator(s.generate_steps) + config.get_printer().register_event_handler("stepper_enable:motor_off", + self._motor_off) # Setup boundary checks max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( @@ -63,10 +65,8 @@ class CoreXYKinematics: forcepos[axis] += 1.5 * (position_max - hi.position_endstop) # Perform homing homing_state.home_rails([rail], forcepos, homepos) - def motor_off(self, print_time): + def _motor_off(self, print_time): self.limits = [(1.0, -1.0)] * 3 - for rail in self.rails: - rail.motor_enable(print_time, 0) def _check_endstops(self, move): end_pos = move.end_pos for i in (0, 1, 2): diff --git a/klippy/kinematics/delta.py b/klippy/kinematics/delta.py index 3bd01e8f..af3aa092 100644 --- a/klippy/kinematics/delta.py +++ b/klippy/kinematics/delta.py @@ -23,6 +23,8 @@ class DeltaKinematics: stepper_configs[2], need_position_minmax = False, default_position_endstop=a_endstop) self.rails = [rail_a, rail_b, rail_c] + config.get_printer().register_event_handler("stepper_enable:motor_off", + self._motor_off) # Setup stepper max halt velocity self.max_velocity, self.max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( @@ -105,10 +107,8 @@ class DeltaKinematics: forcepos = list(self.home_position) forcepos[2] = -1.5 * math.sqrt(max(self.arm2)-self.max_xy2) homing_state.home_rails(self.rails, forcepos, self.home_position) - def motor_off(self, print_time): + def _motor_off(self, print_time): self.limit_xy2 = -1. - for rail in self.rails: - rail.motor_enable(print_time, 0) self.need_home = True def check_move(self, move): end_pos = move.end_pos diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index 8b8476ed..2e7ae177 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -87,8 +87,6 @@ class PrinterExtruder: return self.deactivate_gcode.render() def stats(self, eventtime): return self.heater.stats(eventtime) - def motor_off(self, print_time): - self.stepper.motor_enable(print_time, 0) def check_move(self, move): move.extrude_r = move.axes_r[3] move.extrude_max_corner_v = 0. @@ -231,8 +229,6 @@ class PrinterExtruder: class DummyExtruder: def set_active(self, print_time, is_active): return 0. - def motor_off(self, move_time): - pass def check_move(self, move): raise homing.EndstopMoveError( move.end_pos, "Extrude when no extruder present") diff --git a/klippy/kinematics/none.py b/klippy/kinematics/none.py index b6f9d1ab..2250f884 100644 --- a/klippy/kinematics/none.py +++ b/klippy/kinematics/none.py @@ -15,8 +15,6 @@ class NoneKinematics: pass def home(self, homing_state): pass - def motor_off(self, print_time): - pass def check_move(self, move): pass def get_status(self): diff --git a/klippy/kinematics/polar.py b/klippy/kinematics/polar.py index 927e8401..ca2e55c7 100644 --- a/klippy/kinematics/polar.py +++ b/klippy/kinematics/polar.py @@ -21,6 +21,8 @@ class PolarKinematics: for s in self.get_steppers(): s.set_trapq(toolhead.get_trapq()) toolhead.register_step_generator(s.generate_steps) + config.get_printer().register_event_handler("stepper_enable:motor_off", + self._motor_off) # Setup boundary checks max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( @@ -82,11 +84,9 @@ class PolarKinematics: self._home_axis(homing_state, 0, self.rails[0]) if home_z: self._home_axis(homing_state, 2, self.rails[1]) - def motor_off(self, print_time): + def _motor_off(self, print_time): self.limit_z = [(1.0, -1.0)] self.limit_xy2 = -1. - for s in self.steppers: - s.motor_enable(print_time, 0) def check_move(self, move): end_pos = move.end_pos xy2 = end_pos[0]**2 + end_pos[1]**2 diff --git a/klippy/kinematics/winch.py b/klippy/kinematics/winch.py index c48648c9..32d388ad 100644 --- a/klippy/kinematics/winch.py +++ b/klippy/kinematics/winch.py @@ -42,9 +42,6 @@ class WinchKinematics: # XXX - homing not implemented homing_state.set_axes([0, 1, 2]) homing_state.set_homed_position([0., 0., 0.]) - def motor_off(self, print_time): - for s in self.steppers: - s.motor_enable(print_time, 0) def check_move(self, move): # XXX - boundary checks and speed limits not implemented pass |