From def524bdf488e0de97f287e5711bd84226e8098f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 10 Oct 2018 19:48:35 -0400 Subject: endstop_phase: Add support for detecting phase via TMC stepper drivers The Trinamic stepper motor drivers are capable of reporting the stepper phase - add support for using that capability to the enddstop_phases module. Signed-off-by: Kevin O'Connor --- klippy/extras/tmc2130.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'klippy/extras/tmc2130.py') diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py index 08c7c7f3..9220ba95 100644 --- a/klippy/extras/tmc2130.py +++ b/klippy/extras/tmc2130.py @@ -137,6 +137,10 @@ class TMC2130: data = [(reg | 0x80) & 0xff, (val >> 24) & 0xff, (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff] self.spi_send_cmd.send([self.oid, data]) + def get_microsteps(self): + return 256 >> self.mres + def get_phase(self): + return (self.get_register("MSCNT") & 0x3ff) >> self.mres cmd_DUMP_TMC_help = "Read and display TMC stepper driver registers" def cmd_DUMP_TMC(self, params): self.printer.lookup_object('toolhead').get_last_move_time() -- cgit v1.2.3-70-g09d2