motion_queuing: Add register_flush_callback()

Move register_flush_callback() from mcu.py code to motion_queuing
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-08-05 00:06:32 -04:00
parent 6f685e9e01
commit c09ca4cf5a
4 changed files with 15 additions and 11 deletions

View File

@@ -20,11 +20,12 @@ class GCodeRequestQueue:
self.rqueue = []
self.next_min_flush_time = 0.
self.toolhead = None
mcu.register_flush_callback(self._flush_notification)
motion_queuing = printer.load_object(config, 'motion_queuing')
motion_queuing.register_flush_callback(self._flush_notification)
printer.register_event_handler("klippy:connect", self._handle_connect)
def _handle_connect(self):
self.toolhead = self.printer.lookup_object('toolhead')
def _flush_notification(self, print_time, clock):
def _flush_notification(self, print_time):
min_sched_time = self.mcu.min_schedule_time()
rqueue = self.rqueue
while rqueue: