mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
motion_queuing: Remove flush_steppersync()
Move code from flush_steppersync() to existing flush_motion_queues() and clean_motion_queues() functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7b25d1c06f
commit
1d569a6631
@ -46,26 +46,28 @@ class PrinterMotionQueuing:
|
|||||||
def register_flush_callback(self, callback):
|
def register_flush_callback(self, callback):
|
||||||
self.flush_callbacks.append(callback)
|
self.flush_callbacks.append(callback)
|
||||||
def flush_motion_queues(self, must_flush_time, max_step_gen_time):
|
def flush_motion_queues(self, must_flush_time, max_step_gen_time):
|
||||||
|
# Invoke flush callbacks (if any)
|
||||||
for cb in self.flush_callbacks:
|
for cb in self.flush_callbacks:
|
||||||
cb(must_flush_time)
|
cb(must_flush_time)
|
||||||
|
# Generate itersolve steps
|
||||||
for stepper in self.steppers:
|
for stepper in self.steppers:
|
||||||
stepper.generate_steps(max_step_gen_time)
|
stepper.generate_steps(max_step_gen_time)
|
||||||
def clean_motion_queues(self, trapq_free_time, clear_history_time):
|
# Flush steps from stepcompress and steppersync
|
||||||
for trapq in self.trapqs:
|
|
||||||
self.trapq_finalize_moves(trapq, trapq_free_time,
|
|
||||||
clear_history_time)
|
|
||||||
def flush_steppersync(self, print_time, clear_history_time):
|
|
||||||
for mcu, ss in self.steppersyncs:
|
for mcu, ss in self.steppersyncs:
|
||||||
clock = mcu.print_time_to_clock(print_time)
|
clock = max(0, mcu.print_time_to_clock(must_flush_time))
|
||||||
if clock < 0:
|
|
||||||
continue
|
|
||||||
ret = self.steppersync_flush(ss, clock)
|
ret = self.steppersync_flush(ss, clock)
|
||||||
if ret:
|
if ret:
|
||||||
raise mcu.error("Internal error in MCU '%s' stepcompress"
|
raise mcu.error("Internal error in MCU '%s' stepcompress"
|
||||||
% (mcu.get_name(),))
|
% (mcu.get_name(),))
|
||||||
clear_history_clock = \
|
def clean_motion_queues(self, trapq_free_time, clear_history_time):
|
||||||
max(0, mcu.print_time_to_clock(clear_history_time))
|
# Move processed trapq moves to history list, and expire old history
|
||||||
self.steppersync_history_expire(ss, clear_history_clock)
|
for trapq in self.trapqs:
|
||||||
|
self.trapq_finalize_moves(trapq, trapq_free_time,
|
||||||
|
clear_history_time)
|
||||||
|
# Clean up old history entries in stepcompress objects
|
||||||
|
for mcu, ss in self.steppersyncs:
|
||||||
|
clock = max(0, mcu.print_time_to_clock(clear_history_time))
|
||||||
|
self.steppersync_history_expire(ss, clock)
|
||||||
def wipe_trapq(self, trapq):
|
def wipe_trapq(self, trapq):
|
||||||
# Expire any remaining movement in the trapq (force to history list)
|
# Expire any remaining movement in the trapq (force to history list)
|
||||||
NEVER = 9999999999999999.
|
NEVER = 9999999999999999.
|
||||||
|
@ -284,8 +284,6 @@ class ToolHead:
|
|||||||
clear_history_time = flush_time - MOVE_HISTORY_EXPIRE
|
clear_history_time = flush_time - MOVE_HISTORY_EXPIRE
|
||||||
free_time = sg_flush_time - self.kin_flush_delay
|
free_time = sg_flush_time - self.kin_flush_delay
|
||||||
self.motion_queuing.clean_motion_queues(free_time, clear_history_time)
|
self.motion_queuing.clean_motion_queues(free_time, clear_history_time)
|
||||||
# Flush stepcompress and mcu steppersync
|
|
||||||
self.motion_queuing.flush_steppersync(flush_time, clear_history_time)
|
|
||||||
self.last_flush_time = flush_time
|
self.last_flush_time = flush_time
|
||||||
def _advance_move_time(self, next_print_time):
|
def _advance_move_time(self, next_print_time):
|
||||||
pt_delay = self.kin_flush_delay + STEPCOMPRESS_FLUSH_TIME
|
pt_delay = self.kin_flush_delay + STEPCOMPRESS_FLUSH_TIME
|
||||||
|
Loading…
x
Reference in New Issue
Block a user