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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-02 10:37:31 -04:00
parent 508a934d62
commit 2b7ab290b8
2 changed files with 4 additions and 9 deletions

View File

@ -249,9 +249,7 @@ Stepper commands
* reset_step_clock oid=%c clock=%u : Normally, step timing is relative * 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 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 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 host usually only sends this command at the start of a print.
after a long idle period for the stepper (for example a Z stepper
move after printing an extensive layer).
* end_stop_home oid=%c clock=%u rest_ticks=%u pin_value=%c : This * end_stop_home oid=%c clock=%u rest_ticks=%u pin_value=%c : This
command is used during stepper "homing" operations. To use this command is used during stepper "homing" operations. To use this

View File

@ -23,7 +23,6 @@ class MCU_stepper:
step_pin, pullup, invert_step = parse_pin_extras(step_pin) step_pin, pullup, invert_step = parse_pin_extras(step_pin)
dir_pin, pullup, self._invert_dir = parse_pin_extras(dir_pin) dir_pin, pullup, self._invert_dir = parse_pin_extras(dir_pin)
self._sdir = -1 self._sdir = -1
self._last_move_clock = -2**29
self._mcu_freq = mcu.get_mcu_freq() self._mcu_freq = mcu.get_mcu_freq()
min_stop_interval = int(min_stop_interval * self._mcu_freq) min_stop_interval = int(min_stop_interval * self._mcu_freq)
max_error = int(max_error * self._mcu_freq) max_error = int(max_error * self._mcu_freq)
@ -48,18 +47,16 @@ class MCU_stepper:
return self._invert_dir return self._invert_dir
def note_stepper_stop(self): def note_stepper_stop(self):
self._sdir = -1 self._sdir = -1
self._last_move_clock = -2**29
def _reset_step_clock(self, clock): def _reset_step_clock(self, clock):
self.ffi_lib.stepcompress_reset(self._stepqueue, clock) self.ffi_lib.stepcompress_reset(self._stepqueue, clock)
data = (self._reset_cmd.msgid, self._oid, clock & 0xffffffff) data = (self._reset_cmd.msgid, self._oid, clock & 0xffffffff)
self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data)) self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data))
def set_next_step_dir(self, mcu_time, sdir): 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: if self._sdir == sdir:
return return
if self._sdir == -1:
clock = int(mcu_time * self._mcu_freq)
self._reset_step_clock(clock)
self._sdir = sdir self._sdir = sdir
data = (self._dir_cmd.msgid, self._oid, sdir ^ self._invert_dir) data = (self._dir_cmd.msgid, self._oid, sdir ^ self._invert_dir)
self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data)) self.ffi_lib.stepcompress_queue_msg(self._stepqueue, data, len(data))