diff options
| author | Kevin O'Connor <kevin@koconnor.net> | 2016-12-30 17:02:28 -0500 |
|---|---|---|
| committer | Kevin O'Connor <kevin@koconnor.net> | 2016-12-30 20:14:48 -0500 |
| commit | 6bd5f4e44ec4898a6082c12df4ca7e4408a9df93 (patch) | |
| tree | 19909ceb9b5efe15c64a199eab9e610c59e7df11 /klippy/mcu.py | |
| parent | 6138d18f4bf5bdb2eb2639f4f9da40a1d52121ad (diff) | |
| download | kutter-6bd5f4e44ec4898a6082c12df4ca7e4408a9df93.tar.gz kutter-6bd5f4e44ec4898a6082c12df4ca7e4408a9df93.tar.xz kutter-6bd5f4e44ec4898a6082c12df4ca7e4408a9df93.zip | |
stepcompress: Using normal message priority system during homing
The endstop homing system requires all queue_step commands be in the
MCU's 'move queue' before endstop checking starts. Use the normal
message priority system to request that stepper queue_step commands
are received prior to the start of the end_stop_home command. This
simplifies the code and removes the need for special serial queue
flushing.
This also fixes a bug in homing operations that take longer than 2^31
clock ticks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/mcu.py')
| -rw-r--r-- | klippy/mcu.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py index c9927841..6fc2db0d 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -58,7 +58,10 @@ class MCU_stepper: self._mcu_position_offset = pos - self.commanded_position def get_mcu_position(self): return self.commanded_position + self._mcu_position_offset - def note_stepper_stop(self): + def note_homing_start(self, homing_clock): + self.ffi_lib.stepcompress_set_homing(self._stepqueue, homing_clock) + def note_homing_finalized(self): + self.ffi_lib.stepcompress_set_homing(self._stepqueue, 0) self.ffi_lib.stepcompress_reset(self._stepqueue, 0) def reset_step_clock(self, mcu_time): clock = int(mcu_time * self._mcu_freq) @@ -144,11 +147,9 @@ class MCU_endstop: msg = self._home_cmd.encode( self._oid, clock, rest_ticks, 1 ^ self._invert) self._mcu.send(msg, reqclock=clock, cq=self._cmd_queue) + self._stepper.note_homing_start(clock) def home_finalize(self, mcu_time): - # XXX - this flushes the serial port of messages ready to be - # sent, but doesn't flush messages if they had an unmet minclock - self._mcu.serial.send_flush() - self._stepper.note_stepper_stop() + self._stepper.note_homing_finalized() self._home_timeout_clock = int(mcu_time * self._mcu_freq) def home_wait(self): eventtime = time.time() |
