aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/G-Codes.md2
-rw-r--r--klippy/extras/idle_timeout.py12
2 files changed, 14 insertions, 0 deletions
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index 6f895e52..3c885677 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -160,6 +160,8 @@ The following standard commands are supported:
for calibrating a Z position_endstop config setting. See the
MANUAL_PROBE command for details on the parameters and the
additional commands available while the tool is active.
+- `SET_IDLE_TIMEOUT [TIMEOUT=<timeout>]`: Allows the user to set the
+ idle timeout (in seconds).
- `RESTART`: This will cause the host software to reload its config
and perform an internal reset. This command will not clear error
state from the micro-controller (see FIRMWARE_RESTART) nor will it
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)