diff --git a/klippy/cartesian.py b/klippy/cartesian.py index de6eb1df..362ba555 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -6,8 +6,6 @@ import logging import stepper, homing, chelper -StepList = (0, 1, 2) - class CartKinematics: def __init__(self, toolhead, config): self.printer = config.get_printer() @@ -111,14 +109,14 @@ class CartKinematics: self.need_motor_enable = True def _check_motor_enable(self, print_time, move): need_motor_enable = False - for i in StepList: + for i, rail in enumerate(self.rails): if move.axes_d[i]: - self.rails[i].motor_enable(print_time, 1) - need_motor_enable |= not self.rails[i].is_motor_enabled() + rail.motor_enable(print_time, 1) + need_motor_enable |= not rail.is_motor_enabled() self.need_motor_enable = need_motor_enable def _check_endstops(self, move): end_pos = move.end_pos - for i in StepList: + for i in (0, 1, 2): if (move.axes_d[i] and (end_pos[i] < self.limits[i][0] or end_pos[i] > self.limits[i][1])): @@ -149,9 +147,9 @@ class CartKinematics: move.start_pos[0], move.start_pos[1], move.start_pos[2], move.axes_d[0], move.axes_d[1], move.axes_d[2], move.start_v, move.cruise_v, move.accel) - for i in StepList: + for i, rail in enumerate(self.rails): if move.axes_d[i]: - self.rails[i].step_itersolve(self.cmove) + rail.step_itersolve(self.cmove) # Dual carriage support def _activate_carriage(self, carriage): toolhead = self.printer.lookup_object('toolhead')