aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/endstop_phase.py3
-rw-r--r--klippy/extras/tmc.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/klippy/extras/endstop_phase.py b/klippy/extras/endstop_phase.py
index 254184db..bd34ddbe 100644
--- a/klippy/extras/endstop_phase.py
+++ b/klippy/extras/endstop_phase.py
@@ -54,7 +54,8 @@ class EndstopPhase:
self.name = config.get_name().split()[1]
# Obtain step_distance and microsteps from stepper config section
sconfig = config.getsection(self.name)
- self.step_dist = stepper.parse_step_distance(sconfig)
+ rotation_dist, steps_per_rotation = stepper.parse_step_distance(sconfig)
+ self.step_dist = rotation_dist / steps_per_rotation
self.phases = sconfig.getint("microsteps", note_valid=False) * 4
self.phase_calc = PhaseCalc(self.printer, self.name, self.phases)
# Register event handlers
diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py
index 0c5036f9..767ada39 100644
--- a/klippy/extras/tmc.py
+++ b/klippy/extras/tmc.py
@@ -520,8 +520,9 @@ def TMCStealthchopHelper(config, mcu_tmc, tmc_freq):
velocity = config.getfloat('stealthchop_threshold', 0., minval=0.)
if velocity:
stepper_name = " ".join(config.get_name().split()[1:])
- stepper_config = config.getsection(stepper_name)
- step_dist = stepper.parse_step_distance(stepper_config)
+ sconfig = config.getsection(stepper_name)
+ rotation_dist, steps_per_rotation = stepper.parse_step_distance(sconfig)
+ step_dist = rotation_dist / steps_per_rotation
step_dist_256 = step_dist / (1 << fields.get_field("mres"))
threshold = int(tmc_freq * step_dist_256 / velocity + .5)
fields.set_field("tpwmthrs", max(0, min(0xfffff, threshold)))