aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config_Reference.md21
-rw-r--r--klippy/extras/tmc.py19
2 files changed, 23 insertions, 17 deletions
diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md
index 9d5cb763..1338d46f 100644
--- a/docs/Config_Reference.md
+++ b/docs/Config_Reference.md
@@ -3327,11 +3327,8 @@ run_current:
#high_velocity_threshold:
# The velocity (in mm/s) to set the TMC driver internal "high
# velocity" threshold (THIGH) to. This is typically used to disable
-# the "CoolStep" feature at high speeds. Important - if
-# high_velocity_threshold is set and "sensorless homing" is used,
-# then one must ensure that the homing speed is below the high
-# velocity threshold! The default is to not set a TMC "high
-# velocity" threshold.
+# the "CoolStep" feature at high speeds. The default is to not set a
+# TMC "high velocity" threshold.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
@@ -3646,11 +3643,8 @@ run_current:
#high_velocity_threshold:
# The velocity (in mm/s) to set the TMC driver internal "high
# velocity" threshold (THIGH) to. This is typically used to disable
-# the "CoolStep" feature at high speeds. Important - if
-# high_velocity_threshold is set and "sensorless homing" is used,
-# then one must ensure that the homing speed is below the high
-# velocity threshold! The default is to not set a TMC "high
-# velocity" threshold.
+# the "CoolStep" feature at high speeds. The default is to not set a
+# TMC "high velocity" threshold.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
@@ -3782,11 +3776,8 @@ run_current:
#high_velocity_threshold:
# The velocity (in mm/s) to set the TMC driver internal "high
# velocity" threshold (THIGH) to. This is typically used to disable
-# the "CoolStep" feature at high speeds. Important - if
-# high_velocity_threshold is set and "sensorless homing" is used,
-# then one must ensure that the homing speed is below the high
-# velocity threshold! The default is to not set a TMC "high
-# velocity" threshold.
+# the "CoolStep" feature at high speeds. The default is to not set a
+# TMC "high velocity" threshold.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py
index 1a5059fa..a797b866 100644
--- a/klippy/extras/tmc.py
+++ b/klippy/extras/tmc.py
@@ -479,7 +479,7 @@ class TMCVirtualPinHelper:
self.diag_pin_field = None
self.mcu_endstop = None
self.en_pwm = False
- self.pwmthrs = self.coolthrs = 0
+ self.pwmthrs = self.coolthrs = self.thigh = 0
# Register virtual_endstop pin
name_parts = config.get_name().split()
ppins = self.printer.lookup_object("pins")
@@ -503,8 +503,8 @@ class TMCVirtualPinHelper:
def handle_homing_move_begin(self, hmove):
if self.mcu_endstop not in hmove.get_mcu_endstops():
return
+ # Enable/disable stealthchop
self.pwmthrs = self.fields.get_field("tpwmthrs")
- self.coolthrs = self.fields.get_field("tcoolthrs")
reg = self.fields.lookup_register("en_pwm_mode", None)
if reg is None:
# On "stallguard4" drivers, "stealthchop" must be enabled
@@ -518,12 +518,21 @@ class TMCVirtualPinHelper:
self.fields.set_field("en_pwm_mode", 0)
val = self.fields.set_field(self.diag_pin_field, 1)
self.mcu_tmc.set_register("GCONF", val)
+ # Enable tcoolthrs (if not already)
+ self.coolthrs = self.fields.get_field("tcoolthrs")
if self.coolthrs == 0:
tc_val = self.fields.set_field("tcoolthrs", 0xfffff)
self.mcu_tmc.set_register("TCOOLTHRS", tc_val)
+ # Disable thigh
+ reg = self.fields.lookup_register("thigh", None)
+ if reg is not None:
+ self.thigh = self.fields.get_field("thigh")
+ th_val = self.fields.set_field("thigh", 0)
+ self.mcu_tmc.set_register(reg, th_val)
def handle_homing_move_end(self, hmove):
if self.mcu_endstop not in hmove.get_mcu_endstops():
return
+ # Restore stealthchop/spreadcycle
reg = self.fields.lookup_register("en_pwm_mode", None)
if reg is None:
tp_val = self.fields.set_field("tpwmthrs", self.pwmthrs)
@@ -533,8 +542,14 @@ class TMCVirtualPinHelper:
self.fields.set_field("en_pwm_mode", self.en_pwm)
val = self.fields.set_field(self.diag_pin_field, 0)
self.mcu_tmc.set_register("GCONF", val)
+ # Restore tcoolthrs
tc_val = self.fields.set_field("tcoolthrs", self.coolthrs)
self.mcu_tmc.set_register("TCOOLTHRS", tc_val)
+ # Restore thigh
+ reg = self.fields.lookup_register("thigh", None)
+ if reg is not None:
+ th_val = self.fields.set_field("thigh", self.thigh)
+ self.mcu_tmc.set_register(reg, th_val)
######################################################################