🎨 Standard material presets behavior

This commit is contained in:
Scott Lahteine
2021-10-27 20:01:44 -05:00
committed by Scott Lahteine
parent 1d80464ba7
commit b09038fcc7
7 changed files with 178 additions and 239 deletions

View File

@@ -135,7 +135,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif
#if HAS_PREHEAT
#include "../module/temperature.h"
preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load()
PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
#define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL);
#define _PLBL(N) preheat_##N##_label,
@@ -143,6 +146,14 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) };
return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
}
void MarlinUI::apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e/*=active_extruder*/) {
const preheat_t &pre = material_preset[m];
TERN_(HAS_HOTEND, if (TEST(pmask, PM_HOTEND)) thermalManager.setTargetHotend(pre.hotend_temp, e));
TERN_(HAS_HEATED_BED, if (TEST(pmask, PM_BED)) thermalManager.setTargetBed(pre.bed_temp));
//TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PM_CHAMBER)) thermalManager.setTargetBed(pre.chamber_temp));
TERN_(HAS_FAN, if (TEST(pmask, PM_FAN)) thermalManager.set_fan_speed(0, pre.fan_speed));
}
#endif
#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)