diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2023-12-26 11:18:40 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2023-12-26 11:18:40 -0500 |
commit | fe56bf36c920546fe27e21fa45be220ac764f67b (patch) | |
tree | 7642eb3941e0834c51cd837d663a98cbfbda4e98 /klippy | |
parent | 77619e912ca704977836485204238b17fed26b6b (diff) | |
download | kutter-fe56bf36c920546fe27e21fa45be220ac764f67b.tar.gz kutter-fe56bf36c920546fe27e21fa45be220ac764f67b.tar.xz kutter-fe56bf36c920546fe27e21fa45be220ac764f67b.zip |
toolhead: Fix _calc_print_time() after G4 and SET_PRESSURE_ADVANCE
Commit b7b13588 changed the internal flush time tracking, but
introduced the possibility of motion restart occurring too close to
the last motion end in some rare cases. This could result in
internal stepcompress errors.
Track the last step generation flush time (last_sg_flush_time) and use
when recalculating the next print_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/toolhead.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 3e9b339a..6e7b5a94 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -238,7 +238,8 @@ class ToolHead: # Flush tracking self.flush_timer = self.reactor.register_timer(self._flush_handler) self.do_kick_flush_timer = True - self.last_flush_time = self.need_flush_time = self.step_gen_time = 0. + self.last_flush_time = self.last_sg_flush_time = 0. + self.need_flush_time = self.step_gen_time = 0. # Kinematic step generation scan window time tracking self.kin_flush_delay = SDS_CHECK_TIME self.kin_flush_times = [] @@ -286,6 +287,7 @@ class ToolHead: sg_flush_time = min(flush_time + STEPCOMPRESS_FLUSH_TIME, sg_flush_ceil) for sg in self.step_generators: sg(sg_flush_time) + self.last_sg_flush_time = sg_flush_time # Free trapq entries that are no longer needed free_time = sg_flush_time - self.kin_flush_delay self.trapq_finalize_moves(self.trapq, free_time) @@ -307,7 +309,7 @@ class ToolHead: 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_flush_time) + kin_time = max(est_print_time + MIN_KIN_TIME, self.last_sg_flush_time) kin_time += self.kin_flush_delay min_print_time = max(est_print_time + BUFFER_TIME_START, kin_time) if min_print_time > self.print_time: |