From 6a96e83ea923ebd0d3a84da218afda020b8b9612 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 25 Oct 2016 19:11:05 -0400 Subject: toolhead: Store both the start and end position in the Move class Store the start position (in addition to the existing end position) in the Move class. The start position can be useful to the kinematic classes. Signed-off-by: Kevin O'Connor --- klippy/cartesian.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'klippy/cartesian.py') diff --git a/klippy/cartesian.py b/klippy/cartesian.py index 860ce9fd..60fe9976 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -67,16 +67,17 @@ class CartKinematics: def query_endstops(self, move_time): return homing.QueryEndstops(["x", "y", "z"], self.steppers) def check_endstops(self, move): + end_pos = move.end_pos for i in StepList: if (move.axes_d[i] - and (move.pos[i] < self.limits[i][0] - or move.pos[i] > self.limits[i][1])): + and (end_pos[i] < self.limits[i][0] + or end_pos[i] > self.limits[i][1])): if self.limits[i][0] > self.limits[i][1]: - raise homing.EndstopError(move.pos, "Must home axis first") - raise homing.EndstopError(move.pos) + raise homing.EndstopError(end_pos, "Must home axis first") + raise homing.EndstopError(end_pos) def check_move(self, move): limits = self.limits - xpos, ypos = move.pos[:2] + xpos, ypos = move.end_pos[:2] if (xpos < limits[0][0] or xpos > limits[0][1] or ypos < limits[1][0] or ypos > limits[1][1]): self.check_endstops(move) @@ -96,7 +97,8 @@ class CartKinematics: inv_accel = 1. / move.accel inv_cruise_v = 1. / move.cruise_v for i in StepList: - new_step_pos = int(move.pos[i]*self.steppers[i].inv_step_dist + 0.5) + new_step_pos = int( + move.end_pos[i]*self.steppers[i].inv_step_dist + 0.5) steps = new_step_pos - self.stepper_pos[i] if not steps: continue -- cgit v1.2.3-70-g09d2