aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/idle_timeout.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-06-09 13:33:21 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-06-09 18:44:44 -0400
commit30d2ae8f9fba2aa618363f13d812e8db886dfd97 (patch)
tree1d808f6133a8d9eb5719cee5ef16893ebaa97c2c /klippy/extras/idle_timeout.py
parent962f7b98bd3bafe5ffefc00e22e95a7fab377a10 (diff)
downloadkutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.tar.gz
kutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.tar.xz
kutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/idle_timeout.py')
-rw-r--r--klippy/extras/idle_timeout.py10
1 files changed, 4 insertions, 6 deletions
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