From 21df21b7af2759aa577eb8d39d8215471956c25c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 29 Jan 2018 12:54:06 -0500 Subject: 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 --- klippy/extras/replicape.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'klippy/extras/replicape.py') 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 # # 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") -- cgit v1.2.3-70-g09d2