Skip to content

Commit

Permalink
Update tmc5160.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HonestBrothers authored Dec 25, 2024
1 parent a3d3d77 commit f47e369
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions klippy/extras/tmc5160.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ def __init__(self, config, mcu_tmc):
self.fields.set_field("irun", irun)
def _calc_globalscaler(self, current):
cs = self._calc_current_bits(current)
globalscaler = int(
globalscaler = int(math.ceil(
(current * 256.0 * math.sqrt(2.0) * self.sense_resistor * 32 / (
VREF * (1 + cs))) + 0.5)
VREF * (1 + cs)))))
globalscaler = max(32, globalscaler)
if globalscaler >= 256:
globalscaler = 0
Expand Down

0 comments on commit f47e369

Please sign in to comment.