mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 21:14:05 -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
|
@ -23,8 +23,7 @@ class CartKinematics:
|
|||
self.steppers[2].set_max_jerk(0., self.max_z_accel)
|
||||
def set_position(self, newpos):
|
||||
for i in StepList:
|
||||
s = self.steppers[i]
|
||||
s.mcu_stepper.set_position(int(newpos[i]*s.inv_step_dist + 0.5))
|
||||
self.steppers[i].mcu_stepper.set_position(newpos[i])
|
||||
def home(self, homing_state):
|
||||
# Each axis is homed independently and in order
|
||||
for axis in homing_state.get_axes():
|
||||
|
@ -55,7 +54,7 @@ class CartKinematics:
|
|||
homing_state.home(
|
||||
list(coord), homepos, [s], s.homing_speed/2.0, second_home=True)
|
||||
# Set final homed position
|
||||
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