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:
Kevin O'Connor 2017-04-04 19:20:54 -04:00
parent 79f31238b0
commit e4153a536f
5 changed files with 16 additions and 21 deletions

View file

@ -69,10 +69,14 @@ class MCU_stepper:
def get_oid(self):
return self._oid
def set_position(self, pos):
self._mcu_position_offset += self._commanded_pos - pos
self._commanded_pos = pos
if pos >= 0.:
steppos = int(pos * self._inv_step_dist + 0.5)
else:
steppos = int(pos * self._inv_step_dist - 0.5)
self._mcu_position_offset += self._commanded_pos - steppos
self._commanded_pos = steppos
def get_commanded_position(self):
return self._commanded_pos
return self._commanded_pos * self._step_dist
def get_mcu_position(self):
return self._commanded_pos + self._mcu_position_offset
def note_homing_start(self, homing_clock):