aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/fan.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-05-18 19:12:03 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-05-18 19:12:03 -0400
commit2740838b2ef9bbf661de8a192b831990a5c08e38 (patch)
tree83e8293c0b0584a36ab8d223e6f3b6cca90958e2 /klippy/extras/fan.py
parent5712283e9192b93cd614a9e632493f9d530a446f (diff)
downloadkutter-2740838b2ef9bbf661de8a192b831990a5c08e38.tar.gz
kutter-2740838b2ef9bbf661de8a192b831990a5c08e38.tar.xz
kutter-2740838b2ef9bbf661de8a192b831990a5c08e38.zip
fan: Allow the fan shutdown_speed to be configured
Add a shutdown_speed config option to fans so that users can specify the speed on a shutdown event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/fan.py')
-rw-r--r--klippy/extras/fan.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/klippy/extras/fan.py b/klippy/extras/fan.py
index cbd0d464..d69c1127 100644
--- a/klippy/extras/fan.py
+++ b/klippy/extras/fan.py
@@ -7,7 +7,7 @@
FAN_MIN_TIME = 0.100
class PrinterFan:
- def __init__(self, config):
+ def __init__(self, config, default_shutdown_speed=0.):
self.last_fan_value = 0.
self.last_fan_time = 0.
self.max_power = config.getfloat('max_power', 1., above=0., maxval=1.)
@@ -18,8 +18,10 @@ class PrinterFan:
cycle_time = config.getfloat('cycle_time', 0.010, above=0.)
hardware_pwm = config.getboolean('hardware_pwm', False)
self.mcu_fan.setup_cycle_time(cycle_time, hardware_pwm)
- def set_shutdown_speed(self, speed):
- self.mcu_fan.setup_start_value(0., max(0., min(self.max_power, speed)))
+ shutdown_speed = config.getfloat(
+ 'shutdown_speed', default_shutdown_speed, minval=0., maxval=1.)
+ self.mcu_fan.setup_start_value(
+ 0., max(0., min(self.max_power, shutdown_speed)))
def set_speed(self, print_time, value):
value = max(0., min(self.max_power, value * self.max_power))
if value == self.last_fan_value: