|
45 | 45 |
|
46 | 46 | #if HAS_PREHEAT
|
47 | 47 |
|
48 |
| - void Temperature::lcd_preheat(const uint8_t e, const int8_t indh/*=-1*/, const int8_t indb/*=-1*/, const int8_t indc/*=-1*/) { |
49 |
| - UNUSED(e); UNUSED(indh); UNUSED(indb); UNUSED(indc); |
| 48 | + /** |
| 49 | + * @fn Temperature::lcd_preheat |
| 50 | + * @brief Apply the "preheat" parameters for a material preset to the |
| 51 | + * hotend (or laser), bed, chamber, or all of the above. |
| 52 | + * @param m Material index |
| 53 | + * @param targets Bit mask of targets to "preheat" (or turn off) |
| 54 | + * @param e Extruder index (if needed) |
| 55 | + */ |
| 56 | + void Temperature::lcd_preheat(const uint8_t m, const uint8_t targets, const uint8_t e/*=0*/) { |
| 57 | + UNUSED(e); |
50 | 58 | #if HAS_HOTEND
|
51 |
| - if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0) setTargetHotend(ui.material_preset[indh].hotend_temp, e); |
| 59 | + if (targets & PreheatTarget::HOTEND) setTargetHotend(ui.material_preset[m].hotend_temp, e); |
52 | 60 | #endif
|
53 | 61 | #if HAS_HEATED_BED
|
54 |
| - if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp); |
| 62 | + if (targets & PreheatTarget::BED) setTargetBed(ui.material_preset[m].bed_temp); |
55 | 63 | #endif
|
56 | 64 | #if HAS_HEATED_CHAMBER
|
57 |
| - if (indc >= 0 && ui.material_preset[indc].chamber_temp > 0) setTargetChamber(ui.material_preset[indc].chamber_temp); |
| 65 | + if (targets & PreheatTarget::CHAMBER) setTargetChamber(ui.material_preset[m].chamber_temp); |
58 | 66 | #endif
|
59 | 67 | #if HAS_FAN
|
60 |
| - if (indh >= 0) { |
| 68 | + if (targets & PreheatTarget::HOTEND) { |
61 | 69 | const uint8_t fan_index = active_extruder < (FAN_COUNT) ? active_extruder : 0;
|
62 | 70 | if (true
|
63 | 71 | #if REDUNDANT_PART_COOLING_FAN
|
64 | 72 | && fan_index != REDUNDANT_PART_COOLING_FAN
|
65 | 73 | #endif
|
66 |
| - ) set_fan_speed(fan_index, ui.material_preset[indh].fan_speed); |
| 74 | + ) set_fan_speed(fan_index, ui.material_preset[m].fan_speed); |
67 | 75 | }
|
68 | 76 | #endif
|
69 | 77 | ui.return_to_status();
|
70 | 78 | }
|
71 | 79 |
|
72 | 80 | #if HAS_TEMP_HOTEND
|
73 |
| - inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); } |
| 81 | + inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); } |
74 | 82 | void do_preheat_end_m() { _preheat_end(0, editable.int8); }
|
75 | 83 | #endif
|
76 | 84 | #if HAS_HEATED_BED
|
77 |
| - inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(0, -1, m); } |
| 85 | + inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::BED); } |
78 | 86 | #endif
|
79 | 87 | #if HAS_HEATED_CHAMBER
|
80 |
| - inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(0, -1, -1, m); } |
| 88 | + inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::CHAMBER); } |
81 | 89 | #endif
|
82 | 90 | #if HAS_COOLER
|
83 |
| - inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); } |
| 91 | + inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); } |
84 | 92 | void do_precool_laser_m() { _precool_laser(thermalManager.temp_cooler.target, editable.int8); }
|
85 | 93 | #endif
|
86 | 94 |
|
87 | 95 | #if HAS_TEMP_HOTEND && (HAS_HEATED_BED || HAS_HEATED_CHAMBER)
|
88 |
| - inline void _preheat_all(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m, m, m); } |
| 96 | + inline void _preheat_all(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::ALL, e); } |
89 | 97 |
|
90 | 98 | // Indexed "Preheat ABC" and "Heat Bed" items
|
91 | 99 | #define PREHEAT_ITEMS(M,E) do{ \
|
|
0 commit comments