toolhead: Flush lookahead on dwell - fix flushing bug after long delays

Commit 7ea5f5d2 changed how the lookahead queue is flushed.
Previously, the main flush timer would always run while the toolhead
was considered in an active state (print_time).  After that commit,
the flush timer could sleep if there were no steps generated (no call
to note_mcu_movequeue_activity() ).  This could lead to a situation
where a G4 command (or series of commands) could cause the toolhead to
be considered in an active state while the flush timer was disabled.
The result was that a future command may not be properly flushed (the
toolhead would fail to transition to a "Priming" state).

Fix by ensuring that all dwell() requests fully flush the lookahead
queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-09-29 11:31:31 -04:00
parent 9e6430aa60
commit 184ba4080c

View File

@@ -398,6 +398,7 @@ class ToolHead:
self.move(curpos, speed)
self.printer.send_event("toolhead:manual_move")
def dwell(self, delay):
self._flush_lookahead()
next_print_time = self.get_last_move_time() + max(0., delay)
self._advance_move_time(next_print_time)
self._check_pause()