From 872615cfcf3939473fc4a081bb7e75a66e8e0bd8 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 12 Aug 2025 14:28:18 -0400 Subject: [PATCH] toolhead: Add new _calc_step_gen_restart() helper Separate out step generation specific handling from _calc_print_time() code. Signed-off-by: Kevin O'Connor --- klippy/toolhead.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index dbafdb92..cf8ee583 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -298,14 +298,16 @@ class ToolHead: self.last_step_gen_time = step_gen_time if flush_time >= want_flush_time: break + def _calc_step_gen_restart(self, est_print_time): + kin_time = max(est_print_time + MIN_KIN_TIME, self.last_step_gen_time) + return kin_time + self.kin_flush_delay def _advance_move_time(self, next_print_time): self.print_time = max(self.print_time, next_print_time) self._advance_flush_time(self.print_time, lazy_target=True) def _calc_print_time(self): curtime = self.reactor.monotonic() est_print_time = self.mcu.estimated_print_time(curtime) - kin_time = max(est_print_time + MIN_KIN_TIME, self.last_step_gen_time) - kin_time += self.kin_flush_delay + kin_time = self._calc_step_gen_restart(est_print_time) min_print_time = max(est_print_time + BUFFER_TIME_START, kin_time) if min_print_time > self.print_time: self.print_time = min_print_time