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:
@@ -251,7 +251,7 @@ class ToolHead:
|
||||
self.trapq_append = ffi_lib.trapq_append
|
||||
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
||||
# Motion flushing
|
||||
self.step_generators = []
|
||||
self.motion_queuing = self.printer.load_object(config, 'motion_queuing')
|
||||
self.flush_trapqs = [self.trapq]
|
||||
# Create kinematics class
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
@@ -280,8 +280,7 @@ class ToolHead:
|
||||
sg_flush_want = min(flush_time + STEPCOMPRESS_FLUSH_TIME,
|
||||
self.print_time - self.kin_flush_delay)
|
||||
sg_flush_time = max(sg_flush_want, flush_time)
|
||||
for sg in self.step_generators:
|
||||
sg(sg_flush_time)
|
||||
self.motion_queuing.flush_motion_queues(flush_time, sg_flush_time)
|
||||
self.min_restart_time = max(self.min_restart_time, sg_flush_time)
|
||||
# Free trapq entries that are no longer needed
|
||||
clear_history_time = self.clear_history_time
|
||||
@@ -517,7 +516,7 @@ class ToolHead:
|
||||
def get_extra_axes(self):
|
||||
return [None, None, None] + self.extra_axes
|
||||
# Homing "drip move" handling
|
||||
def drip_update_time(self, next_print_time, drip_completion, addstepper=()):
|
||||
def drip_update_time(self, next_print_time, drip_completion):
|
||||
# Transition from "NeedPrime"/"Priming"/main state to "Drip" state
|
||||
self.special_queuing_state = "Drip"
|
||||
self.need_check_pause = self.reactor.NEVER
|
||||
@@ -539,8 +538,6 @@ class ToolHead:
|
||||
continue
|
||||
npt = min(self.print_time + DRIP_SEGMENT_TIME, next_print_time)
|
||||
self.note_mcu_movequeue_activity(npt + self.kin_flush_delay)
|
||||
for stepper in addstepper:
|
||||
stepper.generate_steps(npt)
|
||||
self._advance_move_time(npt)
|
||||
# Exit "Drip" state
|
||||
self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
|
||||
@@ -617,11 +614,6 @@ class ToolHead:
|
||||
return self.kin
|
||||
def get_trapq(self):
|
||||
return self.trapq
|
||||
def register_step_generator(self, handler):
|
||||
self.step_generators.append(handler)
|
||||
def unregister_step_generator(self, handler):
|
||||
if handler in self.step_generators:
|
||||
self.step_generators.remove(handler)
|
||||
def note_step_generation_scan_time(self, delay, old_delay=0.):
|
||||
self.flush_step_generation()
|
||||
if old_delay:
|
||||
|
||||
Reference in New Issue
Block a user