mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-06 05:24:02 -06:00
mcu: Change mcu_stepper.set_position() to take a location in millimeters
Update the set_position() method to convert from millimeters to absolute step position. Also, update PrinterStepper.get_homed_offset() and mcu_stepper.get_commanded_position() to return millimeters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
79f31238b0
commit
e4153a536f
5 changed files with 16 additions and 21 deletions
|
@ -26,12 +26,7 @@ class CoreXYKinematics:
|
|||
def set_position(self, newpos):
|
||||
pos = (newpos[0] + newpos[1], newpos[0] - newpos[1], newpos[2])
|
||||
for i in StepList:
|
||||
s = self.steppers[i]
|
||||
if pos[i] >= 0.:
|
||||
steppos = int(pos[i]*s.inv_step_dist + 0.5)
|
||||
else:
|
||||
steppos = int(pos[i]*s.inv_step_dist - 0.5)
|
||||
s.mcu_stepper.set_position(steppos)
|
||||
self.steppers[i].mcu_stepper.set_position(pos[i])
|
||||
def home(self, homing_state):
|
||||
# Each axis is homed independently and in order
|
||||
for axis in homing_state.get_axes():
|
||||
|
@ -63,8 +58,7 @@ class CoreXYKinematics:
|
|||
list(coord), homepos, [s], s.homing_speed/2.0, second_home=True)
|
||||
if axis == 2:
|
||||
# Support endstop phase detection on Z axis
|
||||
coord[axis] = (s.position_endstop
|
||||
+ s.get_homed_offset()*s.step_dist)
|
||||
coord[axis] = s.position_endstop + s.get_homed_offset()
|
||||
homing_state.set_homed_position(coord)
|
||||
def motor_off(self, move_time):
|
||||
self.limits = [(1.0, -1.0)] * 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue