From 2b7ab290b889aa07880d9374309504c6fefc3764 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 2 Nov 2016 10:37:31 -0400 Subject: [PATCH] mcu: Remove python checks for stepcompress integer overflow Now that the C code checks for overflow, it is no longer necessary for the python code to check. Signed-off-by: Kevin O'Connor --- docs/Firmware_Commands.md | 4 +--- klippy/mcu.py | 9 +++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/Firmware_Commands.md b/docs/Firmware_Commands.md index 2416eb3c..74c11c5d 100644 --- a/docs/Firmware_Commands.md +++ b/docs/Firmware_Commands.md @@ -249,9 +249,7 @@ Stepper commands * reset_step_clock oid=%c clock=%u : Normally, step timing is relative to the last step for a given stepper. This command resets the clock so that the next step is relative to the supplied 'clock' time. The - host usually only sends this command at the start of a print or - after a long idle period for the stepper (for example a Z stepper - move after printing an extensive layer). + host usually only sends this command at the start of a print. * end_stop_home oid=%c clock=%u rest_ticks=%u pin_value=%c : This command is used during stepper "homing" operations. To use this diff --git a/klippy/mcu.py b/klippy/mcu.py index d3629fc4..93eacc23 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -23,7 +23,6 @@ class MCU_stepper: step_pin, pullup, invert_step = parse_pin_extras(step_pin) dir_pin, pullup, self._invert_dir = parse_pin_extras(dir_pin) self._sdir = -1 - self._last_move_clock = -2**29 self._mcu_freq = mcu.get_mcu_freq() min_stop_interval = int(min_stop_interval * self._mcu_freq) max_error = int(max_error * self._mcu_freq) @@ -48,18 +47,16 @@ class MCU_stepper: return self._invert_dir def note_stepper_stop(self): self._sdir = -1 - self._last_move_clock = -2**29 def _reset_step_clock(self, clock): self.ffi_lib.stepcompress_reset(self._stepqueue, clock) data = (self._reset_cmd.msgid, self._oid, clock & 0xffffffff) self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data)) def set_next_step_dir(self, mcu_time, sdir): - clock = int(mcu_time * self._mcu_freq) - if clock - self._last_move_clock >= 2**29: - self._reset_step_clock(clock) - self._last_move_clock = clock if self._sdir == sdir: return + if self._sdir == -1: + clock = int(mcu_time * self._mcu_freq) + self._reset_step_clock(clock) self._sdir = sdir data = (self._dir_cmd.msgid, self._oid, sdir ^ self._invert_dir) self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data))