Browse Source

Configurable number of M106 fans (#18883)

vanilla_fb_2.0.x
Giuliano Zaro 4 years ago
committed by GitHub
parent
commit
3426c7fc94
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Marlin/Configuration.h
  2. 22
      Marlin/src/inc/Conditionals_post.h
  3. 7
      Marlin/src/inc/SanityCheck.h
  4. 2
      Marlin/src/module/temperature.cpp
  5. 2
      Marlin/src/pins/sam/pins_CNCONTROLS_15D.h

4
Marlin/Configuration.h

@ -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

22
Marlin/src/inc/Conditionals_post.h

@ -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

7
Marlin/src/inc/SanityCheck.h

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

2
Marlin/src/module/temperature.cpp

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

2
Marlin/src/pins/sam/pins_CNCONTROLS_15D.h

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

Loading…
Cancel
Save