motion_queueing: Add flush_steppersync()

Move the mcu.flush_moves() code to motion_queuing.flush_steppersync().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-08-05 00:16:13 -04:00
parent c09ca4cf5a
commit 864c78f24a
3 changed files with 13 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ class PrinterMotionQueuing:
self.flush_callbacks = []
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.steppersync_flush = ffi_lib.steppersync_flush
def allocate_trapq(self):
ffi_main, ffi_lib = chelper.get_ffi()
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
@@ -52,6 +53,17 @@ class PrinterMotionQueuing:
for trapq in self.trapqs:
self.trapq_finalize_moves(trapq, trapq_free_time,
clear_history_time)
def flush_steppersync(self, print_time, clear_history_time):
for mcu, ss in self.steppersyncs:
clock = mcu.print_time_to_clock(print_time)
if clock < 0:
continue
clear_history_clock = \
max(0, mcu.print_time_to_clock(clear_history_time))
ret = self.steppersync_flush(ss, clock, clear_history_clock)
if ret:
raise mcu.error("Internal error in MCU '%s' stepcompress"
% (mcu.get_name(),))
def wipe_trapq(self, trapq):
# Expire any remaining movement in the trapq (force to history list)
NEVER = 9999999999999999.