diff options
Diffstat (limited to 'klippy/extras/fan.py')
-rw-r--r-- | klippy/extras/fan.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/klippy/extras/fan.py b/klippy/extras/fan.py index 77fdef8a..d6e68721 100644 --- a/klippy/extras/fan.py +++ b/klippy/extras/fan.py @@ -30,6 +30,12 @@ class Fan: shutdown_power = max(0., min(self.max_power, shutdown_speed)) self.mcu_fan.setup_start_value(0., shutdown_power) + self.enable_pin = None + enable_pin = config.get('enable_pin', None) + if enable_pin is not None: + self.enable_pin = ppins.setup_pin('digital_out', enable_pin) + self.enable_pin.setup_max_duration(0.) + # Setup tachometer self.tachometer = FanTachometer(config) @@ -46,6 +52,11 @@ class Fan: if value == self.last_fan_value: return print_time = max(self.last_fan_time + FAN_MIN_TIME, print_time) + if self.enable_pin: + if value > 0 and self.last_fan_value == 0: + self.enable_pin.set_digital(print_time, 1) + elif value == 0 and self.last_fan_value > 0: + self.enable_pin.set_digital(print_time, 0) if (value and value < self.max_power and self.kick_start_time and (not self.last_fan_value or value - self.last_fan_value > .5)): # Run fan at full speed for specified kick_start_time |