Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync bleeding-edge #121

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions klippy/extras/homing.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,15 @@ def _set_current_homing(self, homing_axes):
affected_rails = affected_rails | set(partial_rails)

for rail in affected_rails:
ch = rail.get_tmc_current_helper()
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)
chs = rail.get_tmc_current_helpers()
dwell_time = None
for ch in chs:
if ch is not None and ch.needs_home_current_change():
if dwell_time is None:
dwell_time = ch.current_change_dwell_time
ch.set_current_for_homing(print_time)
if dwell_time:
self.toolhead.dwell(dwell_time)

def _set_current_post_homing(self, homing_axes):
print_time = self.toolhead.get_last_move_time()
Expand All @@ -273,10 +278,15 @@ def _set_current_post_homing(self, homing_axes):
affected_rails = affected_rails | set(partial_rails)

for rail in affected_rails:
ch = rail.get_tmc_current_helper()
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)
chs = rail.get_tmc_current_helpers()
dwell_time = None
for ch in chs:
if ch is not None and ch.needs_home_current_change():
if dwell_time is None:
dwell_time = ch.current_change_dwell_time
ch.set_current_for_normal(print_time)
if dwell_time:
self.toolhead.dwell(dwell_time)

def home_rails(self, rails, forcepos, movepos):
# Notify of upcoming homing operation
Expand Down
9 changes: 8 additions & 1 deletion klippy/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ def __init__(
self.endstop_map = {}
self.add_extra_stepper(config)
mcu_stepper = self.steppers[0]
self._tmc_current_helpers = None
self.get_name = mcu_stepper.get_name
self.get_commanded_position = mcu_stepper.get_commanded_position
self.calc_position_from_coord = mcu_stepper.calc_position_from_coord
self.get_tmc_current_helper = mcu_stepper.get_tmc_current_helper
# Primary endstop position
mcu_endstop = self.endstops[0][0]
if hasattr(mcu_endstop, "get_position_endstop"):
Expand Down Expand Up @@ -482,6 +482,13 @@ def __init__(
% (config.get_name(),)
)

def get_tmc_current_helpers(self):
if self._tmc_current_helpers is None:
self._tmc_current_helpers = [
s.get_tmc_current_helper() for s in self.steppers
]
return self._tmc_current_helpers

def get_range(self):
return self.position_min, self.position_max

Expand Down