mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
motion_queuing: Move clear_history_time from toolhead to motion_queuing
Implement the 30 second clear_history_time offset checking directly in the motion_queuing module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
6d59279438
commit
b5e573957c
@ -6,6 +6,8 @@
|
||||
import logging
|
||||
import chelper
|
||||
|
||||
MOVE_HISTORY_EXPIRE = 30.
|
||||
|
||||
class PrinterMotionQueuing:
|
||||
def __init__(self, config):
|
||||
self.printer = config.get_printer()
|
||||
@ -18,6 +20,9 @@ class PrinterMotionQueuing:
|
||||
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
||||
self.steppersync_flush = ffi_lib.steppersync_flush
|
||||
self.steppersync_history_expire = ffi_lib.steppersync_history_expire
|
||||
self.clear_history_time = 0.
|
||||
is_debug = self.printer.get_start_args().get('debugoutput') is not None
|
||||
self.is_debugoutput = is_debug
|
||||
def allocate_trapq(self):
|
||||
ffi_main, ffi_lib = chelper.get_ffi()
|
||||
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
|
||||
@ -59,7 +64,10 @@ class PrinterMotionQueuing:
|
||||
if ret:
|
||||
raise mcu.error("Internal error in MCU '%s' stepcompress"
|
||||
% (mcu.get_name(),))
|
||||
def clean_motion_queues(self, trapq_free_time, clear_history_time):
|
||||
def clean_motion_queues(self, trapq_free_time):
|
||||
clear_history_time = self.clear_history_time
|
||||
if self.is_debugoutput:
|
||||
clear_history_time = trapq_free_time - MOVE_HISTORY_EXPIRE
|
||||
# Move processed trapq moves to history list, and expire old history
|
||||
for trapq in self.trapqs:
|
||||
self.trapq_finalize_moves(trapq, trapq_free_time,
|
||||
@ -75,6 +83,11 @@ class PrinterMotionQueuing:
|
||||
def lookup_trapq_append(self):
|
||||
ffi_main, ffi_lib = chelper.get_ffi()
|
||||
return ffi_lib.trapq_append
|
||||
def stats(self, eventtime):
|
||||
mcu = self.printer.lookup_object('mcu')
|
||||
est_print_time = mcu.estimated_print_time(eventtime)
|
||||
self.clear_history_time = est_print_time - MOVE_HISTORY_EXPIRE
|
||||
return False, ""
|
||||
|
||||
def load_config(config):
|
||||
return PrinterMotionQueuing(config)
|
||||
|
@ -200,7 +200,6 @@ MIN_KIN_TIME = 0.100
|
||||
MOVE_BATCH_TIME = 0.500
|
||||
STEPCOMPRESS_FLUSH_TIME = 0.050
|
||||
SDS_CHECK_TIME = 0.001 # step+dir+step filter in stepcompress.c
|
||||
MOVE_HISTORY_EXPIRE = 30.
|
||||
|
||||
DRIP_SEGMENT_TIME = 0.050
|
||||
DRIP_TIME = 0.100
|
||||
@ -241,7 +240,7 @@ class ToolHead:
|
||||
self.flush_timer = self.reactor.register_timer(self._flush_handler)
|
||||
self.do_kick_flush_timer = True
|
||||
self.last_flush_time = self.min_restart_time = 0.
|
||||
self.need_flush_time = self.step_gen_time = self.clear_history_time = 0.
|
||||
self.need_flush_time = self.step_gen_time = 0.
|
||||
# Kinematic step generation scan window time tracking
|
||||
self.kin_flush_delay = SDS_CHECK_TIME
|
||||
self.kin_flush_times = []
|
||||
@ -279,11 +278,8 @@ class ToolHead:
|
||||
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
|
||||
if not self.can_pause:
|
||||
clear_history_time = flush_time - MOVE_HISTORY_EXPIRE
|
||||
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)
|
||||
self.last_flush_time = flush_time
|
||||
def _advance_move_time(self, next_print_time):
|
||||
pt_delay = self.kin_flush_delay + STEPCOMPRESS_FLUSH_TIME
|
||||
@ -561,7 +557,6 @@ class ToolHead:
|
||||
for m in self.all_mcus:
|
||||
m.check_active(max_queue_time, eventtime)
|
||||
est_print_time = self.mcu.estimated_print_time(eventtime)
|
||||
self.clear_history_time = est_print_time - MOVE_HISTORY_EXPIRE
|
||||
buffer_time = self.print_time - est_print_time
|
||||
is_active = buffer_time > -60. or not self.special_queuing_state
|
||||
if self.special_queuing_state == "Drip":
|
||||
|
Loading…
x
Reference in New Issue
Block a user