Browse Source

Configurable number of M106 fans (#18883)

Giuliano Zaro 3 years ago
parent
commit
3426c7fc94
No account linked to committer's email address

+ 4
- 0
Marlin/Configuration.h View File

2275
 
2275
 
2276
 // @section extras
2276
 // @section extras
2277
 
2277
 
2278
+// Set number of user-controlled fans. Disable to use all board-defined fans.
2279
+// :[1,2,3,4,5,6,7,8]
2280
+//#define NUM_M106_FANS 1
2281
+
2278
 // Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
2282
 // Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
2279
 //#define FAST_PWM_FAN
2283
 //#define FAST_PWM_FAN
2280
 
2284
 

+ 19
- 3
Marlin/src/inc/Conditionals_post.h View File

1876
   #undef AUTO_POWER_CHAMBER_FAN
1876
   #undef AUTO_POWER_CHAMBER_FAN
1877
 #endif
1877
 #endif
1878
 
1878
 
1879
-// Other fans
1879
+// Print Cooling fans (limit)
1880
+#ifdef NUM_M106_FANS
1881
+  #define MAX_FANS NUM_M106_FANS
1882
+#else
1883
+  #define MAX_FANS 8  // Max supported fans
1884
+#endif
1885
+
1886
+#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
1887
+#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) \
1888
+                     && CONTROLLER_FAN_PIN != FAN##F##_PIN \
1889
+                     && _NOT_E_AUTO(0,F) \
1890
+                     && _NOT_E_AUTO(1,F) \
1891
+                     && _NOT_E_AUTO(2,F) \
1892
+                     && _NOT_E_AUTO(3,F) \
1893
+                     && _NOT_E_AUTO(4,F) \
1894
+                     && _NOT_E_AUTO(5,F) \
1895
+                     && _NOT_E_AUTO(6,F) \
1896
+                     && _NOT_E_AUTO(7,F) \
1897
+                     && F < MAX_FANS)
1880
 #if PIN_EXISTS(FAN)
1898
 #if PIN_EXISTS(FAN)
1881
   #define HAS_FAN0 1
1899
   #define HAS_FAN0 1
1882
 #endif
1900
 #endif
1883
-#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
1884
-#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))
1885
 #if _HAS_FAN(1)
1901
 #if _HAS_FAN(1)
1886
   #define HAS_FAN1 1
1902
   #define HAS_FAN1 1
1887
 #endif
1903
 #endif

+ 7
- 0
Marlin/src/inc/SanityCheck.h View File

1107
 #endif
1107
 #endif
1108
 
1108
 
1109
 /**
1109
 /**
1110
+ * Limited user-controlled fans
1111
+ */
1112
+#if NUM_M106_FANS > FAN_COUNT
1113
+  #error "The selected board doesn't support enough user-controlled fans. Reduce NUM_M106_FANS."
1114
+#endif
1115
+
1116
+/**
1110
  * Limited number of servos
1117
  * Limited number of servos
1111
  */
1118
  */
1112
 #if NUM_SERVOS > NUM_SERVO_PLUGS
1119
 #if NUM_SERVOS > NUM_SERVO_PLUGS

+ 1
- 1
Marlin/src/module/temperature.cpp View File

195
   #endif
195
   #endif
196
 
196
 
197
   #if ENABLED(ADAPTIVE_FAN_SLOWING)
197
   #if ENABLED(ADAPTIVE_FAN_SLOWING)
198
-    uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
198
+    uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128, 128, 128);
199
   #endif
199
   #endif
200
 
200
 
201
   /**
201
   /**

+ 1
- 1
Marlin/src/pins/sam/pins_CNCONTROLS_15D.h View File

92
 //
92
 //
93
 // Fans
93
 // Fans
94
 //
94
 //
95
-//#define FAN0_PIN                             8
95
+//#define FAN_PIN                              8
96
 
96
 
97
 //
97
 //
98
 // Auto fans
98
 // Auto fans

Loading…
Cancel
Save