motion_queuing: Add new module to help with motion queues and flushing
Create a new module to assist with host management of motion queues. Register all MCU_stepper objects with this module and use the module for step generation. All steppers will now automatically generate steps whenever toolhead._advance_flush_time() is invoked. It is no longer necessary for callers to individually call stepper.generate_steps(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
19
klippy/extras/motion_queuing.py
Normal file
19
klippy/extras/motion_queuing.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Helper code for low-level motion queuing and flushing
|
||||
#
|
||||
# Copyright (C) 2025 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import logging
|
||||
|
||||
class PrinterMotionQueuing:
|
||||
def __init__(self, config):
|
||||
self.printer = config.get_printer()
|
||||
self.steppers = []
|
||||
def register_stepper(self, config, stepper):
|
||||
self.steppers.append(stepper)
|
||||
def flush_motion_queues(self, must_flush_time, max_step_gen_time):
|
||||
for stepper in self.steppers:
|
||||
stepper.generate_steps(max_step_gen_time)
|
||||
|
||||
def load_config(config):
|
||||
return PrinterMotionQueuing(config)
|
||||
Reference in New Issue
Block a user