mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-29 02:40:41 -07:00
🧑💻 More extensible Temperature::lcd_preheat
This commit is contained in:
parent
367cea0d0d
commit
4ad6fa59df
2 changed files with 31 additions and 13 deletions
|
|
@ -45,47 +45,55 @@
|
|||
|
||||
#if HAS_PREHEAT
|
||||
|
||||
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);
|
||||
/**
|
||||
* @fn Temperature::lcd_preheat
|
||||
* @brief Apply the "preheat" parameters for a material preset to the
|
||||
* hotend (or laser), bed, chamber, or all of the above.
|
||||
* @param m Material index
|
||||
* @param targets Bit mask of targets to "preheat" (or turn off)
|
||||
* @param e Extruder index (if needed)
|
||||
*/
|
||||
void Temperature::lcd_preheat(const uint8_t m, const uint8_t targets, const uint8_t e/*=0*/) {
|
||||
UNUSED(e);
|
||||
#if HAS_HOTEND
|
||||
if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0) setTargetHotend(ui.material_preset[indh].hotend_temp, e);
|
||||
if (targets & PreheatTarget::HOTEND) setTargetHotend(ui.material_preset[m].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);
|
||||
if (targets & PreheatTarget::BED) setTargetBed(ui.material_preset[m].bed_temp);
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
if (indc >= 0 && ui.material_preset[indc].chamber_temp > 0) setTargetChamber(ui.material_preset[indc].chamber_temp);
|
||||
if (targets & PreheatTarget::CHAMBER) setTargetChamber(ui.material_preset[m].chamber_temp);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
if (indh >= 0) {
|
||||
if (targets & PreheatTarget::HOTEND) {
|
||||
const uint8_t fan_index = active_extruder < (FAN_COUNT) ? active_extruder : 0;
|
||||
if (true
|
||||
#if REDUNDANT_PART_COOLING_FAN
|
||||
&& fan_index != REDUNDANT_PART_COOLING_FAN
|
||||
#endif
|
||||
) set_fan_speed(fan_index, ui.material_preset[indh].fan_speed);
|
||||
) set_fan_speed(fan_index, ui.material_preset[m].fan_speed);
|
||||
}
|
||||
#endif
|
||||
ui.return_to_status();
|
||||
}
|
||||
|
||||
#if HAS_TEMP_HOTEND
|
||||
inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); }
|
||||
inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); }
|
||||
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); }
|
||||
inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::BED); }
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(0, -1, -1, m); }
|
||||
inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::CHAMBER); }
|
||||
#endif
|
||||
#if HAS_COOLER
|
||||
inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(e, m); }
|
||||
inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); }
|
||||
void do_precool_laser_m() { _precool_laser(thermalManager.temp_cooler.target, editable.int8); }
|
||||
#endif
|
||||
|
||||
#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); }
|
||||
inline void _preheat_all(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::ALL, e); }
|
||||
|
||||
// Indexed "Preheat ABC" and "Heat Bed" items
|
||||
#define PREHEAT_ITEMS(M,E) do{ \
|
||||
|
|
|
|||
|
|
@ -599,6 +599,15 @@ typedef struct { raw_adc_t raw_min, raw_max; celsius_t mintemp, maxtemp; } temp_
|
|||
#define HAS_FAN_LOGIC 1
|
||||
#endif
|
||||
|
||||
#if HAS_MARLINUI_MENU && HAS_TEMPERATURE && HAS_PREHEAT
|
||||
enum PreheatTarget : uint8_t {
|
||||
HOTEND = (1 << 0),
|
||||
BED = (1 << 1),
|
||||
CHAMBER = (1 << 2),
|
||||
ALL = 0xFF
|
||||
};
|
||||
#endif
|
||||
|
||||
class Temperature {
|
||||
|
||||
public:
|
||||
|
|
@ -1335,7 +1344,8 @@ class Temperature {
|
|||
#endif
|
||||
|
||||
#if HAS_MARLINUI_MENU && HAS_TEMPERATURE && HAS_PREHEAT
|
||||
static void lcd_preheat(const uint8_t e, const int8_t indh=-1, const int8_t indb=-1, const int8_t indc=-1);
|
||||
// Apply the "preheat" parameters for a material preset to the hotend (or laser), bed, chamber, or all of the above
|
||||
static void lcd_preheat(const uint8_t m, const uint8_t targets, const uint8_t e=0);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue