motion_queuing: Further improve step flushing in batches

Further encourage flushing steps in batches by delaying flushing if a
batch isn't needed yet.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2025-09-15 14:19:02 -04:00
parent f341031834
commit 4c46b80f38

View file

@ -189,9 +189,11 @@ class PrinterMotionQueuing:
want_sg_time = est_print_time + BGFLUSH_SG_HIGH_TIME
batch_time = BGFLUSH_SG_HIGH_TIME - BGFLUSH_SG_LOW_TIME
next_batch_time = self.last_step_gen_time + batch_time
if (next_batch_time > est_print_time
and next_batch_time < want_sg_time + 0.005):
if next_batch_time > est_print_time:
# Improve run-to-run reproducibility by batching from last
if next_batch_time > want_sg_time:
# Delay flushing until next wakeup
next_batch_time = self.last_step_gen_time
want_sg_time = next_batch_time
want_sg_time = min(want_sg_time, aggr_sg_time)
# Flush motion queues (if needed)