diff --git a/klippy/extras/homing.py b/klippy/extras/homing.py index 8eda54e30..b861564d8 100644 --- a/klippy/extras/homing.py +++ b/klippy/extras/homing.py @@ -240,7 +240,7 @@ def _set_current_homing(self, homing_axes): for rail in affected_rails: ch = rail.get_tmc_current_helper() - if ch is not None and ch._home_current != ch.run_current: + if ch is not None and ch.needs_home_current_change(): ch.set_current_for_homing(print_time) self.toolhead.dwell(ch.current_change_dwell_time) @@ -254,7 +254,7 @@ def _set_current_post_homing(self, homing_axes): for rail in affected_rails: ch = rail.get_tmc_current_helper() - if ch is not None and ch._home_current != ch.run_current: + if ch is not None and ch.needs_home_current_change(): ch.set_current_for_normal(print_time) self.toolhead.dwell(ch.current_change_dwell_time) diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py index 4fb23d60b..f3b6f7577 100644 --- a/klippy/extras/tmc2130.py +++ b/klippy/extras/tmc2130.py @@ -227,6 +227,9 @@ def __init__(self, config, mcu_tmc): self.fields.set_field("ihold", ihold) self.fields.set_field("irun", irun) + def needs_home_current_change(self): + return self._home_current != self.run_current + def set_home_current(self, new_home_current): self._home_current = min(MAX_CURRENT, new_home_current) diff --git a/klippy/extras/tmc2240.py b/klippy/extras/tmc2240.py index 25c504def..de8ca986a 100644 --- a/klippy/extras/tmc2240.py +++ b/klippy/extras/tmc2240.py @@ -295,6 +295,9 @@ def __init__(self, config, mcu_tmc): self.fields.set_field("ihold", ihold) self.fields.set_field("irun", irun) + def needs_home_current_change(self): + return self._home_current != self.run_current + def set_home_current(self, new_home_current): self._home_current = min(self.max_cur, new_home_current) diff --git a/klippy/extras/tmc2660.py b/klippy/extras/tmc2660.py index 67741d067..5aa020f97 100644 --- a/klippy/extras/tmc2660.py +++ b/klippy/extras/tmc2660.py @@ -147,6 +147,9 @@ def __init__(self, config, mcu_tmc): "idle_timeout:ready", self._handle_ready ) + def needs_home_current_change(self): + return self._home_current != self.current + def set_home_current(self, new_home_current): self._home_current = min(MAX_CURRENT, new_home_current) diff --git a/klippy/extras/tmc5160.py b/klippy/extras/tmc5160.py index 424425967..fa0fe0632 100644 --- a/klippy/extras/tmc5160.py +++ b/klippy/extras/tmc5160.py @@ -280,6 +280,9 @@ def __init__(self, config, mcu_tmc): self.fields.set_field("ihold", ihold) self.fields.set_field("irun", irun) + def needs_home_current_change(self): + return self._home_current != self.run_current + def set_home_current(self, new_home_current): self._home_current = min(MAX_CURRENT, new_home_current)