Skip to content

Commit

Permalink
Reset endstop states before first home
Browse files Browse the repository at this point in the history
This change removes the need for CoreXY homing to have a different home_current than run_current to force a dwell. Instead, no dwell is needed between axes anymore.
  • Loading branch information
ruiqimao authored and rogerlz committed Jul 18, 2024
1 parent 24265bd commit cf71cd0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions klippy/extras/homing.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ def _set_current_homing(self, homing_axes, pre_homing):
if dwell_time:
self.toolhead.dwell(dwell_time)

def _reset_endstop_states(self, endstops):
# re-querying a tmc endstop seems to reset the state
# otherwise it triggers almost immediately upon second home
# this seems to be an adequate substitute for a 2 second dwell.
print_time = self.toolhead.get_last_move_time()
for endstop in endstops:
endstop[0].query_endstop(print_time)

def home_rails(self, rails, forcepos, movepos):
# Notify of upcoming homing operation
self.printer.send_event("homing:home_rails_begin", self, rails)
Expand All @@ -288,6 +296,7 @@ def home_rails(self, rails, forcepos, movepos):
hmove = HomingMove(self.printer, endstops)

self._set_current_homing(homing_axes, pre_homing=True)
self._reset_endstop_states(endstops)

hmove.homing_move(homepos, hi.speed)

Expand Down Expand Up @@ -316,12 +325,7 @@ def home_rails(self, rails, forcepos, movepos):
rp - ad * retract_r for rp, ad in zip(retractpos, axes_d)
]
self.toolhead.set_position(startpos)
print_time = self.toolhead.get_last_move_time()
for endstop in endstops:
# re-querying a tmc endstop seems to reset the state
# otherwise it triggers almost immediately upon second home
# this seems to be an adequate substitute for a 2 second dwell.
endstop[0].query_endstop(print_time)
self._reset_endstop_states(endstops)
hmove = HomingMove(self.printer, endstops)
hmove.homing_move(homepos, hi.second_homing_speed)
try:
Expand Down

0 comments on commit cf71cd0

Please sign in to comment.