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
5 changed files with 32 additions and 5 deletions

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
*/