Browse Source

Fix starting fan with bad material preset index (#19773)

Victor Oliveira 4 years ago
parent
commit
313efa33ae
No account linked to committer's email address
1 changed files with 6 additions and 11 deletions
  1. 6
    11
      Marlin/src/lcd/menu/menu_temperature.cpp

+ 6
- 11
Marlin/src/lcd/menu/menu_temperature.cpp View File

44
 //
44
 //
45
 
45
 
46
 void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
46
 void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
47
+  UNUSED(e); UNUSED(indh); UNUSED(indb);
47
   #if HAS_HOTEND
48
   #if HAS_HOTEND
48
     if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
49
     if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
49
       setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e);
50
       setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e);
50
-  #else
51
-    UNUSED(e); UNUSED(indh);
52
   #endif
51
   #endif
53
   #if HAS_HEATED_BED
52
   #if HAS_HEATED_BED
54
     if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
53
     if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
55
-  #else
56
-    UNUSED(indb);
57
   #endif
54
   #endif
58
   #if HAS_FAN
55
   #if HAS_FAN
59
-    set_fan_speed((
60
-      #if FAN_COUNT > 1
61
-        active_extruder < FAN_COUNT ? active_extruder :
62
-      #endif
63
-      0), ui.material_preset[indh].fan_speed
64
-    );
56
+    if (indh >= 0)
57
+      set_fan_speed(active_extruder < (FAN_COUNT) ? active_extruder : 0, ui.material_preset[indh].fan_speed);
65
   #endif
58
   #endif
66
   ui.return_to_status();
59
   ui.return_to_status();
67
 }
60
 }
93
 
86
 
94
   #endif
87
   #endif
95
 
88
 
96
-  void do_preheat_end_m() { _preheat_end(editable.int8, 0); }
89
+  void do_preheat_end_m() {
90
+    _preheat_end(editable.int8, 0);
91
+  }
97
 
92
 
98
   #if HAS_MULTI_HOTEND || HAS_HEATED_BED
93
   #if HAS_MULTI_HOTEND || HAS_HEATED_BED
99
 
94
 

Loading…
Cancel
Save