mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
motion_queueing: Add flush_steppersync()
Move the mcu.flush_moves() code to motion_queuing.flush_steppersync(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c09ca4cf5a
commit
864c78f24a
@ -16,6 +16,7 @@ class PrinterMotionQueuing:
|
|||||||
self.flush_callbacks = []
|
self.flush_callbacks = []
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
||||||
|
self.steppersync_flush = ffi_lib.steppersync_flush
|
||||||
def allocate_trapq(self):
|
def allocate_trapq(self):
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
|
trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
|
||||||
@ -52,6 +53,17 @@ class PrinterMotionQueuing:
|
|||||||
for trapq in self.trapqs:
|
for trapq in self.trapqs:
|
||||||
self.trapq_finalize_moves(trapq, trapq_free_time,
|
self.trapq_finalize_moves(trapq, trapq_free_time,
|
||||||
clear_history_time)
|
clear_history_time)
|
||||||
|
def flush_steppersync(self, print_time, clear_history_time):
|
||||||
|
for mcu, ss in self.steppersyncs:
|
||||||
|
clock = mcu.print_time_to_clock(print_time)
|
||||||
|
if clock < 0:
|
||||||
|
continue
|
||||||
|
clear_history_clock = \
|
||||||
|
max(0, mcu.print_time_to_clock(clear_history_time))
|
||||||
|
ret = self.steppersync_flush(ss, clock, clear_history_clock)
|
||||||
|
if ret:
|
||||||
|
raise mcu.error("Internal error in MCU '%s' stepcompress"
|
||||||
|
% (mcu.get_name(),))
|
||||||
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.
|
||||||
|
@ -970,19 +970,6 @@ class MCU:
|
|||||||
# Move queue tracking
|
# Move queue tracking
|
||||||
def request_move_queue_slot(self):
|
def request_move_queue_slot(self):
|
||||||
self._reserved_move_slots += 1
|
self._reserved_move_slots += 1
|
||||||
def flush_moves(self, print_time, clear_history_time):
|
|
||||||
if self._steppersync is None:
|
|
||||||
return
|
|
||||||
clock = self.print_time_to_clock(print_time)
|
|
||||||
if clock < 0:
|
|
||||||
return
|
|
||||||
clear_history_clock = \
|
|
||||||
max(0, self.print_time_to_clock(clear_history_time))
|
|
||||||
ret = self._ffi_lib.steppersync_flush(self._steppersync, clock,
|
|
||||||
clear_history_clock)
|
|
||||||
if ret:
|
|
||||||
raise error("Internal error in MCU '%s' stepcompress"
|
|
||||||
% (self._name,))
|
|
||||||
def check_active(self, print_time, eventtime):
|
def check_active(self, print_time, eventtime):
|
||||||
if self._steppersync is None:
|
if self._steppersync is None:
|
||||||
return
|
return
|
||||||
|
@ -285,8 +285,7 @@ class ToolHead:
|
|||||||
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
|
# Flush stepcompress and mcu steppersync
|
||||||
for m in self.all_mcus:
|
self.motion_queuing.flush_steppersync(flush_time, clear_history_time)
|
||||||
m.flush_moves(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