tmc: Fix typo preventing stealthchop threshold from being set
Fix typo introduced in commit 67b28522
.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
6f4822fe96
commit
7d76067ff9
|
@ -284,7 +284,8 @@ class TMCStealthchopHelper:
|
||||||
en_pwm_mode = False
|
en_pwm_mode = False
|
||||||
self.velocity = config.getfloat('stealthchop_threshold', 0., minval=0.)
|
self.velocity = config.getfloat('stealthchop_threshold', 0., minval=0.)
|
||||||
if self.velocity:
|
if self.velocity:
|
||||||
printer.register_event_handler("connect", self.handle_connect)
|
printer.register_event_handler("klippy:connect",
|
||||||
|
self.handle_connect)
|
||||||
en_pwm_mode = True
|
en_pwm_mode = True
|
||||||
reg = fields.lookup_register("en_pwm_mode", None)
|
reg = fields.lookup_register("en_pwm_mode", None)
|
||||||
if reg is not None:
|
if reg is not None:
|
||||||
|
@ -296,6 +297,6 @@ class TMCStealthchopHelper:
|
||||||
stepper_name = " ".join(self.name.split()[1:])
|
stepper_name = " ".join(self.name.split()[1:])
|
||||||
stepper = self.force_move.lookup_stepper(stepper_name)
|
stepper = self.force_move.lookup_stepper(stepper_name)
|
||||||
step_dist = stepper.get_step_dist()
|
step_dist = stepper.get_step_dist()
|
||||||
step_dist_256 = step_dist / (1 << fields.get_field("MRES"))
|
step_dist_256 = step_dist / (1 << self.fields.get_field("MRES"))
|
||||||
threshold = int(self.tmc_freq * step_dist_256 / self.velocity + .5)
|
threshold = int(self.tmc_freq * step_dist_256 / self.velocity + .5)
|
||||||
self.fields.set_field("TPWMTHRS", max(0, min(0xfffff, threshold)))
|
self.fields.set_field("TPWMTHRS", max(0, min(0xfffff, threshold)))
|
||||||
|
|
Loading…
Reference in New Issue