aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc_uart.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-06-25 18:15:17 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-06-25 18:19:05 -0400
commit6ec7dee07d20de1a58c2c0b103513efb45d7d205 (patch)
tree76cf1b1ae31fcbef040259634d102b8eea1098ed /klippy/extras/tmc_uart.py
parent79c24f95b3e87957056b943b8883e88031846798 (diff)
downloadkutter-6ec7dee07d20de1a58c2c0b103513efb45d7d205.tar.gz
kutter-6ec7dee07d20de1a58c2c0b103513efb45d7d205.tar.xz
kutter-6ec7dee07d20de1a58c2c0b103513efb45d7d205.zip
tmc: It's not valid to schedule messages with print_time=0
A print_time of zero may translate to a negative clock on a secondary micro-controller, which would cause an internal error. Change the code to pass a real print_time or None if it is not needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/tmc_uart.py')
-rw-r--r--klippy/extras/tmc_uart.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/klippy/extras/tmc_uart.py b/klippy/extras/tmc_uart.py
index 288fb76d..f5584e8b 100644
--- a/klippy/extras/tmc_uart.py
+++ b/klippy/extras/tmc_uart.py
@@ -149,8 +149,10 @@ class MCU_TMC_uart_bitbang:
params = self.tmcuart_send_cmd.send_with_response(
[self.oid, msg, 10], 'tmcuart_response', self.oid)
return self._decode_read(reg, params['read'])
- def reg_write(self, instance_id, addr, reg, val, print_time=0.):
- minclock = self.mcu.print_time_to_clock(print_time)
+ def reg_write(self, instance_id, addr, reg, val, print_time=None):
+ minclock = 0
+ if print_time is not None:
+ minclock = self.mcu.print_time_to_clock(print_time)
if self.analog_mux is not None:
self.analog_mux.activate(instance_id)
msg = self._encode_write(0xf5, 0x00, reg | 0x80, val)