From 6ec7dee07d20de1a58c2c0b103513efb45d7d205 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 25 Jun 2019 18:15:17 -0400 Subject: 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 --- klippy/extras/tmc2130.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'klippy/extras/tmc2130.py') diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py index 4dce19c9..bb235962 100644 --- a/klippy/extras/tmc2130.py +++ b/klippy/extras/tmc2130.py @@ -186,12 +186,14 @@ class MCU_TMC_SPI: params = self.spi.spi_transfer([reg, 0x00, 0x00, 0x00, 0x00]) pr = bytearray(params['response']) return (pr[1] << 24) | (pr[2] << 16) | (pr[3] << 8) | pr[4] - def set_register(self, reg_name, val, print_time=0.): - min_clock = self.spi.get_mcu().print_time_to_clock(print_time) + def set_register(self, reg_name, val, print_time=None): + minclock = 0 + if print_time is not None: + minclock = self.spi.get_mcu().print_time_to_clock(print_time) reg = Registers[reg_name] data = [(reg | 0x80) & 0xff, (val >> 24) & 0xff, (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff] - self.spi.spi_send(data, min_clock) + self.spi.spi_send(data, minclock) ###################################################################### -- cgit v1.2.3-70-g09d2