diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-29 12:54:06 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-29 13:08:15 -0500 |
commit | 21df21b7af2759aa577eb8d39d8215471956c25c (patch) | |
tree | 8d36f02176a2d1b817e2e2159791035d91e4282f /klippy/extras/fan.py | |
parent | b7b216af7f49995f816f326c08f721b3814c9685 (diff) | |
download | kutter-21df21b7af2759aa577eb8d39d8215471956c25c.tar.gz kutter-21df21b7af2759aa577eb8d39d8215471956c25c.tar.xz kutter-21df21b7af2759aa577eb8d39d8215471956c25c.zip |
fan: Clarify hardware_pwm and allow cycle_time to be set on software pwm
Specify hardware pwm cycle times using the same method as software pwm
(in seconds, not clock ticks). Allow the fan code to be configured
with an explicit cycle time even when using software pwm.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/fan.py')
-rw-r--r-- | klippy/extras/fan.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/extras/fan.py b/klippy/extras/fan.py index c7434ca5..7bc4a26d 100644 --- a/klippy/extras/fan.py +++ b/klippy/extras/fan.py @@ -5,8 +5,7 @@ # This file may be distributed under the terms of the GNU GPLv3 license. import pins -FAN_MIN_TIME = 0.1 -PWM_CYCLE_TIME = 0.010 +FAN_MIN_TIME = 0.100 class PrinterFan: def __init__(self, config): @@ -17,8 +16,9 @@ class PrinterFan: printer = config.get_printer() 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)) + 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_speed(self, print_time, value): value = max(0., min(self.max_power, value)) if value == self.last_fan_value: |