reuse, update lcd_preheat

This commit is contained in:
Scott Lahteine
2025-03-17 20:29:54 -05:00
parent a131edd6ff
commit cfe5bf2929
+15 -17
View File
@@ -45,18 +45,16 @@
#if HAS_PREHEAT
void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb) {
UNUSED(e); UNUSED(indh); UNUSED(indb);
void Temperature::lcd_preheat(const uint8_t e, const int8_t indh=-1, const int8_t indb=-1, const int8_t indc=-1) {
UNUSED(e); UNUSED(indh); UNUSED(indb); UNUSED(indc);
#if HAS_HOTEND
if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
setTargetHotend(_MIN(thermalManager.hotend_max_target(e), ui.material_preset[indh].hotend_temp), e);
if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0) setTargetHotend(ui.material_preset[indh].hotend_temp, e);
#endif
#if HAS_HEATED_BED
if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
#endif
#if HAS_HEATED_CHAMBER
if ((indb >= 0 && ui.material_preset[indb].chamber_temp > 0) && (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)) // Preheat all selected
setTargetChamber(ui.material_preset[indb].chamber_temp);
if (indc >= 0 && ui.material_preset[indc].chamber_temp > 0) setTargetChamber(ui.material_preset[indc].chamber_temp);
#endif
#if HAS_FAN
if (indh >= 0) {
@@ -72,33 +70,33 @@
}
#if HAS_TEMP_HOTEND
inline void _preheat_end(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); }
void do_preheat_end_m() { _preheat_end(editable.int8, 0); }
inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); }
void do_preheat_end_m() { _preheat_end(0, editable.int8); }
#endif
#if HAS_HEATED_BED
inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(0, -1, m); }
#endif
#if HAS_HEATED_CHAMBER
inline void _preheat_chamber(const uint8_t m) { thermalManager.setTargetChamber(ui.material_preset[m].chamber_temp); }
inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(0, -1, -1, m); }
#endif
#if HAS_COOLER
inline void _precool_laser(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); }
void do_precool_laser_m() { _precool_laser(editable.int8, thermalManager.temp_cooler.target); }
inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); }
void do_precool_laser_m() { _precool_laser(thermalManager.temp_cooler.target, editable.int8); }
#endif
#if HAS_TEMP_HOTEND && HAS_HEATED_BED
inline void _preheat_both(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, m); }
#if HAS_TEMP_HOTEND && (HAS_HEATED_BED || HAS_HEATED_CHAMBER)
inline void _preheat_all(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m, m, m); }
// Indexed "Preheat ABC" and "Heat Bed" items
#define PREHEAT_ITEMS(M,E) do{ \
ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_both(M, MenuItemBase::itemIndex); }); \
ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(M, MenuItemBase::itemIndex); }); \
ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_all(MenuItemBase::itemIndex, M); }); \
ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(MenuItemBase::itemIndex, M); }); \
}while(0)
#elif HAS_MULTI_HOTEND
// No heated bed, so just indexed "Preheat ABC" items
#define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(M, MenuItemBase::itemIndex); })
#define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(MenuItemBase::itemIndex, M); })
#endif
@@ -115,7 +113,7 @@
#if HOTENDS == 1
#if HAS_HEATED_BED || HAS_HEATED_CHAMBER
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_both(editable.int8, 0); });
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_all(0, editable.int8); });
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_END, do_preheat_end_m);
#else
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m);