aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2024-09-13 00:59:44 -0400
committerKevin O'Connor <kevin@koconnor.net>2024-09-13 00:59:44 -0400
commitcc4ad6670f5f99e83525b052716c144392c104f3 (patch)
tree61b61654b64af5c6d8904c408489a1c34fd294c7
parent28995a8bce34aad7eb33e9447f5905ca998d08d7 (diff)
downloadkutter-cc4ad6670f5f99e83525b052716c144392c104f3.tar.gz
kutter-cc4ad6670f5f99e83525b052716c144392c104f3.tar.xz
kutter-cc4ad6670f5f99e83525b052716c144392c104f3.zip
output_pin: Keep flushing GCodeRequestQueue if needed
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/extras/output_pin.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/klippy/extras/output_pin.py b/klippy/extras/output_pin.py
index 3b55a0a7..3d7a952c 100644
--- a/klippy/extras/output_pin.py
+++ b/klippy/extras/output_pin.py
@@ -22,24 +22,24 @@ class GCodeRequestQueue:
self.toolhead = self.printer.lookup_object('toolhead')
def _flush_notification(self, print_time, clock):
rqueue = self.rqueue
- if not rqueue:
- return
- next_time = max(rqueue[0][0], self.next_min_flush_time)
- if next_time > print_time:
- return
- # Skip requests that have been overridden with a following request
- pos = 0
- while pos + 1 < len(rqueue) and rqueue[pos + 1][0] <= next_time:
- pos += 1
- req_pt, req_val = rqueue[pos]
- # Invoke callback for the request
- want_dequeue, min_wait_time = self.callback(next_time, req_val)
- self.next_min_flush_time = next_time + max(min_wait_time, PIN_MIN_TIME)
- if want_dequeue:
- pos += 1
- del rqueue[:pos]
- # Ensure following queue items are flushed
- self.toolhead.note_mcu_movequeue_activity(self.next_min_flush_time)
+ while rqueue:
+ next_time = max(rqueue[0][0], self.next_min_flush_time)
+ if next_time > print_time:
+ return
+ # Skip requests that have been overridden with a following request
+ pos = 0
+ while pos + 1 < len(rqueue) and rqueue[pos + 1][0] <= next_time:
+ pos += 1
+ req_pt, req_val = rqueue[pos]
+ # Invoke callback for the request
+ want_dequeue, min_wait_time = self.callback(next_time, req_val)
+ self.next_min_flush_time = next_time + max(min_wait_time,
+ PIN_MIN_TIME)
+ if want_dequeue:
+ pos += 1
+ del rqueue[:pos]
+ # Ensure following queue items are flushed
+ self.toolhead.note_mcu_movequeue_activity(self.next_min_flush_time)
def queue_request(self, print_time, value):
self.rqueue.append((print_time, value))
self.toolhead.note_mcu_movequeue_activity(print_time)