motion_queuing: Add allocate_stepcompress() call

Allocate the low-level C stepcompress object in the motion_queuing
module.  This simplifies the mcu.py code as it no longer needs to
track the stepqueues for the steppersync object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-08-04 23:52:59 -04:00
parent 128226fe8a
commit 6f685e9e01
4 changed files with 34 additions and 29 deletions

View File

@@ -11,6 +11,7 @@ class PrinterMotionQueuing:
self.printer = config.get_printer()
self.steppers = []
self.trapqs = []
self.stepcompress = []
self.steppersyncs = []
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
@@ -19,7 +20,17 @@ class PrinterMotionQueuing:
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapqs.append(trapq)
return trapq
def allocate_steppersync(self, mcu, serialqueue, stepqueues, move_count):
def allocate_stepcompress(self, mcu, oid):
ffi_main, ffi_lib = chelper.get_ffi()
sc = ffi_main.gc(ffi_lib.stepcompress_alloc(oid),
ffi_lib.stepcompress_free)
self.stepcompress.append((mcu, sc))
return sc
def allocate_steppersync(self, mcu, serialqueue, move_count):
stepqueues = []
for sc_mcu, sc in self.stepcompress:
if sc_mcu is mcu:
stepqueues.append(sc)
ffi_main, ffi_lib = chelper.get_ffi()
ss = ffi_main.gc(
ffi_lib.steppersync_alloc(serialqueue, stepqueues, len(stepqueues),