mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
motion_queuing: Add allocate_steppersync() call
Allocate the low-level C steppersync object from the motion_queuing module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
5cbe7d83e8
commit
128226fe8a
@ -11,6 +11,7 @@ class PrinterMotionQueuing:
|
|||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.steppers = []
|
self.steppers = []
|
||||||
self.trapqs = []
|
self.trapqs = []
|
||||||
|
self.steppersyncs = []
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
||||||
def allocate_trapq(self):
|
def allocate_trapq(self):
|
||||||
@ -18,6 +19,14 @@ class PrinterMotionQueuing:
|
|||||||
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
|
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
|
||||||
self.trapqs.append(trapq)
|
self.trapqs.append(trapq)
|
||||||
return trapq
|
return trapq
|
||||||
|
def allocate_steppersync(self, mcu, serialqueue, stepqueues, move_count):
|
||||||
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
|
ss = ffi_main.gc(
|
||||||
|
ffi_lib.steppersync_alloc(serialqueue, stepqueues, len(stepqueues),
|
||||||
|
move_count),
|
||||||
|
ffi_lib.steppersync_free)
|
||||||
|
self.steppersyncs.append((mcu, ss))
|
||||||
|
return ss
|
||||||
def register_stepper(self, config, stepper):
|
def register_stepper(self, config, stepper):
|
||||||
self.steppers.append(stepper)
|
self.steppers.append(stepper)
|
||||||
def flush_motion_queues(self, must_flush_time, max_step_gen_time):
|
def flush_motion_queues(self, must_flush_time, max_step_gen_time):
|
||||||
|
@ -770,13 +770,13 @@ class MCU:
|
|||||||
move_count = config_params['move_count']
|
move_count = config_params['move_count']
|
||||||
if move_count < self._reserved_move_slots:
|
if move_count < self._reserved_move_slots:
|
||||||
raise error("Too few moves available on MCU '%s'" % (self._name,))
|
raise error("Too few moves available on MCU '%s'" % (self._name,))
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ss_move_count = move_count - self._reserved_move_slots
|
||||||
self._steppersync = ffi_main.gc(
|
motion_queuing = self._printer.lookup_object('motion_queuing')
|
||||||
ffi_lib.steppersync_alloc(self._serial.get_serialqueue(),
|
self._steppersync = motion_queuing.allocate_steppersync(
|
||||||
self._stepqueues, len(self._stepqueues),
|
self, self._serial.get_serialqueue(),
|
||||||
move_count-self._reserved_move_slots),
|
self._stepqueues, ss_move_count)
|
||||||
ffi_lib.steppersync_free)
|
self._ffi_lib.steppersync_set_time(self._steppersync,
|
||||||
ffi_lib.steppersync_set_time(self._steppersync, 0., self._mcu_freq)
|
0., self._mcu_freq)
|
||||||
# Log config information
|
# Log config information
|
||||||
move_msg = "Configured MCU '%s' (%d moves)" % (self._name, move_count)
|
move_msg = "Configured MCU '%s' (%d moves)" % (self._name, move_count)
|
||||||
logging.info(move_msg)
|
logging.info(move_msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user