From a100f174f98dc4294654da6f3145530fa05813c4 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 12 Sep 2017 12:47:40 -0400 Subject: mcu: Pass print_time directly to MCU calls Now that the print_time is always synchronized with the mcu_time, there is no longer a need to track mcu_time as a separate quantity. Eliminate references to mcu_time from the code and pass print_time directly in its place. Signed-off-by: Kevin O'Connor --- klippy/cartesian.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'klippy/cartesian.py') diff --git a/klippy/cartesian.py b/klippy/cartesian.py index 10c5b5f2..bc5ead70 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -62,16 +62,16 @@ class CartKinematics: # Set final homed position coord[axis] = s.position_endstop + s.get_homed_offset() homing_state.set_homed_position(coord) - def motor_off(self, move_time): + def motor_off(self, print_time): self.limits = [(1.0, -1.0)] * 3 for stepper in self.steppers: - stepper.motor_enable(move_time, 0) + stepper.motor_enable(print_time, 0) self.need_motor_enable = True - def _check_motor_enable(self, move_time, move): + def _check_motor_enable(self, print_time, move): need_motor_enable = False for i in StepList: if move.axes_d[i]: - self.steppers[i].motor_enable(move_time, 1) + self.steppers[i].motor_enable(print_time, 1) need_motor_enable |= self.steppers[i].need_motor_enable self.need_motor_enable = need_motor_enable def query_endstops(self, print_time): @@ -101,15 +101,15 @@ class CartKinematics: z_ratio = move.move_d / abs(move.axes_d[2]) move.limit_speed( self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) - def move(self, move_time, move): + def move(self, print_time, move): if self.need_motor_enable: - self._check_motor_enable(move_time, move) + self._check_motor_enable(print_time, move) for i in StepList: axis_d = move.axes_d[i] if not axis_d: continue mcu_stepper = self.steppers[i].mcu_stepper - mcu_time = mcu_stepper.print_to_mcu_time(move_time) + move_time = print_time start_pos = move.start_pos[i] axis_r = abs(axis_d) / move.move_d accel = move.accel * axis_r @@ -119,18 +119,18 @@ class CartKinematics: if move.accel_r: accel_d = move.accel_r * axis_d mcu_stepper.step_const( - mcu_time, start_pos, accel_d, move.start_v * axis_r, accel) + move_time, start_pos, accel_d, move.start_v * axis_r, accel) start_pos += accel_d - mcu_time += move.accel_t + move_time += move.accel_t # Cruising steps if move.cruise_r: cruise_d = move.cruise_r * axis_d mcu_stepper.step_const( - mcu_time, start_pos, cruise_d, cruise_v, 0.) + move_time, start_pos, cruise_d, cruise_v, 0.) start_pos += cruise_d - mcu_time += move.cruise_t + move_time += move.cruise_t # Deceleration steps if move.decel_r: decel_d = move.decel_r * axis_d mcu_stepper.step_const( - mcu_time, start_pos, decel_d, cruise_v, -accel) + move_time, start_pos, decel_d, cruise_v, -accel) -- cgit v1.2.3-70-g09d2