diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-01-17 11:22:16 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-01-17 11:28:42 -0500 |
commit | 7a74888b43a7e640a32fd18ae69d9dbdeaf55719 (patch) | |
tree | f421f5b6645b869827cee3120f732b4950410584 /klippy/toolhead.py | |
parent | 3d3b87f97fc91d93ae4198b36198262207e1202b (diff) | |
download | kutter-7a74888b43a7e640a32fd18ae69d9dbdeaf55719.tar.gz kutter-7a74888b43a7e640a32fd18ae69d9dbdeaf55719.tar.xz kutter-7a74888b43a7e640a32fd18ae69d9dbdeaf55719.zip |
toolhead: Extend flushing slightly past required time
There is no harm in enabling flushing for a little longer than
necessary. In contrast, a slight rounding issue causing a message to
not get flushed properly could result in an error. So, extend the
flushing time slightly to avoid potential issues.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 55a39eff..0d609a4a 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -1,6 +1,6 @@ # Code for coordinating events on the printer toolhead # -# Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import math, logging, importlib @@ -191,6 +191,7 @@ BUFFER_TIME_HIGH = 2.0 BUFFER_TIME_START = 0.250 BGFLUSH_LOW_TIME = 0.200 BGFLUSH_BATCH_TIME = 0.200 +BGFLUSH_EXTRA_TIME = 0.250 MIN_KIN_TIME = 0.100 MOVE_BATCH_TIME = 0.500 STEPCOMPRESS_FLUSH_TIME = 0.050 @@ -428,14 +429,15 @@ class ToolHead: self.check_stall_time = self.print_time # In "NeedPrime"/"Priming" state - flush queues if needed while 1: - if self.last_flush_time >= self.need_flush_time: + end_flush = self.need_flush_time + BGFLUSH_EXTRA_TIME + if self.last_flush_time >= end_flush: self.do_kick_flush_timer = True return self.reactor.NEVER buffer_time = self.last_flush_time - est_print_time if buffer_time > BGFLUSH_LOW_TIME: return eventtime + buffer_time - BGFLUSH_LOW_TIME ftime = est_print_time + BGFLUSH_LOW_TIME + BGFLUSH_BATCH_TIME - self._advance_flush_time(min(self.need_flush_time, ftime)) + self._advance_flush_time(min(end_flush, ftime)) except: logging.exception("Exception in flush_handler") self.printer.invoke_shutdown("Exception in flush_handler") |