🔧 Group FAST_PWM_FAN.options (#23331)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
x301
Robby Candra 3 years ago committed by Scott Lahteine
parent 9ecfa1d252
commit aef613acd3

@ -2841,9 +2841,6 @@
// :[1,2,3,4,5,6,7,8] // :[1,2,3,4,5,6,7,8]
//#define NUM_M106_FANS 1 //#define NUM_M106_FANS 1
// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
//#define FAST_PWM_FAN
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not as annoying as with the hardware PWM. On the other hand, if this frequency // which is not as annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE. // is too low, you should also increment SOFT_PWM_SCALE.

@ -549,18 +549,21 @@
//#define FAN_MAX_PWM 128 //#define FAN_MAX_PWM 128
/** /**
* FAST PWM FAN Settings * Fan Fast PWM
* *
* Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) * Combinations of PWM Modes, prescale values and TOP resolutions are used internally
* Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a * to produce a frequency as close as possible to the desired frequency.
* frequency as close as possible to the desired frequency.
* *
* FAST_PWM_FAN_FREQUENCY [undefined by default] * FAST_PWM_FAN_FREQUENCY
* Set this to your desired frequency. * Set this to your desired frequency.
* If left undefined this defaults to F = F_CPU/(2*255*1) * For AVR, if left undefined this defaults to F = F_CPU/(2*255*1)
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers. * i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required * For non AVR, if left undefined this defaults to F = 1Khz.
* This F value is only to protect the hardware from an absence of configuration
* and not to complete it when users are not aware that the frequency must be specifically set to support the target board.
*
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior. * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
* Setting very high frequencies can damage your hardware.
* *
* USE_OCR2A_AS_TOP [undefined by default] * USE_OCR2A_AS_TOP [undefined by default]
* Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2:
@ -570,9 +573,17 @@
* PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.)
* USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies.
*/ */
//#define FAST_PWM_FAN // Increase the fan PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
//#define FAST_PWM_FAN_FREQUENCY 31400 //#define FAST_PWM_FAN_FREQUENCY 31400 // Define here to override the defaults below
//#define USE_OCR2A_AS_TOP //#define USE_OCR2A_AS_TOP
#ifndef FAST_PWM_FAN_FREQUENCY
#ifdef __AVR__
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1))
#else
#define FAST_PWM_FAN_FREQUENCY 1000U
#endif
#endif
#endif #endif
/** /**

@ -2667,17 +2667,6 @@
#error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM." #error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
#endif #endif
/**
* FAST PWM FAN default PWM frequency
*/
#if !defined(FAST_PWM_FAN_FREQUENCY) && ENABLED(FAST_PWM_FAN)
#ifdef __AVR__
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1))
#else
#define FAST_PWM_FAN_FREQUENCY 1000U
#endif
#endif
/** /**
* Controller Fan Settings * Controller Fan Settings
*/ */

@ -95,7 +95,6 @@
#define FAN_MAX_PWM 255 #define FAN_MAX_PWM 255
#else #else
#define FAST_PWM_FAN // STM32 Variant allow TIMER2 Hardware PWM #define FAST_PWM_FAN // STM32 Variant allow TIMER2 Hardware PWM
#define FAST_PWM_FAN_FREQUENCY 31400 // This frequency allow a good range, fan starts at 3%, half noise at 50%
#define FAN_MIN_PWM 5 #define FAN_MIN_PWM 5
#define FAN_MAX_PWM 255 #define FAN_MAX_PWM 255
#endif #endif

Loading…
Cancel
Save