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>
This commit is contained in:
Kevin O'Connor 2019-06-25 18:15:17 -04:00
parent 79c24f95b3
commit 6ec7dee07d
4 changed files with 21 additions and 14 deletions

View file

@ -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)