aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/endstop_phase.py2
-rw-r--r--klippy/extras/tmc.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/klippy/extras/endstop_phase.py b/klippy/extras/endstop_phase.py
index 20ddd340..c0408262 100644
--- a/klippy/extras/endstop_phase.py
+++ b/klippy/extras/endstop_phase.py
@@ -66,6 +66,8 @@ class EndstopPhase:
msg = "Unable to get stepper %s phase: %s" % (self.name, str(e))
logging.exception(msg)
raise homing.EndstopError(msg)
+ if stepper.is_dir_inverted():
+ phase = (self.phases - 1) - phase
else:
phase = stepper.get_mcu_position() % self.phases
self.phase_history[phase] += 1
diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py
index f3dcdb92..d0c88f58 100644
--- a/klippy/extras/tmc.py
+++ b/klippy/extras/tmc.py
@@ -227,7 +227,7 @@ class TMCMicrostepHelper:
field_name = "MSTEP"
reg = self.mcu_tmc.get_register(self.fields.lookup_register(field_name))
mscnt = self.fields.get_field(field_name, reg)
- return mscnt >> self.fields.get_field("MRES")
+ return (1023 - mscnt) >> self.fields.get_field("MRES")
# Helper to configure "stealthchop" mode
def TMCStealthchopHelper(config, mcu_tmc, tmc_freq):