idle_timeout: Use new GCodeCommand wrappers

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-04-24 22:20:29 -04:00
parent 1d2bb5a412
commit fb16e8810b
1 changed files with 4 additions and 7 deletions

View File

@ -98,16 +98,13 @@ class IdleTimeout:
self.reactor.update_timer(self.timeout_timer, curtime + check_time) self.reactor.update_timer(self.timeout_timer, curtime + check_time)
self.printer.send_event("idle_timeout:printing", self.printer.send_event("idle_timeout:printing",
est_print_time + PIN_MIN_TIME) est_print_time + PIN_MIN_TIME)
def cmd_SET_IDLE_TIMEOUT(self, params): def cmd_SET_IDLE_TIMEOUT(self, gcmd):
timeout = self.gcode.get_float( timeout = gcmd.get_float('TIMEOUT', self.idle_timeout, above=0.)
'TIMEOUT', params, self.idle_timeout, above=0.)
self.idle_timeout = timeout self.idle_timeout = timeout
self.gcode.respond_info( gcmd.respond_info("idle_timeout: Timeout set to %.2f s" % (timeout,))
"idle_timeout: Timeout set to %.2f s" % timeout)
if self.state == "Ready": if self.state == "Ready":
checktime = self.reactor.monotonic() + timeout checktime = self.reactor.monotonic() + timeout
self.reactor.update_timer( self.reactor.update_timer(self.timeout_timer, checktime)
self.timeout_timer, checktime)
def load_config(config): def load_config(config):
return IdleTimeout(config) return IdleTimeout(config)