aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimofey Titovets <nefelim4ag@gmail.com>2025-06-09 18:36:41 +0200
committerKevinOConnor <kevin@koconnor.net>2025-07-12 16:17:22 -0400
commit8d67e1a4e969c1656cf72490d8af5fa38e32ef1a (patch)
tree404c1b27dcd6132555269fc00dafbf19f7ebd83b
parent33bd67f9b7a39a4f74fdacc786c1b3a5fa629a84 (diff)
downloadkutter-8d67e1a4e969c1656cf72490d8af5fa38e32ef1a.tar.gz
kutter-8d67e1a4e969c1656cf72490d8af5fa38e32ef1a.tar.xz
kutter-8d67e1a4e969c1656cf72490d8af5fa38e32ef1a.zip
tmc2660: add enriched SPI read
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
-rw-r--r--klippy/extras/tmc2660.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/klippy/extras/tmc2660.py b/klippy/extras/tmc2660.py
index dcffac75..7fd01546 100644
--- a/klippy/extras/tmc2660.py
+++ b/klippy/extras/tmc2660.py
@@ -198,11 +198,14 @@ class MCU_TMC2660_SPI:
self.fields = fields
def get_fields(self):
return self.fields
- def get_register(self, reg_name):
+ def get_register_raw(self, reg_name):
new_rdsel = ReadRegisters.index(reg_name)
reg = self.name_to_reg["DRVCONF"]
if self.printer.get_start_args().get('debugoutput') is not None:
- return 0
+ return {
+ 'data': 0,
+ '#receive_time': .0,
+ }
with self.mutex:
old_rdsel = self.fields.get_field("rdsel")
val = self.fields.set_field("rdsel", new_rdsel)
@@ -212,7 +215,12 @@ class MCU_TMC2660_SPI:
self.spi.spi_send(msg)
params = self.spi.spi_transfer(msg)
pr = bytearray(params['response'])
- return (pr[0] << 16) | (pr[1] << 8) | pr[2]
+ return {
+ 'data': (pr[0] << 16) | (pr[1] << 8) | pr[2],
+ '#receive_time': params['#receive_time'],
+ }
+ def get_register(self, reg_name):
+ return self.get_register_raw(reg_name)['data']
def set_register(self, reg_name, val, print_time=None):
minclock = 0
if print_time is not None: