aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/idle_timeout.py
diff options
context:
space:
mode:
authorArksine <arksine.code@gmail.com>2019-05-21 20:47:33 -0400
committerKevinOConnor <kevin@koconnor.net>2019-06-04 09:46:26 -0400
commita238ec6f98e78af9d398c68b74d73f3254e0cbf3 (patch)
treee9d6deed5d9f64ae07fccba4dd8e4a9a2f0be293 /klippy/extras/idle_timeout.py
parentfe1c57b098f60045936c5cb946338a58050aef97 (diff)
downloadkutter-a238ec6f98e78af9d398c68b74d73f3254e0cbf3.tar.gz
kutter-a238ec6f98e78af9d398c68b74d73f3254e0cbf3.tar.xz
kutter-a238ec6f98e78af9d398c68b74d73f3254e0cbf3.zip
idle_timeout: Add SET_IDLE_TIMEOUT gcode
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Diffstat (limited to 'klippy/extras/idle_timeout.py')
-rw-r--r--klippy/extras/idle_timeout.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/klippy/extras/idle_timeout.py b/klippy/extras/idle_timeout.py
index b422f388..848852e8 100644
--- a/klippy/extras/idle_timeout.py
+++ b/klippy/extras/idle_timeout.py
@@ -23,6 +23,8 @@ class IdleTimeout:
self.state = "Idle"
self.idle_timeout = config.getfloat('timeout', 600., above=0.)
self.idle_gcode = config.get('gcode', DEFAULT_IDLE_GCODE).split('\n')
+ self.gcode.register_command(
+ 'SET_IDLE_TIMEOUT', self.cmd_SET_IDLE_TIMEOUT)
def handle_ready(self):
self.toolhead = self.printer.lookup_object('toolhead')
self.timeout_timer = self.reactor.register_timer(self.timeout_handler)
@@ -88,6 +90,16 @@ class IdleTimeout:
self.reactor.update_timer(self.timeout_timer, curtime + check_time)
self.printer.send_event("idle_timeout:printing",
est_print_time + PIN_MIN_TIME)
+ def cmd_SET_IDLE_TIMEOUT(self, params):
+ timeout = self.gcode.get_float(
+ 'TIMEOUT', params, self.idle_timeout, above=0.)
+ self.idle_timeout = timeout
+ self.gcode.respond_info(
+ "idle_timeout: Timeout set to %.2f s" % timeout)
+ if self.state == "Ready":
+ checktime = self.reactor.monotonic() + timeout
+ self.reactor.update_timer(
+ self.timeout_timer, checktime)
def load_config(config):
return IdleTimeout(config)