Configurable number of M106 fans (#18883)

This commit is contained in:
Giuliano Zaro 2020-08-20 03:11:20 +02:00 committed by GitHub
parent 64e181979c
commit 3426c7fc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 5 deletions

View File

@ -2275,6 +2275,10 @@
// @section extras
// Set number of user-controlled fans. Disable to use all board-defined fans.
// :[1,2,3,4,5,6,7,8]
//#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

View File

@ -1876,12 +1876,28 @@
#undef AUTO_POWER_CHAMBER_FAN
#endif
// Other fans
// Print Cooling fans (limit)
#ifdef NUM_M106_FANS
#define MAX_FANS NUM_M106_FANS
#else
#define MAX_FANS 8 // Max supported fans
#endif
#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) \
&& CONTROLLER_FAN_PIN != FAN##F##_PIN \
&& _NOT_E_AUTO(0,F) \
&& _NOT_E_AUTO(1,F) \
&& _NOT_E_AUTO(2,F) \
&& _NOT_E_AUTO(3,F) \
&& _NOT_E_AUTO(4,F) \
&& _NOT_E_AUTO(5,F) \
&& _NOT_E_AUTO(6,F) \
&& _NOT_E_AUTO(7,F) \
&& F < MAX_FANS)
#if PIN_EXISTS(FAN)
#define HAS_FAN0 1
#endif
#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) && CONTROLLER_FAN_PIN != FAN##F##_PIN && _NOT_E_AUTO(0,F) && _NOT_E_AUTO(1,F) && _NOT_E_AUTO(2,F) && _NOT_E_AUTO(3,F) && _NOT_E_AUTO(4,F) && _NOT_E_AUTO(5,F) && _NOT_E_AUTO(6,F) && _NOT_E_AUTO(7,F))
#if _HAS_FAN(1)
#define HAS_FAN1 1
#endif

View File

@ -1106,6 +1106,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "FANMUX0_PIN and FANMUX1_PIN must be set before FANMUX2_PIN can be set."
#endif
/**
* Limited user-controlled fans
*/
#if NUM_M106_FANS > FAN_COUNT
#error "The selected board doesn't support enough user-controlled fans. Reduce NUM_M106_FANS."
#endif
/**
* Limited number of servos
*/

View File

@ -195,7 +195,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
#endif
#if ENABLED(ADAPTIVE_FAN_SLOWING)
uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128, 128, 128);
#endif
/**

View File

@ -92,7 +92,7 @@
//
// Fans
//
//#define FAN0_PIN 8
//#define FAN_PIN 8
//
// Auto fans