mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-24 23:24:01 -06:00
stepper: Remove set_commanded_position() call
Now that the only caller to set_commanded_position() is set_position(), remove the set_commanded_position() method and pass the set_position() call directly to the itersolve.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
18b0749163
commit
d39142139e
4 changed files with 13 additions and 20 deletions
|
@ -90,17 +90,14 @@ class MCU_stepper:
|
|||
return self._step_dist
|
||||
def is_dir_inverted(self):
|
||||
return self._invert_dir
|
||||
def calc_position_from_coord(self, coord):
|
||||
return self._ffi_lib.itersolve_calc_position_from_coord(
|
||||
self._stepper_kinematics, coord[0], coord[1], coord[2])
|
||||
def set_position(self, coord):
|
||||
self.set_commanded_position(self.calc_position_from_coord(coord))
|
||||
opos = self.get_commanded_position()
|
||||
sk = self._stepper_kinematics
|
||||
self._ffi_lib.itersolve_set_position(sk, coord[0], coord[1], coord[2])
|
||||
self._mcu_position_offset += opos - self.get_commanded_position()
|
||||
def get_commanded_position(self):
|
||||
return self._ffi_lib.itersolve_get_commanded_pos(
|
||||
self._stepper_kinematics)
|
||||
def set_commanded_position(self, pos):
|
||||
self._mcu_position_offset += self.get_commanded_position() - pos
|
||||
self._ffi_lib.itersolve_set_commanded_pos(self._stepper_kinematics, pos)
|
||||
sk = self._stepper_kinematics
|
||||
return self._ffi_lib.itersolve_get_commanded_pos(sk)
|
||||
def get_mcu_position(self):
|
||||
mcu_pos_dist = self.get_commanded_position() + self._mcu_position_offset
|
||||
mcu_pos = mcu_pos_dist / self._step_dist
|
||||
|
@ -279,9 +276,6 @@ class PrinterRail:
|
|||
def set_max_jerk(self, max_halt_velocity, max_accel):
|
||||
for stepper in self.steppers:
|
||||
stepper.set_max_jerk(max_halt_velocity, max_accel)
|
||||
def set_commanded_position(self, pos):
|
||||
for stepper in self.steppers:
|
||||
stepper.set_commanded_position(pos)
|
||||
def set_position(self, coord):
|
||||
for stepper in self.steppers:
|
||||
stepper.set_position(coord)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue