diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-11-12 11:41:41 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-11-12 17:32:18 -0500 |
commit | bfb34e07017248268474281dc6678a8d141458ad (patch) | |
tree | 70ea938b8c9686bf3909e4b4a5c1499058af218d /klippy/kinematics/cartesian.py | |
parent | f50e054bd069a0e7ae9455dfa5ddfc6894c4789e (diff) | |
download | kutter-bfb34e07017248268474281dc6678a8d141458ad.tar.gz kutter-bfb34e07017248268474281dc6678a8d141458ad.tar.xz kutter-bfb34e07017248268474281dc6678a8d141458ad.zip |
stepper_enable: Move motor_off() logic to stepper_enable.py
Directly disable all the stepper motors on a global motor_off() from
the StepperEnable() class in stepper_enable.py. This simplifies the
toolhead and kinematic classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/kinematics/cartesian.py')
-rw-r--r-- | klippy/kinematics/cartesian.py | 9 |
1 files changed, 3 insertions, 6 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') |