toolhead: Delay calculating homing print_time until ready to move
If the homing move is exceptionally long, it could take a long time for the host to process the look-ahead queue. Delay the print_time calculation until moves are ready to be sent. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
bc78bc4864
commit
977d0cf711
|
@ -244,6 +244,7 @@ class ToolHead:
|
||||||
self.idle_flush_print_time = 0.
|
self.idle_flush_print_time = 0.
|
||||||
self.print_stall = 0
|
self.print_stall = 0
|
||||||
self.drip_completion = None
|
self.drip_completion = None
|
||||||
|
self.drip_need_calc_print_time = False
|
||||||
# Setup iterative solver
|
# Setup iterative solver
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free)
|
self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free)
|
||||||
|
@ -292,6 +293,9 @@ class ToolHead:
|
||||||
return self.print_time
|
return self.print_time
|
||||||
if self.special_queuing_state == "Drip":
|
if self.special_queuing_state == "Drip":
|
||||||
# In "Drip" state - wait until ready to send next move
|
# In "Drip" state - wait until ready to send next move
|
||||||
|
if self.drip_need_calc_print_time:
|
||||||
|
self.drip_need_calc_print_time = False
|
||||||
|
self._calc_print_time()
|
||||||
while 1:
|
while 1:
|
||||||
if self.drip_completion.test():
|
if self.drip_completion.test():
|
||||||
raise DripModeEndSignal()
|
raise DripModeEndSignal()
|
||||||
|
@ -434,6 +438,7 @@ class ToolHead:
|
||||||
self.reactor.update_timer(self.flush_timer, self.reactor.NEVER)
|
self.reactor.update_timer(self.flush_timer, self.reactor.NEVER)
|
||||||
self.move_queue.set_flush_time(self.reactor.NEVER)
|
self.move_queue.set_flush_time(self.reactor.NEVER)
|
||||||
self.drip_completion = self.reactor.completion()
|
self.drip_completion = self.reactor.completion()
|
||||||
|
self.drip_need_calc_print_time = True
|
||||||
# Split move into many tiny moves and queue them
|
# Split move into many tiny moves and queue them
|
||||||
num_moves = max(1, int(math.ceil(move.min_move_t / DRIP_SEGMENT_TIME)))
|
num_moves = max(1, int(math.ceil(move.min_move_t / DRIP_SEGMENT_TIME)))
|
||||||
inv_num_moves = 1. / float(num_moves)
|
inv_num_moves = 1. / float(num_moves)
|
||||||
|
@ -445,7 +450,6 @@ class ToolHead:
|
||||||
prev_pos = next_pos
|
prev_pos = next_pos
|
||||||
self.move_queue.add_move(Move(self, prev_pos, move.end_pos, speed))
|
self.move_queue.add_move(Move(self, prev_pos, move.end_pos, speed))
|
||||||
# Transmit moves
|
# Transmit moves
|
||||||
self._calc_print_time()
|
|
||||||
try:
|
try:
|
||||||
self.move_queue.flush()
|
self.move_queue.flush()
|
||||||
except DripModeEndSignal as e:
|
except DripModeEndSignal as e:
|
||||||
|
|
Loading…
Reference in New Issue