mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 21:14:05 -06:00
tmc: Implement coolstep_threshold for drivers that support it
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
This commit is contained in:
parent
0f3f29101c
commit
5249d955bb
6 changed files with 50 additions and 0 deletions
|
@ -616,3 +616,19 @@ def TMCStealthchopHelper(config, mcu_tmc):
|
|||
else:
|
||||
# TMC2208 uses en_spreadCycle
|
||||
fields.set_field("en_spreadcycle", not en_pwm_mode)
|
||||
|
||||
# Helper to configure StallGuard and CoolStep minimum velocity
|
||||
def TMCVcoolthrsHelper(config, mcu_tmc):
|
||||
fields = mcu_tmc.get_fields()
|
||||
velocity = config.getfloat('coolstep_threshold', None, minval=0.)
|
||||
tcoolthrs = 0
|
||||
|
||||
if velocity is not None:
|
||||
stepper_name = " ".join(config.get_name().split()[1:])
|
||||
sconfig = config.getsection(stepper_name)
|
||||
rotation_dist, steps_per_rotation = stepper.parse_step_distance(sconfig)
|
||||
step_dist = rotation_dist / steps_per_rotation
|
||||
mres = fields.get_field("mres")
|
||||
tcoolthrs = TMCtstepHelper(step_dist, mres,
|
||||
mcu_tmc.get_tmc_frequency(), velocity)
|
||||
fields.set_field("tcoolthrs", tcoolthrs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue