mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-28 18:30:36 -07:00
🚸 Chamber Preheat completion (#26864)
Followup to #21156 Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
0a07bba213
commit
367cea0d0d
11 changed files with 64 additions and 24 deletions
|
|
@ -37,6 +37,7 @@
|
|||
* S<material>
|
||||
* H<hotend temp>
|
||||
* B<bed temp>
|
||||
* C<chamber temp>
|
||||
* F<fan speed>
|
||||
*/
|
||||
void GcodeSuite::M145() {
|
||||
|
|
@ -53,6 +54,10 @@ void GcodeSuite::M145() {
|
|||
if (parser.seenval('B'))
|
||||
mat.bed_temp = constrain(parser.value_int(), BED_MINTEMP, BED_MAX_TARGET);
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
if (parser.seenval('C'))
|
||||
mat.chamber_temp = constrain(parser.value_int(), CHAMBER_MINTEMP, CHAMBER_MAX_TARGET);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
if (parser.seenval('F'))
|
||||
mat.fan_speed = constrain(parser.value_int(), 0, 255);
|
||||
|
|
|
|||
|
|
@ -39,9 +39,16 @@
|
|||
*/
|
||||
void GcodeSuite::M141() {
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
// Accept 'I' if temperature presets are defined
|
||||
#if HAS_PREHEAT
|
||||
if (parser.seenval('I')) {
|
||||
const uint8_t index = parser.value_byte();
|
||||
thermalManager.setTargetChamber(ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].chamber_temp);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (parser.seenval('S')) {
|
||||
thermalManager.setTargetChamber(parser.value_celsius());
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
/**
|
||||
* Stop the timer at the end of print. Hotend, bed target, and chamber
|
||||
|
|
|
|||
|
|
@ -811,6 +811,9 @@ namespace ExtUI {
|
|||
#if HAS_HEATED_BED
|
||||
uint16_t getMaterial_preset_B(const uint16_t index) { return ui.material_preset[index].bed_temp; }
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
uint16_t getMaterial_preset_C(const uint16_t index) { return ui.material_preset[index].chamber_temp; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
feedRate_t getFeedrate_mm_s() { return feedrate_mm_s; }
|
||||
|
|
|
|||
|
|
@ -214,6 +214,9 @@ namespace ExtUI {
|
|||
#if HAS_HEATED_BED
|
||||
uint16_t getMaterial_preset_B(const uint16_t);
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
uint16_t getMaterial_preset_C(const uint16_t);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// IDEX Machine Mode
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ namespace LanguageNarrow_en {
|
|||
LSTR MSG_PREHEAT_M_END_E = _UxGT("Preheat $ End ~");
|
||||
LSTR MSG_PREHEAT_M_ALL = _UxGT("Preheat $ All");
|
||||
LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Preheat $ Bed");
|
||||
LSTR MSG_PREHEAT_M_CHAMBER = _UxGT("Preheat $ Chmb");
|
||||
LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Preheat $ Conf");
|
||||
|
||||
LSTR MSG_PREHEAT_HOTEND = _UxGT("Preheat Hotend");
|
||||
|
|
@ -1109,6 +1110,8 @@ namespace LanguageWide_en {
|
|||
LSTR MSG_HOMING_FEEDRATE_Y = _UxGT("Y Homing Feedrate");
|
||||
LSTR MSG_HOMING_FEEDRATE_Z = _UxGT("Z Homing Feedrate");
|
||||
LSTR MSG_EEPROM_INITIALIZED = _UxGT("Default Settings Restored");
|
||||
LSTR MSG_PREHEAT_M_CHAMBER = _UxGT("Preheat $ Chamber");
|
||||
LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Preheat $ Config");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
|||
|
||||
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, PT_HOTEND)) thermalManager.setTargetHotend(pre.hotend_temp, e));
|
||||
TERN_(HAS_HEATED_BED, if (TEST(pmask, PT_BED)) thermalManager.setTargetBed(pre.bed_temp));
|
||||
//TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PT_CHAMBER)) thermalManager.setTargetChamber(pre.chamber_temp));
|
||||
TERN_(HAS_FAN, if (TEST(pmask, PT_FAN)) thermalManager.set_fan_speed(0, pre.fan_speed));
|
||||
TERN_(HAS_HOTEND, if (TEST(pmask, PT_HOTEND)) thermalManager.setTargetHotend(pre.hotend_temp, e));
|
||||
TERN_(HAS_HEATED_BED, if (TEST(pmask, PT_BED)) thermalManager.setTargetBed(pre.bed_temp));
|
||||
TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PT_CHAMBER)) thermalManager.setTargetChamber(pre.chamber_temp));
|
||||
TERN_(HAS_FAN, if (TEST(pmask, PT_FAN)) thermalManager.set_fan_speed(0, pre.fan_speed));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ typedef bool (*statusResetFunc_t)();
|
|||
#if HAS_HEATED_BED
|
||||
celsius_t bed_temp;
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
celsius_t chamber_temp;
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
uint16_t fan_speed;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -451,6 +451,9 @@ void menu_advanced_settings();
|
|||
#if HAS_HEATED_BED
|
||||
EDIT_ITEM(int3, MSG_BED, &ui.material_preset[m].bed_temp, BED_MINTEMP, BED_MAX_TARGET);
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
EDIT_ITEM(int3, MSG_CHAMBER, &ui.material_preset[m].chamber_temp, CHAMBER_MINTEMP, CHAMBER_MAX_TARGET);
|
||||
#endif
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -45,15 +45,17 @@
|
|||
|
||||
#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 (indc >= 0 && ui.material_preset[indc].chamber_temp > 0) setTargetChamber(ui.material_preset[indc].chamber_temp);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
if (indh >= 0) {
|
||||
const uint8_t fan_index = active_extruder < (FAN_COUNT) ? active_extruder : 0;
|
||||
|
|
@ -68,30 +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.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
|
||||
|
||||
|
|
@ -107,8 +112,8 @@
|
|||
|
||||
#if HOTENDS == 1
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_both(editable.int8, 0); });
|
||||
#if HAS_HEATED_BED || HAS_HEATED_CHAMBER
|
||||
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);
|
||||
|
|
@ -129,6 +134,10 @@
|
|||
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_BEDONLY, []{ _preheat_bed(editable.int8); });
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_CHAMBER, []{ _preheat_chamber(editable.int8); });
|
||||
#endif
|
||||
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3564,13 +3564,17 @@ void MarlinSettings::reset() {
|
|||
#if HAS_HEATED_BED
|
||||
constexpr uint16_t bpre[] = { REPEAT2_S(1, INCREMENT(PREHEAT_COUNT), _PITEM, TEMP_BED) };
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
constexpr uint16_t cpre[] = { REPEAT2_S(1, INCREMENT(PREHEAT_COUNT), _PITEM, TEMP_CHAMBER) };
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
constexpr uint8_t fpre[] = { REPEAT2_S(1, INCREMENT(PREHEAT_COUNT), _PITEM, FAN_SPEED) };
|
||||
#endif
|
||||
for (uint8_t i = 0; i < PREHEAT_COUNT; ++i) {
|
||||
TERN_(HAS_HOTEND, ui.material_preset[i].hotend_temp = hpre[i]);
|
||||
TERN_(HAS_HEATED_BED, ui.material_preset[i].bed_temp = bpre[i]);
|
||||
TERN_(HAS_FAN, ui.material_preset[i].fan_speed = fpre[i]);
|
||||
TERN_(HAS_HOTEND, ui.material_preset[i].hotend_temp = hpre[i]);
|
||||
TERN_(HAS_HEATED_BED, ui.material_preset[i].bed_temp = bpre[i]);
|
||||
TERN_(HAS_HEATED_CHAMBER, ui.material_preset[i].chamber_temp = cpre[i]);
|
||||
TERN_(HAS_FAN, ui.material_preset[i].fan_speed = fpre[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1335,7 +1335,7 @@ class Temperature {
|
|||
#endif
|
||||
|
||||
#if HAS_MARLINUI_MENU && HAS_TEMPERATURE && HAS_PREHEAT
|
||||
static void lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb);
|
||||
static void lcd_preheat(const uint8_t e, const int8_t indh=-1, const int8_t indb=-1, const int8_t indc=-1);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue