浏览代码

✨ Redundant Part Cooling Fan (#21888)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
ellensp 3 年前
父节点
当前提交
d436c93f37
没有帐户链接到提交者的电子邮件

+ 5
- 0
Marlin/Configuration_adv.h 查看文件

@@ -532,6 +532,11 @@
532 532
   //#define USE_OCR2A_AS_TOP
533 533
 #endif
534 534
 
535
+/**
536
+ * Use one of the PWM fans as a redundant part-cooling fan
537
+ */
538
+//#define REDUNDANT_PART_COOLING_FAN 2  // Index of the fan to sync with FAN 0.
539
+
535 540
 // @section extruder
536 541
 
537 542
 /**

+ 28
- 24
Marlin/src/gcode/temp/M106_M107.cpp 查看文件

@@ -60,39 +60,40 @@
60 60
  */
61 61
 void GcodeSuite::M106() {
62 62
   const uint8_t pfan = parser.byteval('P', _ALT_P);
63
+  if (pfan >= _CNT_P) return;
64
+  #if REDUNDANT_PART_COOLING_FAN
65
+    if (pfan == REDUNDANT_PART_COOLING_FAN) return;
66
+  #endif
63 67
 
64
-  if (pfan < _CNT_P) {
65
-
66
-    #if ENABLED(EXTRA_FAN_SPEED)
67
-      const uint16_t t = parser.intval('T');
68
-      if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t);
69
-    #endif
68
+  #if ENABLED(EXTRA_FAN_SPEED)
69
+    const uint16_t t = parser.intval('T');
70
+    if (t > 0) return thermalManager.set_temp_fan_speed(pfan, t);
71
+  #endif
70 72
 
71
-    const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255;
73
+  const uint16_t dspeed = parser.seen_test('A') ? thermalManager.fan_speed[active_extruder] : 255;
72 74
 
73
-    uint16_t speed = dspeed;
75
+  uint16_t speed = dspeed;
74 76
 
75
-    // Accept 'I' if temperature presets are defined
76
-    #if PREHEAT_COUNT
77
-      const bool got_preset = parser.seenval('I');
78
-      if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed;
79
-    #else
80
-      constexpr bool got_preset = false;
81
-    #endif
77
+  // Accept 'I' if temperature presets are defined
78
+  #if PREHEAT_COUNT
79
+    const bool got_preset = parser.seenval('I');
80
+    if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed;
81
+  #else
82
+    constexpr bool got_preset = false;
83
+  #endif
82 84
 
83
-    if (!got_preset && parser.seenval('S'))
84
-      speed = parser.value_ushort();
85
+  if (!got_preset && parser.seenval('S'))
86
+    speed = parser.value_ushort();
85 87
 
86
-    TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
88
+  TERN_(FOAMCUTTER_XYUV, speed *= 2.55); // Get command in % of max heat
87 89
 
88
-    // Set speed, with constraint
89
-    thermalManager.set_fan_speed(pfan, speed);
90
+  // Set speed, with constraint
91
+  thermalManager.set_fan_speed(pfan, speed);
90 92
 
91
-    TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
93
+  TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
92 94
 
93
-    if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating()))  // pfan == 0 when duplicating
94
-      thermalManager.set_fan_speed(1 - pfan, speed);
95
-  }
95
+  if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating()))  // pfan == 0 when duplicating
96
+    thermalManager.set_fan_speed(1 - pfan, speed);
96 97
 }
97 98
 
98 99
 /**
@@ -101,6 +102,9 @@ void GcodeSuite::M106() {
101 102
 void GcodeSuite::M107() {
102 103
   const uint8_t pfan = parser.byteval('P', _ALT_P);
103 104
   if (pfan >= _CNT_P) return;
105
+  #if REDUNDANT_PART_COOLING_FAN
106
+    if (pfan == REDUNDANT_PART_COOLING_FAN) return;
107
+  #endif
104 108
 
105 109
   thermalManager.set_fan_speed(pfan, 0);
106 110
 

+ 8
- 0
Marlin/src/inc/SanityCheck.h 查看文件

@@ -1890,6 +1890,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
1890 1890
   #endif
1891 1891
 #endif
1892 1892
 
1893
+#ifdef REDUNDANT_PART_COOLING_FAN
1894
+  #if FAN_COUNT < 2
1895
+    #error "REDUNDANT_PART_COOLING_FAN requires a board with at least two PWM fans."
1896
+  #else
1897
+    static_assert(WITHIN(REDUNDANT_PART_COOLING_FAN, 1, FAN_COUNT - 1), "REDUNDANT_PART_COOLING_FAN must be between 1 and " STRINGIFY(DECREMENT(FAN_COUNT)) ".");
1898
+  #endif
1899
+#endif
1900
+
1893 1901
 /**
1894 1902
  * Case Light requirements
1895 1903
  */

