aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/fan.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/fan.py')
-rw-r--r--klippy/fan.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/klippy/fan.py b/klippy/fan.py
index 6a5766ef..a46dc24e 100644
--- a/klippy/fan.py
+++ b/klippy/fan.py
@@ -3,8 +3,7 @@
# Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-
-import extruder
+import extruder, pins
FAN_MIN_TIME = 0.1
PWM_CYCLE_TIME = 0.010
@@ -15,9 +14,10 @@ class PrinterFan:
self.last_fan_time = 0.
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.)
- pin = config.get('pin')
- hard_pwm = config.getint('hard_pwm', 0)
- self.mcu_fan = printer.mcu.create_pwm(pin, PWM_CYCLE_TIME, hard_pwm, 0.)
+ self.mcu_fan = pins.setup_pin(printer, 'pwm', config.get('pin'))
+ self.mcu_fan.setup_max_duration(0.)
+ self.mcu_fan.setup_cycle_time(PWM_CYCLE_TIME)
+ self.mcu_fan.setup_hard_pwm(config.getint('hard_pwm', 0))
def set_pwm(self, mcu_time, value):
value = max(0., min(self.max_power, value))
if value == self.last_fan_value: