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/replicape.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/replicape.py')
-rw-r--r-- | klippy/extras/replicape.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/klippy/extras/replicape.py b/klippy/extras/replicape.py index 72ab45e9..742607c5 100644 --- a/klippy/extras/replicape.py +++ b/klippy/extras/replicape.py @@ -3,6 +3,7 @@ # Copyright (C) 2017,2018 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. +import logging import pins, mcu REPLICAPE_MAX_CURRENT = 3.84 @@ -37,11 +38,12 @@ class pca9685_pwm: return self._mcu def setup_max_duration(self, max_duration): self._max_duration = max_duration - def setup_cycle_time(self, cycle_time): - pass - def setup_hard_pwm(self, hard_cycle_ticks): - if hard_cycle_ticks: - raise pins.error("pca9685 does not support hard_pwm parameter") + def setup_cycle_time(self, cycle_time, hardware_pwm=False): + if hardware_pwm: + raise pins.error("pca9685 does not support hardware_pwm parameter") + if cycle_time != self._cycle_time: + logging.info("Ignoring pca9685 cycle time of %.6f (using %.6f)", + cycle_time, self._cycle_time) def setup_start_value(self, start_value, shutdown_value, is_static=False): if is_static and start_value != shutdown_value: raise pins.error("Static pin can not have shutdown value") |