mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 21:58:05 -06:00
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>
This commit is contained in:
parent
e0e2f15498
commit
224574da4a
11 changed files with 56 additions and 40 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue