toolhead: Flush in chunks from flush_step_generation()

If note_kinematic_activity() has a time far in the future it could
result in a single flush attempt of that time range.  Be sure to break
up that range into small chunks using the normal _update_move_time()
mechanism.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2023-01-06 12:43:30 -05:00
parent 52b33c1b81
commit bca2671efb
1 changed files with 8 additions and 2 deletions

View File

@ -341,8 +341,14 @@ class ToolHead:
self.reactor.update_timer(self.flush_timer, self.reactor.NEVER) self.reactor.update_timer(self.flush_timer, self.reactor.NEVER)
self.move_queue.set_flush_time(self.buffer_time_high) self.move_queue.set_flush_time(self.buffer_time_high)
self.idle_flush_print_time = 0. self.idle_flush_print_time = 0.
flush_time = self.last_kin_move_time + self.kin_flush_delay # Determine actual last "itersolve" flush time
flush_time = max(flush_time, self.print_time - self.kin_flush_delay) lastf = self.print_time - self.kin_flush_delay
# Calculate flush time that includes kinematic scan windows
flush_time = max(lastf, self.last_kin_move_time + self.kin_flush_delay)
if flush_time > self.print_time:
# Flush in small time chunks
self._update_move_time(flush_time)
# Flush kinematic scan windows and step buffers
self.force_flush_time = max(self.force_flush_time, flush_time) self.force_flush_time = max(self.force_flush_time, flush_time)
self._update_move_time(max(self.print_time, self.force_flush_time)) self._update_move_time(max(self.print_time, self.force_flush_time))
def _flush_lookahead(self): def _flush_lookahead(self):