From 30d2ae8f9fba2aa618363f13d812e8db886dfd97 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 9 Jun 2019 13:33:21 -0400 Subject: gcode: Eliminate the process_batch() method Allow the callers of process_batch() to directly inspect the gcode mutex. Those callers can then directly invoke run_script(). Signed-off-by: Kevin O'Connor --- klippy/extras/idle_timeout.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'klippy/extras/idle_timeout.py') diff --git a/klippy/extras/idle_timeout.py b/klippy/extras/idle_timeout.py index f12d1aa0..260011a6 100644 --- a/klippy/extras/idle_timeout.py +++ b/klippy/extras/idle_timeout.py @@ -42,12 +42,10 @@ class IdleTimeout: self.state = "Printing" try: script = self.idle_gcode.render() - res = self.gcode.process_batch(script.split('\n')) + res = self.gcode.run_script(script) except: logging.exception("idle timeout gcode execution") - return eventtime + 1. - if not res: - # Raced with incoming g-code commands + self.state = "Ready" return eventtime + 1. print_time = self.toolhead.get_last_move_time() self.state = "Idle" @@ -64,7 +62,7 @@ class IdleTimeout: if idle_time < self.idle_timeout: # Wait for idle timeout return eventtime + self.idle_timeout - idle_time - if not self.gcode.process_batch([]): + if self.gcode.get_mutex().test(): # Gcode class busy return eventtime + 1. # Idle timeout has elapsed @@ -82,7 +80,7 @@ class IdleTimeout: if buffer_time > -READY_TIMEOUT: # Wait for ready timeout return eventtime + READY_TIMEOUT + buffer_time - if not self.gcode.process_batch([]): + if self.gcode.get_mutex().test(): # Gcode class busy return eventtime + READY_TIMEOUT # Transition to "ready" state -- cgit v1.2.3-70-g09d2