diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-06-21 21:26:26 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-06-21 21:47:37 -0400 |
commit | 0b02d7a1f236ae3b2c1cb2c8a4ce16e1788bc100 (patch) | |
tree | 30a19447195f30076e6aee79c56870de25810b0e /klippy/extras/tmc_uart.py | |
parent | 9feb05ce418a57127ac1f95f5f07e8ef4beae7f4 (diff) | |
download | kutter-0b02d7a1f236ae3b2c1cb2c8a4ce16e1788bc100.tar.gz kutter-0b02d7a1f236ae3b2c1cb2c8a4ce16e1788bc100.tar.xz kutter-0b02d7a1f236ae3b2c1cb2c8a4ce16e1788bc100.zip |
tmc_uart: Support print_time in set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/tmc_uart.py')
-rw-r--r-- | klippy/extras/tmc_uart.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/klippy/extras/tmc_uart.py b/klippy/extras/tmc_uart.py index 6db689a2..288fb76d 100644 --- a/klippy/extras/tmc_uart.py +++ b/klippy/extras/tmc_uart.py @@ -149,12 +149,14 @@ 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): + def reg_write(self, instance_id, addr, reg, val, print_time=0.): + 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) self.tmcuart_send_cmd.send_with_response( - [self.oid, msg, 0], 'tmcuart_response', self.oid) + [self.oid, msg, 0], 'tmcuart_response', self.oid, + minclock=minclock) # Lookup a (possibly shared) tmc uart def lookup_tmc_uart_bitbang(config): @@ -208,7 +210,8 @@ class MCU_TMC_uart: ifcnt = self.ifcnt if ifcnt is None: self.ifcnt = ifcnt = self.get_register("IFCNT") - self.mcu_uart.reg_write(self.instance_id, self.addr, reg, val) + self.mcu_uart.reg_write(self.instance_id, self.addr, reg, val, + print_time) self.ifcnt = self.get_register("IFCNT") if self.ifcnt == (ifcnt + 1) & 0xff: return |