Bladeren bron

✨ Redundant Part Cooling Fan (#21888)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
ellensp 4 jaren geleden
bovenliggende
commit
d436c93f37
No account linked to committer's email address

+ 5
- 0
Marlin/Configuration_adv.h Bestand weergeven

532
   //#define USE_OCR2A_AS_TOP
532
   //#define USE_OCR2A_AS_TOP
533
 #endif
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
 // @section extruder
540
 // @section extruder
536
 
541
 
537
 /**
542
 /**

+ 28
- 24
Marlin/src/gcode/temp/M106_M107.cpp Bestand weergeven

60
  */
60
  */
61
 void GcodeSuite::M106() {
61
 void GcodeSuite::M106() {
62
   const uint8_t pfan = parser.byteval('P', _ALT_P);
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
 void GcodeSuite::M107() {
102
 void GcodeSuite::M107() {
102
   const uint8_t pfan = parser.byteval('P', _ALT_P);
103
   const uint8_t pfan = parser.byteval('P', _ALT_P);
103
   if (pfan >= _CNT_P) return;
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
   thermalManager.set_fan_speed(pfan, 0);
109
   thermalManager.set_fan_speed(pfan, 0);
106
 
110
 

+ 8
- 0
Marlin/src/inc/SanityCheck.h Bestand weergeven

1890
   #endif
1890
   #endif
1891
 #endif
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
  * Case Light requirements
1902
  * Case Light requirements
1895
  */
1903
  */

+ 15
- 9
Marlin/src/lcd/menu/menu_temperature.cpp Bestand weergeven

57
     if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
57
     if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
58
   #endif
58
   #endif
59
   #if HAS_FAN
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
   #endif
68
   #endif
63
   ui.return_to_status();
69
   ui.return_to_status();
64
 }
70
 }
215
     #if HAS_FAN0
221
     #if HAS_FAN0
216
       _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
222
       _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
217
     #endif
223
     #endif
218
-    #if HAS_FAN1
224
+    #if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1
219
       FAN_EDIT_ITEMS(1);
225
       FAN_EDIT_ITEMS(1);
220
     #elif SNFAN(1)
226
     #elif SNFAN(1)
221
       singlenozzle_item(1);
227
       singlenozzle_item(1);
222
     #endif
228
     #endif
223
-    #if HAS_FAN2
229
+    #if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2
224
       FAN_EDIT_ITEMS(2);
230
       FAN_EDIT_ITEMS(2);
225
     #elif SNFAN(2)
231
     #elif SNFAN(2)
226
       singlenozzle_item(2);
232
       singlenozzle_item(2);
227
     #endif
233
     #endif
228
-    #if HAS_FAN3
234
+    #if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3
229
       FAN_EDIT_ITEMS(3);
235
       FAN_EDIT_ITEMS(3);
230
     #elif SNFAN(3)
236
     #elif SNFAN(3)
231
       singlenozzle_item(3);
237
       singlenozzle_item(3);
232
     #endif
238
     #endif
233
-    #if HAS_FAN4
239
+    #if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4
234
       FAN_EDIT_ITEMS(4);
240
       FAN_EDIT_ITEMS(4);
235
     #elif SNFAN(4)
241
     #elif SNFAN(4)
236
       singlenozzle_item(4);
242
       singlenozzle_item(4);
237
     #endif
243
     #endif
238
-    #if HAS_FAN5
244
+    #if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5
239
       FAN_EDIT_ITEMS(5);
245
       FAN_EDIT_ITEMS(5);
240
     #elif SNFAN(5)
246
     #elif SNFAN(5)
241
       singlenozzle_item(5);
247
       singlenozzle_item(5);
242
     #endif
248
     #endif
243
-    #if HAS_FAN6
249
+    #if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6
244
       FAN_EDIT_ITEMS(6);
250
       FAN_EDIT_ITEMS(6);
245
     #elif SNFAN(6)
251
     #elif SNFAN(6)
246
       singlenozzle_item(6);
252
       singlenozzle_item(6);
247
     #endif
253
     #endif
248
-    #if HAS_FAN7
254
+    #if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7
249
       FAN_EDIT_ITEMS(7);
255
       FAN_EDIT_ITEMS(7);
250
     #elif SNFAN(7)
256
     #elif SNFAN(7)
251
       singlenozzle_item(7);
257
       singlenozzle_item(7);

+ 3
- 0
Marlin/src/module/temperature.cpp Bestand weergeven

333
     if (fan >= FAN_COUNT) return;
333
     if (fan >= FAN_COUNT) return;
334
 
334
 
335
     fan_speed[fan] = speed;
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
     TERN_(REPORT_FAN_CHANGE, report_fan_speed(fan));
340
     TERN_(REPORT_FAN_CHANGE, report_fan_speed(fan));
338
   }
341
   }

+ 2
- 1
buildroot/tests/mega2560 Bestand weergeven

68
 #
68
 #
69
 restore_configs
69
 restore_configs
70
 opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \
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
 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \
73
 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \
73
            USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \
74
            USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \
74
            FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE
75
            FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE

Laden…
Annuleren
Opslaan