aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2019-10-03 14:59:03 -0700
committerKevinOConnor <kevin@koconnor.net>2019-10-03 17:59:03 -0400
commit004edb961316682cfdb57a7c6166eb06b0d3ca55 (patch)
tree5162c9c9187cc2072c81b014ae9c87506e874b36 /klippy
parent27717440aa4dfc7ab735fd5dc29635c89735918e (diff)
downloadkutter-004edb961316682cfdb57a7c6166eb06b0d3ca55.tar.gz
kutter-004edb961316682cfdb57a7c6166eb06b0d3ca55.tar.xz
kutter-004edb961316682cfdb57a7c6166eb06b0d3ca55.zip
fan: Add off_below option for fans (#1897)
Below off_below the fan will be turned off. When configured correctly this can prevent stalling, which may lead to overheating and failed fans. To simplify calibration and use of this setting, off_below is applied in the input duty cycle domain, prior to any scaling due to e.g. max_power. Signed-off-by: Nicholas Seckar <nseckar@gmail.com>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/fan.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/klippy/extras/fan.py b/klippy/extras/fan.py
index 5f72a780..f11a9e86 100644
--- a/klippy/extras/fan.py
+++ b/klippy/extras/fan.py
@@ -16,6 +16,8 @@ class PrinterFan:
self.max_power = config.getfloat('max_power', 1., above=0., maxval=1.)
self.kick_start_time = config.getfloat('kick_start_time', 0.1,
minval=0.)
+ self.off_below = config.getfloat(
+ 'off_below', default=0., minval=0., maxval=1.)
ppins = printer.lookup_object('pins')
self.mcu_fan = ppins.setup_pin('pwm', config.get('pin'))
self.mcu_fan.setup_max_duration(0.)
@@ -29,6 +31,8 @@ class PrinterFan:
def handle_request_restart(self, print_time):
self.set_speed(print_time, 0.)
def set_speed(self, print_time, value):
+ if value < self.off_below:
+ value = 0.
value = max(0., min(self.max_power, value * self.max_power))
if value == self.last_fan_value:
return