Skip to content

Commit ae30b19

Browse files
committed
Fix starting fan with bad material preset index (MarlinFirmware#19773)
1 parent 678f4ca commit ae30b19

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

Marlin/src/lcd/menu/menu_temperature.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "menu_item.h"
3232
#include "../../module/temperature.h"
3333

34-
#if FAN_COUNT > 1 || ENABLED(SINGLENOZZLE)
34+
#if HAS_FAN || ENABLED(SINGLENOZZLE)
3535
#include "../../module/motion.h"
3636
#endif
3737

@@ -44,24 +44,17 @@
4444
//
4545

4646
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
47+
UNUSED(e); UNUSED(indh); UNUSED(indb);
4748
#if HAS_HOTEND
4849
if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
4950
setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e);
50-
#else
51-
UNUSED(e); UNUSED(indh);
5251
#endif
5352
#if HAS_HEATED_BED
5453
if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
55-
#else
56-
UNUSED(indb);
5754
#endif
5855
#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);
6558
#endif
6659
ui.return_to_status();
6760
}
@@ -93,7 +86,9 @@ void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t i
9386

9487
#endif
9588

96-
void do_preheat_end_m() { _preheat_end(editable.int8, 0); }
89+
void do_preheat_end_m() {
90+
_preheat_end(editable.int8, 0);
91+
}
9792

9893
#if HAS_MULTI_HOTEND || HAS_HEATED_BED
9994

0 commit comments

Comments
 (0)