aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/homing.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-06-25 21:25:01 -0400
committerKevinOConnor <kevin@koconnor.net>2019-07-10 10:43:20 -0400
commit43064d197d6fd6bcc55217c5e9298d86bf4ecde7 (patch)
treed63636e8d5327affc605efd5e5c1c360ee040c7a /klippy/homing.py
parentd6cce8a55753965e9b00f9ee0caa328323380ced (diff)
downloadkutter-43064d197d6fd6bcc55217c5e9298d86bf4ecde7.tar.gz
kutter-43064d197d6fd6bcc55217c5e9298d86bf4ecde7.tar.xz
kutter-43064d197d6fd6bcc55217c5e9298d86bf4ecde7.zip
homing: Implement homing via new toolhead "drip" movement
Rework the low-level implementation of homing movement. The existing mechanism buffers all homing movement into the micro-controller prior to starting the home. Replace with a system that buffers all movement into the host look-ahead buffer and then "drip feed" those moves to the micro-controllers. Then clear the host look-ahead buffer when all endstops trigger. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/homing.py')
-rw-r--r--klippy/homing.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/klippy/homing.py b/klippy/homing.py
index c6e1ba83..efb44070 100644
--- a/klippy/homing.py
+++ b/klippy/homing.py
@@ -16,6 +16,7 @@ class Homing:
self.toolhead = printer.lookup_object('toolhead')
self.changed_axes = []
self.verify_retract = True
+ self.endstops_pending = -1
def set_no_verify_retract(self):
self.verify_retract = False
def set_axes(self, axes):
@@ -39,6 +40,10 @@ class Homing:
dist_ticks = adjusted_freq * mcu_stepper.get_step_dist()
ticks_per_step = math.ceil(dist_ticks / speed)
return dist_ticks / ticks_per_step
+ def _endstop_notify(self):
+ self.endstops_pending -= 1
+ if not self.endstops_pending:
+ self.toolhead.signal_drip_mode_end()
def homing_move(self, movepos, endstops, speed, dwell_t=0.,
probe_pos=False, verify_movement=False):
# Notify endstops of upcoming home
@@ -50,22 +55,22 @@ class Homing:
print_time = self.toolhead.get_last_move_time()
start_mcu_pos = [(s, name, s.get_mcu_position())
for es, name in endstops for s in es.get_steppers()]
+ self.endstops_pending = len(endstops)
for mcu_endstop, name in endstops:
min_step_dist = min([s.get_step_dist()
for s in mcu_endstop.get_steppers()])
mcu_endstop.home_start(
print_time, ENDSTOP_SAMPLE_TIME, ENDSTOP_SAMPLE_COUNT,
- min_step_dist / speed)
- self.toolhead.dwell(HOMING_START_DELAY, check_stall=False)
+ min_step_dist / speed, notify=self._endstop_notify)
+ self.toolhead.dwell(HOMING_START_DELAY)
# Issue move
error = None
try:
- self.toolhead.move(movepos, speed)
+ self.toolhead.drip_move(movepos, speed)
except CommandError as e:
error = "Error during homing move: %s" % (str(e),)
# Wait for endstops to trigger
move_end_print_time = self.toolhead.get_last_move_time()
- self.toolhead.reset_print_time(print_time)
for mcu_endstop, name in endstops:
try:
mcu_endstop.home_wait(move_end_print_time)