aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-08-17 10:20:12 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-08-17 10:20:12 -0400
commit1b07be070b48c3f60b17ea8e8b19f1f52864ece3 (patch)
tree51681ba983b3db7e1e6fec05117e37a1db9a7085
parente88eab18d0a51b5ce0cd6d572aea57e547c2da2c (diff)
downloadkutter-1b07be070b48c3f60b17ea8e8b19f1f52864ece3.tar.gz
kutter-1b07be070b48c3f60b17ea8e8b19f1f52864ece3.tar.xz
kutter-1b07be070b48c3f60b17ea8e8b19f1f52864ece3.zip
heater_fan: Allow multiple heaters to be defined for a heater_fan
Support the case where a single cooling fan is used with multiple extruders. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--config/example-extras.cfg4
-rw-r--r--klippy/extras/heater_fan.py11
2 files changed, 10 insertions, 5 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg
index 5cf33a40..9788fa1e 100644
--- a/config/example-extras.cfg
+++ b/config/example-extras.cfg
@@ -298,7 +298,9 @@
# above parameters.
#heater: extruder
# Name of the config section defining the heater that this fan is
-# associated with. The default is "extruder".
+# associated with. If a comma separated list of heater names is
+# provided here, then the fan will be enabled when any of the given
+# heaters are enabled. The default is "extruder".
#heater_temp: 50.0
# A temperature (in Celsius) that the heater must drop below before
# the fan is disabled. The default is 50 Celsius.
diff --git a/klippy/extras/heater_fan.py b/klippy/extras/heater_fan.py
index 1e67c5a2..94b2679e 100644
--- a/klippy/extras/heater_fan.py
+++ b/klippy/extras/heater_fan.py
@@ -12,20 +12,23 @@ class PrinterHeaterFan:
self.printer = config.get_printer()
self.heater_name = config.get("heater", "extruder0")
self.heater_temp = config.getfloat("heater_temp", 50.0)
+ self.heaters = []
self.fan = fan.PrinterFan(config, default_shutdown_speed=1.)
self.mcu = self.fan.mcu_fan.get_mcu()
self.fan_speed = config.getfloat("fan_speed", 1., minval=0., maxval=1.)
def printer_state(self, state):
if state == 'ready':
pheater = self.printer.lookup_object('heater')
- self.heater = pheater.lookup_heater(self.heater_name)
+ self.heaters = [pheater.lookup_heater(n.strip())
+ for n in self.heater_name.split(',')]
reactor = self.printer.get_reactor()
reactor.register_timer(self.callback, reactor.NOW)
def callback(self, eventtime):
- current_temp, target_temp = self.heater.get_temp(eventtime)
power = 0.
- if target_temp or current_temp > self.heater_temp:
- power = self.fan_speed
+ for heater in self.heaters:
+ current_temp, target_temp = heater.get_temp(eventtime)
+ if target_temp or current_temp > self.heater_temp:
+ power = self.fan_speed
print_time = self.mcu.estimated_print_time(eventtime) + PIN_MIN_TIME
self.fan.set_speed(print_time, power)
return eventtime + 1.