aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/homing.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-11-13 17:59:40 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-11-13 19:00:17 -0500
commit224574da4a623e3f37ebfe8082a546a9df697638 (patch)
tree81c65dca1a785d7a18708a81ad674866f58a9d22 /klippy/homing.py
parente0e2f154986aa05666f3e0eea44a8c4074fa7cf7 (diff)
downloadkutter-224574da4a623e3f37ebfe8082a546a9df697638.tar.gz
kutter-224574da4a623e3f37ebfe8082a546a9df697638.tar.xz
kutter-224574da4a623e3f37ebfe8082a546a9df697638.zip
stepper: Add get/set_tag_position() and convert calc_position()
Rename calc_position() to calc_tag_position() and have it calculate the value of the position from the last stepper set_tag_position() call. This enables the calc_tag_position() code to be more flexible as it can be run with arbitrary positions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/homing.py')
-rw-r--r--klippy/homing.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/klippy/homing.py b/klippy/homing.py
index 63530a91..0f3ee308 100644
--- a/klippy/homing.py
+++ b/klippy/homing.py
@@ -67,8 +67,10 @@ class Homing:
if error is None:
error = "Failed to home %s: %s" % (name, str(e))
if probe_pos:
- self.set_homed_position(
- list(self.toolhead.get_kinematics().calc_position()) + [None])
+ kin = self.toolhead.get_kinematics()
+ for s in kin.get_steppers():
+ s.set_tag_position(s.get_commanded_position())
+ self.set_homed_position(kin.calc_tag_position())
else:
self.toolhead.set_position(movepos)
for mcu_endstop, name in endstops:
@@ -116,7 +118,10 @@ class Homing:
ret = self.printer.send_event("homing:homed_rails", self, rails)
if any(ret):
# Apply any homing offsets
- adjustpos = self.toolhead.get_kinematics().calc_position()
+ kin = self.toolhead.get_kinematics()
+ for s in kin.get_steppers():
+ s.set_tag_position(s.get_commanded_position())
+ adjustpos = kin.calc_tag_position()
for axis in homing_axes:
movepos[axis] = adjustpos[axis]
self.toolhead.set_position(movepos)