+ 15
- 9
Marlin/src/lcd/menu/menu_temperature.cpp 查看文件

@@ -57,8 +57,14 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i
57 57
     if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
58 58
   #endif
59 59
   #if HAS_FAN
60
-    if (indh >= 0)
61
-      set_fan_speed(active_extruder < (FAN_COUNT) ? active_extruder : 0, ui.material_preset[indh].fan_speed);
60
+    if (indh >= 0) {
61
+      const uint8_t fan_index = active_extruder < (FAN_COUNT) ? active_extruder : 0;
62
+      if (true
63
+        #if REDUNDANT_PART_COOLING_FAN
64
+          && fan_index != REDUNDANT_PART_COOLING_FAN
65
+        #endif
66
+      ) set_fan_speed(fan_index, ui.material_preset[indh].fan_speed);
67
+    }
62 68
   #endif
63 69
   ui.return_to_status();
64 70
 }
@@ -215,37 +221,37 @@ void menu_temperature() {
215 221
     #if HAS_FAN0
216 222
       _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
217 223
     #endif
218
-    #if HAS_FAN1
224
+    #if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1
219 225
       FAN_EDIT_ITEMS(1);
220 226
     #elif SNFAN(1)
221 227
       singlenozzle_item(1);
222 228
     #endif
223
-    #if HAS_FAN2
229
+    #if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2
224 230
       FAN_EDIT_ITEMS(2);
225 231
     #elif SNFAN(2)
226 232
       singlenozzle_item(2);
227 233
     #endif
228
-    #if HAS_FAN3
234
+    #if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3
229 235
       FAN_EDIT_ITEMS(3);
230 236
     #elif SNFAN(3)
231 237
       singlenozzle_item(3);
232 238
     #endif
233
-    #if HAS_FAN4
239
+    #if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4
234 240
       FAN_EDIT_ITEMS(4);
235 241
     #elif SNFAN(4)
236 242
       singlenozzle_item(4);
237 243
     #endif
238
-    #if HAS_FAN5
244
+    #if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5
239 245
       FAN_EDIT_ITEMS(5);
240 246
     #elif SNFAN(5)
241 247
       singlenozzle_item(5);
242 248
     #endif
243
-    #if HAS_FAN6
249
+    #if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6
244 250
       FAN_EDIT_ITEMS(6);
245 251
     #elif SNFAN(6)
246 252
       singlenozzle_item(6);
247 253
     #endif
248
-    #if HAS_FAN7
254
+    #if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7
249 255
       FAN_EDIT_ITEMS(7);
250 256
     #elif SNFAN(7)
251 257
       singlenozzle_item(7);

+ 3
- 0
Marlin/src/module/temperature.cpp 查看文件

@@ -333,6 +333,9 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
333 333
     if (fan >= FAN_COUNT) return;
334 334
 
335 335
     fan_speed[fan] = speed;
336
+    #if REDUNDANT_PART_COOLING_FAN
337
+      if (fan == 0) fan_speed[REDUNDANT_PART_COOLING_FAN] = speed;
338
+    #endif
336 339
 
337 340
     TERN_(REPORT_FAN_CHANGE, report_fan_speed(fan));
338 341
   }

+ 2
- 1
buildroot/tests/mega2560 查看文件

@@ -68,7 +68,8 @@ exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states" "$3"
68 68
 #
69 69
 restore_configs
70 70
 opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \
71
-        NUM_RUNOUT_SENSORS E_STEPPERS FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5
71
+        NUM_RUNOUT_SENSORS E_STEPPERS REDUNDANT_PART_COOLING_FAN 1 \
72
+        FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5
72 73
 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \
73 74
            USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \
74 75
            FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE

正在加载...
取消
保存