motion_queuing: Track all trapqs and globally flush all trapqs

Add an allocate_trapq() helper function to facilitate the creation of
a low-level C trapq object.  Track all trapq objects and clear history
on them globally when the main motion queues are flushed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-08-04 22:41:15 -04:00
parent 9399e738bc
commit 5cbe7d83e8
5 changed files with 36 additions and 38 deletions

View File

@@ -163,10 +163,9 @@ class PrinterExtruder:
self.instant_corner_v = config.getfloat(
'instantaneous_corner_velocity', 1., minval=0.)
# Setup extruder trapq (trapezoidal motion queue)
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.motion_queuing = self.printer.load_object(config, 'motion_queuing')
self.trapq = self.motion_queuing.allocate_trapq()
self.trapq_append = self.motion_queuing.lookup_trapq_append()
# Setup extruder stepper
self.extruder_stepper = None
if (config.get('step_pin', None) is not None