aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimofey Titovets <nefelim4ag@gmail.com>2025-06-09 18:42:19 +0200
committerKevinOConnor <kevin@koconnor.net>2025-07-12 16:17:22 -0400
commit5923a2e3a1501c700ea4e357fa8491324b7ce7f3 (patch)
tree10d7bcb8e6e8bec7c910fc5a56ffd86e553502d6
parent8d67e1a4e969c1656cf72490d8af5fa38e32ef1a (diff)
downloadkutter-5923a2e3a1501c700ea4e357fa8491324b7ce7f3.tar.gz
kutter-5923a2e3a1501c700ea4e357fa8491324b7ce7f3.tar.xz
kutter-5923a2e3a1501c700ea4e357fa8491324b7ce7f3.zip
tmc: add spi status decode
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
-rw-r--r--klippy/extras/tmc2130.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py
index 17e8e8c0..b41eba02 100644
--- a/klippy/extras/tmc2130.py
+++ b/klippy/extras/tmc2130.py
@@ -272,6 +272,13 @@ class MCU_TMC_SPI:
with self.mutex:
resp = self.tmc_spi.reg_read(reg, self.chain_pos)
return resp
+ def decode_spi_status(spi_status):
+ return {
+ "standstill": spi_status >> 3 & 0x1,
+ "sg2": spi_status >> 2 & 0x1,
+ "driver_error": spi_status >> 1 & 0x1,
+ "reset_flag": spi_status & 0x1
+ }
def get_register(self, reg_name):
return self.get_register_raw(reg_name)["data"]
def set_register(self, reg_name, val, print_time=None):