diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-09-18 16:00:13 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-09-18 16:01:07 -0400 |
commit | 174754299a88c2fa2207b867aa2c2c653eb7a9e0 (patch) | |
tree | 2a9f180724c1c420d4ce002e47ac2583d8f1738f /klippy | |
parent | 7b6a44e8f93fd6068facc0c4870d1e350eb82218 (diff) | |
download | kutter-174754299a88c2fa2207b867aa2c2c653eb7a9e0.tar.gz kutter-174754299a88c2fa2207b867aa2c2c653eb7a9e0.tar.xz kutter-174754299a88c2fa2207b867aa2c2c653eb7a9e0.zip |
heater: Add new TURN_OFF_HEATERS command
Add a command that will turn off all heaters in the printer. Run this
command in the default idle_timeout action.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/idle_timeout.py | 1 | ||||
-rw-r--r-- | klippy/heater.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/klippy/extras/idle_timeout.py b/klippy/extras/idle_timeout.py index ac91cbcf..7ead83e2 100644 --- a/klippy/extras/idle_timeout.py +++ b/klippy/extras/idle_timeout.py @@ -5,6 +5,7 @@ # This file may be distributed under the terms of the GNU GPLv3 license. DEFAULT_IDLE_GCODE = """ +TURN_OFF_HEATERS M84 """ diff --git a/klippy/heater.py b/klippy/heater.py index ee27f72e..4a5873da 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -220,6 +220,10 @@ class PrinterHeaters: self.printer = config.get_printer() self.sensors = {} self.heaters = {} + # Register TURN_OFF_HEATERS command + gcode = self.printer.lookup_object('gcode') + gcode.register_command("TURN_OFF_HEATERS", self.cmd_TURN_OFF_HEATERS, + desc=self.cmd_TURN_OFF_HEATERS_help) def add_sensor(self, sensor_type, sensor_factory): self.sensors[sensor_type] = sensor_factory def setup_heater(self, config): @@ -249,6 +253,11 @@ class PrinterHeaters: raise self.printer.config_error("Unknown temperature sensor '%s'" % ( sensor_type,)) return self.sensors[sensor_type](config) + cmd_TURN_OFF_HEATERS_help = "Turn off all heaters" + def cmd_TURN_OFF_HEATERS(self, params): + print_time = self.printer.lookup_object('toolhead').get_last_move_time() + for heater in self.heaters.values(): + heater.set_temp(print_time, 0.) def add_printer_objects(config): config.get_printer().add_object('heater', PrinterHeaters(config)) |