From 4275466f4930ce554419f5f03f07119b8a9aec04 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 Jun 2020 19:44:50 -0500 Subject: [PATCH] Fix issues with no hotend / bed / fan (#18395) --- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M145.cpp | 30 +- Marlin/src/inc/Conditionals_post.h | 14 + Marlin/src/inc/SanityCheck.h | 14 +- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 2 - Marlin/src/lcd/dwin/dwin.cpp | 726 +++++++++++---------- Marlin/src/lcd/dwin/dwin.h | 97 ++- Marlin/src/lcd/menu/menu_configuration.cpp | 30 +- Marlin/src/lcd/menu/menu_filament.cpp | 4 +- Marlin/src/lcd/menu/menu_info.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 4 +- Marlin/src/lcd/menu/menu_temperature.cpp | 118 ++-- Marlin/src/lcd/menu/menu_ubl.cpp | 138 ++-- Marlin/src/lcd/ultralcd.cpp | 4 + Marlin/src/lcd/ultralcd.h | 15 +- Marlin/src/module/configuration_store.cpp | 111 ++-- Marlin/src/module/temperature.cpp | 2 +- Marlin/src/module/temperature.h | 2 +- 19 files changed, 732 insertions(+), 585 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 2ff25057db..d34e0665c6 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -541,7 +541,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 120: M120(); break; // M120: Enable endstops case 121: M121(); break; // M121: Disable endstops - #if HAS_HOTEND && HAS_LCD_MENU + #if PREHEAT_COUNT case 145: M145(); break; // M145: Set material heatup parameters #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8548f3a60c..ab17cc8d7d 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -608,7 +608,7 @@ private: static void M191(); #endif - #if HAS_HOTEND && HAS_LCD_MENU + #if PREHEAT_COUNT static void M145(); #endif diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 30efa39093..6bbde4d13a 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if HAS_HOTEND && HAS_LCD_MENU +#if PREHEAT_COUNT #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -37,25 +37,23 @@ */ void GcodeSuite::M145() { const uint8_t material = (uint8_t)parser.intval('S'); - if (material >= COUNT(ui.preheat_hotend_temp)) + if (material >= PREHEAT_COUNT) SERIAL_ERROR_MSG(STR_ERR_MATERIAL_INDEX); else { - int v; - if (parser.seenval('H')) { - v = parser.value_int(); - ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT)); - } - if (parser.seenval('F')) { - v = parser.value_int(); - ui.preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255); - } + preset_t &mat = ui.material_preset[material]; + #if HAS_HOTEND + if (parser.seenval('H')) + mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT)); + #endif #if TEMP_SENSOR_BED != 0 - if (parser.seenval('B')) { - v = parser.value_int(); - ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAX_TARGET); - } + if (parser.seenval('B')) + mat.bed_temp = constrain(parser.value_int(), BED_MINTEMP, BED_MAX_TARGET); + #endif + #if HAS_FAN + if (parser.seenval('F')) + mat.fan_speed = constrain(parser.value_int(), 0, 255); #endif } } -#endif // HOTENDS && HAS_LCD_MENU +#endif // PREHEAT_COUNT diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index b98f16f348..e1e341d126 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1859,6 +1859,10 @@ #define HAS_CONTROLLER_FAN 1 #endif +#if BED_OR_CHAMBER || HAS_FAN0 + #define BED_OR_CHAMBER_OR_FAN 1 +#endif + // Servos #if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0 #define HAS_SERVO_0 1 @@ -2080,6 +2084,16 @@ #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING) #endif +#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER + #define HAS_TEMPERATURE 1 +#endif + +#if HAS_TEMPERATURE && EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD) + #define PREHEAT_COUNT 2 +#else + #undef PREHEAT_COUNT +#endif + /** * Up to 3 PWM fans */ diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index a9febd968f..004a5b673a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1404,12 +1404,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif -#if HAS_MESH - #if HAS_CLASSIC_JERK - static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); +#if HAS_MESH && HAS_CLASSIC_JERK + static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); +#endif + +#if ENABLED(G26_MESH_VALIDATION) + #if !EXTRUDERS + #error "G26_MESH_VALIDATION requires at least one extruder." + #elif !HAS_MESH + #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL." #endif -#elif ENABLED(G26_MESH_VALIDATION) - #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL." #endif #if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_GRAPHICAL_LCD) diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 6d09228d78..e34e098dfa 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -860,8 +860,6 @@ #define STATUS_CHAMBER_WIDTH 0 #endif -#define BED_OR_CHAMBER_OR_FAN (BED_OR_CHAMBER || HAS_FAN0) - // Can also be overridden in Configuration_adv.h // If you can afford it, try the 3-frame fan animation! // Don't compile in the fan animation with no fan diff --git a/Marlin/src/lcd/dwin/dwin.cpp b/Marlin/src/lcd/dwin/dwin.cpp index 74972228ca..6df5e817f7 100644 --- a/Marlin/src/lcd/dwin/dwin.cpp +++ b/Marlin/src/lcd/dwin/dwin.cpp @@ -87,7 +87,7 @@ HMI_Flag HMI_flag{0}; millis_t Encoder_ms = 0; millis_t Wait_ms = 0; -millis_t heat_time = 0; +millis_t dwin_heat_time = 0; int checkkey = 0, last_checkkey = 0; @@ -743,20 +743,24 @@ inline void Draw_Popup_Bkgd_60() { DWIN_Draw_Rectangle(1, Background_window, 14, 60, 271-13, 330); } -void Popup_Window_ETempTooLow(void) { - Clear_Main_Window(); - Draw_Popup_Bkgd_60(); - DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105); - if (HMI_flag.language_flag) { - DWIN_Frame_AreaCopy(1, 103, 371, 136, 479-93, 69, 240); - DWIN_Frame_AreaCopy(1, 170, 371, 271-1, 479-93, 69+33, 240); - DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280); +#if HAS_HOTEND + + void Popup_Window_ETempTooLow(void) { + Clear_Main_Window(); + Draw_Popup_Bkgd_60(); + DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105); + if (HMI_flag.language_flag) { + DWIN_Frame_AreaCopy(1, 103, 371, 136, 479-93, 69, 240); + DWIN_Frame_AreaCopy(1, 170, 371, 271-1, 479-93, 69+33, 240); + DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280); + } + else { + DWIN_Draw_String(false,true,font8x16, Font_window, Background_window, 20, 235, (char*)"Nozzle is too cold"); + DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280); + } } - else { - DWIN_Draw_String(false,true,font8x16, Font_window, Background_window, 20, 235, (char*)"Nozzle is too cold"); - DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280); - } -} + +#endif void Popup_Window_Resume(void) { Clear_Popup_Area(); @@ -1074,134 +1078,146 @@ void HMI_Zoffset(void) { } } -void HMI_ETemp(void) { - ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState != ENCODER_DIFF_NO) { - if (encoder_diffState == ENCODER_DIFF_CW) - HMI_ValueStruct.E_Temp += EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_CCW) - HMI_ValueStruct.E_Temp -= EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return - EncoderRate.encoderRateEnabled = 0; - if (HMI_ValueStruct.show_mode == -1) { // temperature - checkkey = TemperatureID; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp); - } - else if (HMI_ValueStruct.show_mode == -2) { - checkkey = PLAPreheat; - HMI_ValueStruct.preheat_hotend_temp[0] = HMI_ValueStruct.E_Temp; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[0]); - return; - } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - HMI_ValueStruct.preheat_hotend_temp[1] = HMI_ValueStruct.E_Temp; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[1]); - return; - } - else { // tune - checkkey = Tune; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2+MROWS-index_tune), HMI_ValueStruct.E_Temp); - } - thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0); - return; - } - // E_Temp limit - NOMORE(HMI_ValueStruct.E_Temp, max_E_Temp); - NOLESS(HMI_ValueStruct.E_Temp, min_E_Temp); - // E_Temp value - if (HMI_ValueStruct.show_mode >= 0) // tune - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2+MROWS-index_tune), HMI_ValueStruct.E_Temp); - else // other page - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp); - } -} +#if HAS_HOTEND -void HMI_BedTemp(void) { - ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState != ENCODER_DIFF_NO) { - if (encoder_diffState == ENCODER_DIFF_CW) - HMI_ValueStruct.Bed_Temp += EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_CCW) - HMI_ValueStruct.Bed_Temp -= EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return - EncoderRate.encoderRateEnabled = 0; - if (HMI_ValueStruct.show_mode == -1) { - checkkey = TemperatureID; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp); - } - else if (HMI_ValueStruct.show_mode == -2) { - checkkey = PLAPreheat; - HMI_ValueStruct.preheat_bed_temp[0] = HMI_ValueStruct.Bed_Temp; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[0]); + void HMI_ETemp(void) { + ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState != ENCODER_DIFF_NO) { + if (encoder_diffState == ENCODER_DIFF_CW) + HMI_ValueStruct.E_Temp += EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_CCW) + HMI_ValueStruct.E_Temp -= EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return + EncoderRate.encoderRateEnabled = 0; + if (HMI_ValueStruct.show_mode == -1) { // temperature + checkkey = TemperatureID; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp); + } + else if (HMI_ValueStruct.show_mode == -2) { + checkkey = PLAPreheat; + ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), ui.material_preset[0].hotend_temp); + return; + } + else if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), ui.material_preset[1].hotend_temp); + return; + } + else { // tune + checkkey = Tune; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2+MROWS-index_tune), HMI_ValueStruct.E_Temp); + } + thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0); return; } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - HMI_ValueStruct.preheat_bed_temp[1] = HMI_ValueStruct.Bed_Temp; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[1]); - return; - } - else { - checkkey = Tune; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3+MROWS-index_tune), HMI_ValueStruct.Bed_Temp); - } - thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp); - return; + // E_Temp limit + NOMORE(HMI_ValueStruct.E_Temp, max_E_Temp); + NOLESS(HMI_ValueStruct.E_Temp, min_E_Temp); + // E_Temp value + if (HMI_ValueStruct.show_mode >= 0) // tune + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2+MROWS-index_tune), HMI_ValueStruct.E_Temp); + else // other page + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp); } - //Bed_Temp limit - NOMORE(HMI_ValueStruct.Bed_Temp, max_Bed_Temp); - NOLESS(HMI_ValueStruct.Bed_Temp, min_Bed_Temp); - //Bed_Temp value - if (HMI_ValueStruct.show_mode >= 0) // tune page - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3+MROWS-index_tune), HMI_ValueStruct.Bed_Temp); - else // other page - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp); } -} -void HMI_FanSpeed(void) { - ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState != ENCODER_DIFF_NO) { - if (encoder_diffState == ENCODER_DIFF_CW) - HMI_ValueStruct.Fan_speed += EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_CCW) - HMI_ValueStruct.Fan_speed -= EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return - EncoderRate.encoderRateEnabled = 0; - if (HMI_ValueStruct.show_mode == -1) { - checkkey = TemperatureID; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed); - } - else if (HMI_ValueStruct.show_mode == -2) { - checkkey = PLAPreheat; - HMI_ValueStruct.preheat_fan_speed[0] = HMI_ValueStruct.Fan_speed; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[0]); +#endif + +#if HAS_HEATED_BED + + void HMI_BedTemp(void) { + ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState != ENCODER_DIFF_NO) { + if (encoder_diffState == ENCODER_DIFF_CW) + HMI_ValueStruct.Bed_Temp += EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_CCW) + HMI_ValueStruct.Bed_Temp -= EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return + EncoderRate.encoderRateEnabled = 0; + if (HMI_ValueStruct.show_mode == -1) { + checkkey = TemperatureID; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp); + } + else if (HMI_ValueStruct.show_mode == -2) { + checkkey = PLAPreheat; + ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), ui.material_preset[0].bed_temp); + return; + } + else if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), ui.material_preset[1].bed_temp); + return; + } + else { + checkkey = Tune; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3+MROWS-index_tune), HMI_ValueStruct.Bed_Temp); + } + thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp); return; } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - HMI_ValueStruct.preheat_fan_speed[1] = HMI_ValueStruct.Fan_speed; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[1]); - return; - } - else { - checkkey = Tune; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(4+MROWS-index_tune), HMI_ValueStruct.Fan_speed); - } - thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed); - return; + //Bed_Temp limit + NOMORE(HMI_ValueStruct.Bed_Temp, max_Bed_Temp); + NOLESS(HMI_ValueStruct.Bed_Temp, min_Bed_Temp); + //Bed_Temp value + if (HMI_ValueStruct.show_mode >= 0) // tune page + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3+MROWS-index_tune), HMI_ValueStruct.Bed_Temp); + else // other page + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp); } - //Fan_speed limit - NOMORE(HMI_ValueStruct.Fan_speed, FanOn); - NOLESS(HMI_ValueStruct.Fan_speed, FanOff); - // Fan_speed value - if (HMI_ValueStruct.show_mode >= 0) // tune page - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(4+MROWS-index_tune), HMI_ValueStruct.Fan_speed); - else // other page - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed); } -} + +#endif + +#if HAS_FAN + + void HMI_FanSpeed(void) { + ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState != ENCODER_DIFF_NO) { + if (encoder_diffState == ENCODER_DIFF_CW) + HMI_ValueStruct.Fan_speed += EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_CCW) + HMI_ValueStruct.Fan_speed -= EncoderRate.encoderMoveValue; + else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return + EncoderRate.encoderRateEnabled = 0; + if (HMI_ValueStruct.show_mode == -1) { + checkkey = TemperatureID; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed); + } + else if (HMI_ValueStruct.show_mode == -2) { + checkkey = PLAPreheat; + ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), ui.material_preset[0].fan_speed); + return; + } + else if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), ui.material_preset[1].fan_speed); + return; + } + else { + checkkey = Tune; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(4+MROWS-index_tune), HMI_ValueStruct.Fan_speed); + } + thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed); + return; + } + //Fan_speed limit + NOMORE(HMI_ValueStruct.Fan_speed, FanOn); + NOLESS(HMI_ValueStruct.Fan_speed, FanOff); + // Fan_speed value + if (HMI_ValueStruct.show_mode >= 0) // tune page + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(4+MROWS-index_tune), HMI_ValueStruct.Fan_speed); + else // other page + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed); + } + } + +#endif void HMI_PrintSpeed(void) { ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); @@ -1238,7 +1254,9 @@ void HMI_MaxFeedspeedXYZE(void) { if (HMI_flag.feedspeed_flag == X_AXIS) planner.set_max_feedrate(X_AXIS, HMI_ValueStruct.Max_Feedspeed); else if (HMI_flag.feedspeed_flag == Y_AXIS) planner.set_max_feedrate(Y_AXIS, HMI_ValueStruct.Max_Feedspeed); else if (HMI_flag.feedspeed_flag == Z_AXIS) planner.set_max_feedrate(Z_AXIS, HMI_ValueStruct.Max_Feedspeed); - else if (HMI_flag.feedspeed_flag == E_AXIS) planner.set_max_feedrate(E_AXIS, HMI_ValueStruct.Max_Feedspeed); + #if HAS_HOTEND + else if (HMI_flag.feedspeed_flag == E_AXIS) planner.set_max_feedrate(E_AXIS, HMI_ValueStruct.Max_Feedspeed); + #endif DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed); return; } @@ -1246,7 +1264,9 @@ void HMI_MaxFeedspeedXYZE(void) { if (HMI_flag.feedspeed_flag == X_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[X_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[X_AXIS]*2;} else if (HMI_flag.feedspeed_flag == Y_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[Y_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[Y_AXIS]*2;} else if (HMI_flag.feedspeed_flag == Z_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[Z_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[Z_AXIS]*2;} - else if (HMI_flag.feedspeed_flag == E_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[E_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[E_AXIS]*2;} + #if HAS_HOTEND + else if (HMI_flag.feedspeed_flag == E_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[E_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[E_AXIS]*2;} + #endif if (HMI_ValueStruct.Max_Feedspeed < min_MaxFeedspeed) HMI_ValueStruct.Max_Feedspeed = min_MaxFeedspeed; //MaxFeedspeed value DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed); @@ -1264,7 +1284,9 @@ void HMI_MaxAccelerationXYZE(void) { if (HMI_flag.acc_flag == X_AXIS) planner.set_max_acceleration(X_AXIS, HMI_ValueStruct.Max_Acceleration); else if (HMI_flag.acc_flag == Y_AXIS) planner.set_max_acceleration(Y_AXIS, HMI_ValueStruct.Max_Acceleration); else if (HMI_flag.acc_flag == Z_AXIS) planner.set_max_acceleration(Z_AXIS, HMI_ValueStruct.Max_Acceleration); - else if (HMI_flag.acc_flag == E_AXIS) planner.set_max_acceleration(E_AXIS, HMI_ValueStruct.Max_Acceleration); + #if HAS_HOTEND + else if (HMI_flag.acc_flag == E_AXIS) planner.set_max_acceleration(E_AXIS, HMI_ValueStruct.Max_Acceleration); + #endif DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration); return; } @@ -1272,7 +1294,9 @@ void HMI_MaxAccelerationXYZE(void) { if (HMI_flag.acc_flag == X_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[X_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[X_AXIS]*2;} else if (HMI_flag.acc_flag == Y_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[Y_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[Y_AXIS]*2;} else if (HMI_flag.acc_flag == Z_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[Z_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[Z_AXIS]*2;} - else if (HMI_flag.acc_flag == E_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[E_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[E_AXIS]*2;} + #if HAS_HOTEND + else if (HMI_flag.acc_flag == E_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[E_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[E_AXIS]*2;} + #endif if (HMI_ValueStruct.Max_Acceleration < min_MaxAcceleration) HMI_ValueStruct.Max_Acceleration = min_MaxAcceleration; // MaxAcceleration value DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration); @@ -2105,14 +2129,14 @@ void HMI_Prepare(void) { #endif break; case 5: // PLA preheat - thermalManager.setTargetHotend(HMI_ValueStruct.preheat_hotend_temp[0], 0); - thermalManager.setTargetBed(HMI_ValueStruct.preheat_bed_temp[0]); - thermalManager.set_fan_speed(0, HMI_ValueStruct.preheat_fan_speed[0]); + thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0); + thermalManager.setTargetBed(ui.material_preset[0].bed_temp); + thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed); break; case 6: // ABS preheat - thermalManager.setTargetHotend(HMI_ValueStruct.preheat_hotend_temp[1], 0); - thermalManager.setTargetBed(HMI_ValueStruct.preheat_bed_temp[1]); - thermalManager.set_fan_speed(0, HMI_ValueStruct.preheat_fan_speed[1]); + thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0); + thermalManager.setTargetBed(ui.material_preset[1].bed_temp); + thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed); break; case 7: // cool thermalManager.zero_fan_speeds(); @@ -2287,20 +2311,23 @@ void HMI_AxisMove(void) { ENCODER_DiffState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; - // popup window resume - if (HMI_flag.ETempTooLow_flag) { - if (encoder_diffState == ENCODER_DIFF_ENTER) { - HMI_flag.ETempTooLow_flag = 0; - Draw_Move_Menu(); - current_position.e = HMI_ValueStruct.Move_E_scale = 0; - DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale); - DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale); - DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); - show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); - DWIN_UpdateLCD(); + #if HAS_HOTEND + // popup window resume + if (HMI_flag.ETempTooLow_flag) { + if (encoder_diffState == ENCODER_DIFF_ENTER) { + HMI_flag.ETempTooLow_flag = 0; + Draw_Move_Menu(); + current_position.e = HMI_ValueStruct.Move_E_scale = 0; + DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale); + DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale); + DWIN_Draw_FloatValue(true,true,0,font8x16,White,Background_black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); + show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + DWIN_UpdateLCD(); + } + return; } - return; - } + #endif + // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { if (select_axis.inc(4)) Move_Highlight(1, select_axis.now); @@ -2334,28 +2361,30 @@ void HMI_AxisMove(void) { DWIN_Draw_FloatValue(true,true,0,font8x16,White,Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); EncoderRate.encoderRateEnabled = 1; break; - case 4: // Extruder - // window tips - #ifdef PREVENT_COLD_EXTRUSION - if (thermalManager.temp_hotend[0].celsius < EXTRUDE_MINTEMP) { - HMI_flag.ETempTooLow_flag = 1; - Popup_Window_ETempTooLow(); - DWIN_UpdateLCD(); - return; - } - #endif - checkkey = Extruder; - HMI_ValueStruct.Move_E_scale = current_position.e*MinUnitMult; - show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); - EncoderRate.encoderRateEnabled = 1; - break; - default: - break; + #if HAS_HOTEND + case 4: // Extruder + // window tips + #ifdef PREVENT_COLD_EXTRUSION + if (thermalManager.temp_hotend[0].celsius < EXTRUDE_MINTEMP) { + HMI_flag.ETempTooLow_flag = 1; + Popup_Window_ETempTooLow(); + DWIN_UpdateLCD(); + return; + } + #endif + checkkey = Extruder; + HMI_ValueStruct.Move_E_scale = current_position.e*MinUnitMult; + show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + EncoderRate.encoderRateEnabled = 1; + break; + #endif } } DWIN_UpdateLCD(); } +enum + /* TemperatureID */ void HMI_Temperature(void) { ENCODER_DiffState encoder_diffState = get_encoder_state(); @@ -2376,126 +2405,132 @@ void HMI_Temperature(void) { index_control = MROWS; Draw_Control_Menu(); break; - case 1: // nozzle temperature - checkkey = ETemp; - HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target); - EncoderRate.encoderRateEnabled = 1; - break; - case 2: // bed temperature - checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target); - EncoderRate.encoderRateEnabled = 1; - break; - case 3: // fan speed - checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]); - EncoderRate.encoderRateEnabled = 1; - break; - case 4: // PLA preheat setting + #if HAS_HOTEND + case 1: // nozzle temperature + checkkey = ETemp; + HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_HEATED_BED + case 2: // bed temperature + checkkey = BedTemp; + HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_FAN + case 3: // fan speed + checkkey = FanSpeed; + HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_HOTEND + case 4: // PLA preheat setting - checkkey = PLAPreheat; - select_PLA.reset(); - HMI_ValueStruct.show_mode = -2; + checkkey = PLAPreheat; + select_PLA.reset(); + HMI_ValueStruct.show_mode = -2; - Clear_Main_Window(); + Clear_Main_Window(); - if (HMI_flag.language_flag) { - DWIN_Frame_AreaCopy(1, 59, 16, 271-132, 479-450, 14, 8); + if (HMI_flag.language_flag) { + DWIN_Frame_AreaCopy(1, 59, 16, 271-132, 479-450, 14, 8); - DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 134, 271-215, 479-333, LBLX+24, MBASE(1)); // PLA nozzle temp - DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(2)); - DWIN_Frame_AreaCopy(1, 58, 134, 271-158, 479-333, LBLX+24, MBASE(2)); // PLA bed temp - DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 115, 134, 271-101, 479-333, LBLX+24, MBASE(3)); // PLA fan speed - DWIN_Frame_AreaCopy(1, 72, 148, 271-120, 479-317, LBLX, MBASE(4)); // save PLA configuration - } - else { - #ifdef USE_STRING_HEADINGS - Draw_Title("PLA Settings"); // TODO: GET_TEXT_F - #else - DWIN_Frame_AreaCopy(1, 56, 16, 271-130, 479-450-1, 14, 8); - #endif + DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 134, 271-215, 479-333, LBLX+24, MBASE(1)); // PLA nozzle temp + DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(2)); + DWIN_Frame_AreaCopy(1, 58, 134, 271-158, 479-333, LBLX+24, MBASE(2)); // PLA bed temp + DWIN_Frame_AreaCopy(1, 100, 89, 124, 479-378, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 115, 134, 271-101, 479-333, LBLX+24, MBASE(3)); // PLA fan speed + DWIN_Frame_AreaCopy(1, 72, 148, 271-120, 479-317, LBLX, MBASE(4)); // save PLA configuration + } + else { + #ifdef USE_STRING_HEADINGS + Draw_Title("PLA Settings"); // TODO: GET_TEXT_F + #else + DWIN_Frame_AreaCopy(1, 56, 16, 271-130, 479-450-1, 14, 8); + #endif - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 197, 104, 271-33, 479-365, LBLX+24+3, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+41+6, MBASE(1)); // PLA nozzle temp - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(2)+3); - DWIN_Frame_AreaCopy(1, 240, 104, 271-7, 479-365, LBLX+24+3, MBASE(2)+3); - DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+24+6, MBASE(2)+3); // PLA bed temp - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 0, 119, 271-207, 479-347, LBLX+24+3, MBASE(3)); // PLA fan speed - DWIN_Frame_AreaCopy(1, 97, 165, 271-42, 479-301-1, LBLX, MBASE(4)); // save PLA configuration - } + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 197, 104, 271-33, 479-365, LBLX+24+3, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+41+6, MBASE(1)); // PLA nozzle temp + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(2)+3); + DWIN_Frame_AreaCopy(1, 240, 104, 271-7, 479-365, LBLX+24+3, MBASE(2)+3); + DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+24+6, MBASE(2)+3); // PLA bed temp + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479-393, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 0, 119, 271-207, 479-347, LBLX+24+3, MBASE(3)); // PLA fan speed + DWIN_Frame_AreaCopy(1, 97, 165, 271-42, 479-301-1, LBLX, MBASE(4)); // save PLA configuration + } - Draw_Back_First(); + Draw_Back_First(); - Draw_Menu_Line(1, ICON_SetEndTemp); - Draw_Menu_Line(2, ICON_SetBedTemp); - Draw_Menu_Line(3, ICON_FanSpeed); - Draw_Menu_Line(4, ICON_WriteEEPROM); + Draw_Menu_Line(1, ICON_SetEndTemp); + Draw_Menu_Line(2, ICON_SetBedTemp); + Draw_Menu_Line(3, ICON_FanSpeed); + Draw_Menu_Line(4, ICON_WriteEEPROM); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[0]); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[0]); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[0]); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), ui.material_preset[0].hotend_temp); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), ui.material_preset[0].bed_temp); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), ui.material_preset[0].fan_speed); - break; - case 5: // ABS preheat setting + break; + case 5: // ABS preheat setting - checkkey = ABSPreheat; - select_ABS.reset(); - HMI_ValueStruct.show_mode = -3; + checkkey = ABSPreheat; + select_ABS.reset(); + HMI_ValueStruct.show_mode = -3; - Clear_Main_Window(); + Clear_Main_Window(); - if (HMI_flag.language_flag) { - DWIN_Frame_AreaCopy(1, 142, 16, 271-48, 479-450, 14, 8); + if (HMI_flag.language_flag) { + DWIN_Frame_AreaCopy(1, 142, 16, 271-48, 479-450, 14, 8); - DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 134, 271-215, 479-333, LBLX+24, MBASE(1)); // ABS nozzle temp - DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(2)); - DWIN_Frame_AreaCopy(1, 58, 134, 271-158, 479-333, LBLX+24, MBASE(2)); // ABS bed temp - DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 115, 134, 271-101, 479-333, LBLX+24, MBASE(3)); // ABS fan speed - DWIN_Frame_AreaCopy(1, 72, 148, 271-120, 479-317, LBLX, MBASE(4)); - DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX+28, MBASE(4)+2); // save ABS configuration - } - else { - #ifdef USE_STRING_HEADINGS - Draw_Title("ABS Settings"); // TODO: GET_TEXT_F - #else - DWIN_Frame_AreaCopy(1, 56, 16, 271-130, 479-450-1, 14, 8); - #endif + DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 134, 271-215, 479-333, LBLX+24, MBASE(1)); // ABS nozzle temp + DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(2)); + DWIN_Frame_AreaCopy(1, 58, 134, 271-158, 479-333, LBLX+24, MBASE(2)); // ABS bed temp + DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 115, 134, 271-101, 479-333, LBLX+24, MBASE(3)); // ABS fan speed + DWIN_Frame_AreaCopy(1, 72, 148, 271-120, 479-317, LBLX, MBASE(4)); + DWIN_Frame_AreaCopy(1, 180, 89, 204, 479-379, LBLX+28, MBASE(4)+2); // save ABS configuration + } + else { + #ifdef USE_STRING_HEADINGS + Draw_Title("ABS Settings"); // TODO: GET_TEXT_F + #else + DWIN_Frame_AreaCopy(1, 56, 16, 271-130, 479-450-1, 14, 8); + #endif - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 197, 104, 271-33, 479-365, LBLX+24+3, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+41+6, MBASE(1)); // ABS nozzle temp - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(2)+3); - DWIN_Frame_AreaCopy(1, 240, 104, 271-7, 479-365, LBLX+24+3, MBASE(2)+3); - DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+24+6, MBASE(2)+3); // ABS bed temp - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 0, 119, 271-207, 479-347, LBLX+24+3, MBASE(3)); // ABS fan speed - DWIN_Frame_AreaCopy(1, 97, 165, 271-42, 479-301-1, LBLX, MBASE(4)); - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX+33, MBASE(4)); // save ABS configuration - } + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 197, 104, 271-33, 479-365, LBLX+24+3, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+41+6, MBASE(1)); // ABS nozzle temp + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(2)+3); + DWIN_Frame_AreaCopy(1, 240, 104, 271-7, 479-365, LBLX+24+3, MBASE(2)+3); + DWIN_Frame_AreaCopy(1, 1, 89, 271-188, 479-377-1, LBLX+24+24+6, MBASE(2)+3); // ABS bed temp + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 0, 119, 271-207, 479-347, LBLX+24+3, MBASE(3)); // ABS fan speed + DWIN_Frame_AreaCopy(1, 97, 165, 271-42, 479-301-1, LBLX, MBASE(4)); + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479-393, LBLX+33, MBASE(4)); // save ABS configuration + } - Draw_Back_First(); + Draw_Back_First(); - Draw_Menu_Line(1, ICON_SetEndTemp); - Draw_Menu_Line(2, ICON_SetBedTemp); - Draw_Menu_Line(3, ICON_FanSpeed); - Draw_Menu_Line(4, ICON_WriteEEPROM); + Draw_Menu_Line(1, ICON_SetEndTemp); + Draw_Menu_Line(2, ICON_SetBedTemp); + Draw_Menu_Line(3, ICON_FanSpeed); + Draw_Menu_Line(4, ICON_WriteEEPROM); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[1]); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[1]); - DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[1]); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(1), ui.material_preset[1].hotend_temp); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(2), ui.material_preset[1].bed_temp); + DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 3, 216, MBASE(3), ui.material_preset[1].fan_speed); - break; - default: - break; + break; + #endif } } DWIN_UpdateLCD(); @@ -2792,24 +2827,30 @@ void HMI_Tune(void) { DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1+MROWS-index_tune), feedrate_percentage); EncoderRate.encoderRateEnabled = 1; break; - case 2: // nozzle temp - checkkey = ETemp; - HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2+MROWS-index_tune), thermalManager.temp_hotend[0].target); - EncoderRate.encoderRateEnabled = 1; - break; - case 3: // bed temp - checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3+MROWS-index_tune), thermalManager.temp_bed.target); - EncoderRate.encoderRateEnabled = 1; - break; - case 4: // fan speed - checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(4+MROWS-index_tune), thermalManager.fan_speed[0]); - EncoderRate.encoderRateEnabled = 1; - break; + #if HAS_HOTEND + case 2: // nozzle temp + checkkey = ETemp; + HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2+MROWS-index_tune), thermalManager.temp_hotend[0].target); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_HEATED_BED + case 3: // bed temp + checkkey = BedTemp; + HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3+MROWS-index_tune), thermalManager.temp_bed.target); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_FAN + case 4: // fan speed + checkkey = FanSpeed; + HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(4+MROWS-index_tune), thermalManager.fan_speed[0]); + EncoderRate.encoderRateEnabled = 1; + break; + #endif case 5: // z-offset checkkey = Homeoffset; HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; @@ -2860,24 +2901,30 @@ void HMI_PLAPreheatSetting(void) { HMI_ValueStruct.show_mode = -1; Draw_Temperature_Menu(); break; - case 1: // set nozzle temperature - checkkey = ETemp; - HMI_ValueStruct.E_Temp = HMI_ValueStruct.preheat_hotend_temp[0]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[0]); - EncoderRate.encoderRateEnabled = 1; - break; - case 2: // set bed temperature - checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = HMI_ValueStruct.preheat_bed_temp[0]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[0]); - EncoderRate.encoderRateEnabled = 1; - break; - case 3: // set fan speed - checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = HMI_ValueStruct.preheat_fan_speed[0]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[0]); - EncoderRate.encoderRateEnabled = 1; - break; + #if HAS_HOTEND + case 1: // set nozzle temperature + checkkey = ETemp; + HMI_ValueStruct.E_Temp = ui.material_preset[0].hotend_temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), ui.material_preset[0].hotend_temp); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_HEATED_BED + case 2: // set bed temperature + checkkey = BedTemp; + HMI_ValueStruct.Bed_Temp = ui.material_preset[0].bed_temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), ui.material_preset[0].bed_temp); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_FAN + case 3: // set fan speed + checkkey = FanSpeed; + HMI_ValueStruct.Fan_speed = ui.material_preset[0].fan_speed; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), ui.material_preset[0].fan_speed); + EncoderRate.encoderRateEnabled = 1; + break; + #endif case 4: // save PLA configuration if (settings.save()) { buzzer.tone(100, 659); @@ -2885,8 +2932,7 @@ void HMI_PLAPreheatSetting(void) { } else buzzer.tone(20, 440); break; - default: - break; + default: break; } } DWIN_UpdateLCD(); @@ -2912,24 +2958,30 @@ void HMI_ABSPreheatSetting(void) { HMI_ValueStruct.show_mode = -1; Draw_Temperature_Menu(); break; - case 1: // set nozzle temperature - checkkey = ETemp; - HMI_ValueStruct.E_Temp = HMI_ValueStruct.preheat_hotend_temp[1]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[1]); - EncoderRate.encoderRateEnabled = 1; - break; - case 2: // set bed temperature - checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = HMI_ValueStruct.preheat_bed_temp[1]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[1]); - EncoderRate.encoderRateEnabled = 1; - break; - case 3: // set fan speed - checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = HMI_ValueStruct.preheat_fan_speed[1]; - DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[1]); - EncoderRate.encoderRateEnabled = 1; - break; + #if HAS_HOTEND + case 1: // set nozzle temperature + checkkey = ETemp; + HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), ui.material_preset[1].hotend_temp); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_HEATED_BED + case 2: // set bed temperature + checkkey = BedTemp; + HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), ui.material_preset[1].bed_temp); + EncoderRate.encoderRateEnabled = 1; + break; + #endif + #if HAS_FAN + case 3: // set fan speed + checkkey = FanSpeed; + HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed; + DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), ui.material_preset[1].fan_speed); + EncoderRate.encoderRateEnabled = 1; + break; + #endif case 4: // save PLA configuration if (settings.save()) { buzzer.tone(100, 659); @@ -3257,7 +3309,7 @@ void EachMomentUpdate(void) { /* remain print time */ static millis_t next_remain_time_update = 0; if (elapsed.minute() > 5 && ELAPSED(ms, next_remain_time_update) && HMI_flag.heat_flag == 0) { // show after 5 min and 20s update - remain_time = ((elapsed.value - heat_time) * ((float)card.getFileSize() / (float)card.getIndex())) - (elapsed.value - heat_time); + remain_time = ((elapsed.value - dwin_heat_time) * ((float)card.getFileSize() / (float)card.getIndex())) - (elapsed.value - dwin_heat_time); next_remain_time_update += 20 * 1000UL; Draw_Print_ProgressRemain(); } @@ -3365,9 +3417,15 @@ void DWIN_HandleScreen(void) { case Move_Z: HMI_Move_Z(); break; case Extruder: HMI_Move_E(); break; case Homeoffset: HMI_Zoffset(); break; - case ETemp: HMI_ETemp(); break; - case BedTemp: HMI_BedTemp(); break; - case FanSpeed: HMI_FanSpeed(); break; + #if HAS_HOTEND + case ETemp: HMI_ETemp(); break; + #endif + #if HAS_HEATED_BED + case BedTemp: HMI_BedTemp(); break; + #endif + #if HAS_FAN + case FanSpeed: HMI_FanSpeed(); break; + #endif case PrintSpeed: HMI_PrintSpeed(); break; case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break; case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break; diff --git a/Marlin/src/lcd/dwin/dwin.h b/Marlin/src/lcd/dwin/dwin.h index 7be302683b..9b78601404 100644 --- a/Marlin/src/lcd/dwin/dwin.h +++ b/Marlin/src/lcd/dwin/dwin.h @@ -81,8 +81,10 @@ enum processID { Motion, Info, Tune, - PLAPreheat, - ABSPreheat, + #if HAS_HOTEND + PLAPreheat, + ABSPreheat, + #endif MaxSpeed, MaxSpeed_value, MaxAcceleration, @@ -105,9 +107,15 @@ enum processID { Move_Z, Extruder, Homeoffset, - ETemp, - BedTemp, - FanSpeed, + #if HAS_HOTEND + ETemp, + #endif + #if HAS_HEATED_BED + BedTemp, + #endif + #if HAS_FAN + FanSpeed, + #endif PrintSpeed, /*Window ID*/ @@ -251,26 +259,31 @@ extern int checkkey, last_checkkey; extern float zprobe_zoffset; extern char print_filename[16]; -extern millis_t heat_time; +extern millis_t dwin_heat_time; typedef struct { - int16_t E_Temp = 0; - int16_t Bed_Temp = 0; - int16_t Fan_speed = 0; + #if HAS_HOTEND + int16_t E_Temp = 0; + #endif + #if HAS_HEATED_BED + int16_t Bed_Temp = 0; + #endif + #if HAS_FAN + int16_t Fan_speed = 0; + #endif int16_t print_speed = 100; - float Max_Feedspeed = 0; - float Max_Acceleration = 0; - float Max_Corner = 0; - float Max_Step = 0; - float Move_X_scale = 0; - float Move_Y_scale = 0; - float Move_Z_scale = 0; - float Move_E_scale = 0; - float offset_value = 0; - char show_mode = 0; // -1: Temperature control 0: Printing temperature - int16_t preheat_hotend_temp[2]; - int16_t preheat_bed_temp[2]; - uint8_t preheat_fan_speed[2]; + float Max_Feedspeed = 0; + float Max_Acceleration = 0; + float Max_Corner = 0; + float Max_Step = 0; + float Move_X_scale = 0; + float Move_Y_scale = 0; + float Move_Z_scale = 0; + #if EXTRUDERS + float Move_E_scale = 0; + #endif + float offset_value = 0; + char show_mode = 0; // -1: Temperature control 0: Printing temperature } HMI_value_t; typedef struct { @@ -281,9 +294,15 @@ typedef struct { bool select_flag:1; bool home_flag:1; bool heat_flag:1; // 0: heating done 1: during heating - bool ETempTooLow_flag:1; - bool leveling_offset_flag:1; - char feedspeed_flag; + #if HAS_HOTEND + bool ETempTooLow_flag:1; + #endif + #if HAS_LEVELING + bool leveling_offset_flag:1; + #endif + #if HAS_FAN + char feedspeed_flag; + #endif char acc_flag; char corner_flag; char step_flag; @@ -310,8 +329,11 @@ void ICON_Continue(bool show); void ICON_Stop(bool show); /* Popup window tips */ -void Popup_Window_Temperature(const bool toohigh); -void Popup_Window_ETempTooLow(void); +#if HAS_HOTEND + void Popup_Window_Temperature(const bool toohigh); + void Popup_Window_ETempTooLow(void); +#endif + void Popup_Window_Resume(void); void Popup_Window_Home(void); void Popup_Window_Leveling(void); @@ -326,9 +348,16 @@ void HMI_Move_Z(void); void HMI_Move_E(void); void HMI_Zoffset(void); -void HMI_ETemp(void); -void HMI_BedTemp(void); -void HMI_FanSpeed(void); + +#if HAS_HOTEND + void HMI_ETemp(void); +#endif +#if HAS_HEATED_BED + void HMI_BedTemp(void); +#endif +#if HAS_FAN + void HMI_FanSpeed(void); +#endif void HMI_PrintSpeed(void); void HMI_MaxFeedspeedXYZE(void); @@ -363,8 +392,12 @@ void HMI_Temperature(void); // 温度菜单 void HMI_Motion(void); // 运动菜单 void HMI_Info(void); // 信息菜单 void HMI_Tune(void); // 调整菜单 -void HMI_PLAPreheatSetting(void); // PLA预热设置 -void HMI_ABSPreheatSetting(void); // ABS预热设置 + +#if HAS_HOTEND + void HMI_PLAPreheatSetting(void); // PLA预热设置 + void HMI_ABSPreheatSetting(void); // ABS预热设置 +#endif + void HMI_MaxSpeed(void); // 最大速度子菜单 void HMI_MaxAcceleration(void); // 最大加速度子菜单 void HMI_MaxCorner(void); // 最大拐角速度子菜单 diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index b1048e2895..20fa9cc8b5 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -298,7 +298,7 @@ void menu_advanced_settings(); #endif -#if DISABLED(SLIM_LCD_MENUS) +#if PREHEAT_COUNT && DISABLED(SLIM_LCD_MENUS) void _menu_configuration_preheat_settings(const uint8_t material) { #define _MINTEMP_ITEM(N) HEATER_##N##_MINTEMP, @@ -307,12 +307,12 @@ void menu_advanced_settings(); #define MAXTEMP_ALL _MAX(REPEAT(HOTENDS, _MAXTEMP_ITEM) 0) START_MENU(); BACK_ITEM(MSG_CONFIGURATION); - EDIT_ITEM(percent, MSG_FAN_SPEED, &ui.preheat_fan_speed[material], 0, 255); + EDIT_ITEM(percent, MSG_FAN_SPEED, &ui.material_preset[material].fan_speed, 0, 255); #if HAS_TEMP_HOTEND - EDIT_ITEM(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - HOTEND_OVERSHOOT); + EDIT_ITEM(int3, MSG_NOZZLE, &ui.material_preset[material].hotend_temp, MINTEMP_ALL, MAXTEMP_ALL - HOTEND_OVERSHOOT); #endif #if HAS_HEATED_BED - EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAX_TARGET); + EDIT_ITEM(int3, MSG_BED, &ui.material_preset[material].bed_temp, BED_MINTEMP, BED_MAX_TARGET); #endif #if ENABLED(EEPROM_SETTINGS) ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings); @@ -322,6 +322,15 @@ void menu_advanced_settings(); void menu_preheat_material1_settings() { _menu_configuration_preheat_settings(0); } void menu_preheat_material2_settings() { _menu_configuration_preheat_settings(1); } + #if PREHEAT_COUNT >= 3 + void menu_preheat_material3_settings() { _menu_configuration_preheat_settings(3); } + #if PREHEAT_COUNT >= 4 + void menu_preheat_material4_settings() { _menu_configuration_preheat_settings(4); } + #if PREHEAT_COUNT >= 5 + void menu_preheat_material5_settings() { _menu_configuration_preheat_settings(5); } + #endif + #endif + #endif #endif @@ -400,10 +409,19 @@ void menu_configuration() { EDIT_ITEM(bool, MSG_OUTAGE_RECOVERY, &recovery.enabled, recovery.changed); #endif - #if DISABLED(SLIM_LCD_MENUS) - // Preheat configurations + // Preheat configurations + #if PREHEAT_COUNT && DISABLED(SLIM_LCD_MENUS) SUBMENU(MSG_PREHEAT_1_SETTINGS, menu_preheat_material1_settings); SUBMENU(MSG_PREHEAT_2_SETTINGS, menu_preheat_material2_settings); + #if PREHEAT_COUNT >= 3 + SUBMENU(MSG_PREHEAT_3_SETTINGS, menu_preheat_material3_settings); + #if PREHEAT_COUNT >= 4 + SUBMENU(MSG_PREHEAT_4_SETTINGS, menu_preheat_material4_settings); + #if PREHEAT_COUNT >= 5 + SUBMENU(MSG_PREHEAT_5_SETTINGS, menu_preheat_material5_settings); + #endif + #endif + #endif #endif #if ENABLED(EEPROM_SETTINGS) diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 5598306ae8..1c7abba6d4 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -81,8 +81,8 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { START_MENU(); if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT); BACK_ITEM(MSG_BACK); - ACTION_ITEM(MSG_PREHEAT_1, []{ _change_filament(ui.preheat_hotend_temp[0]); }); - ACTION_ITEM(MSG_PREHEAT_2, []{ _change_filament(ui.preheat_hotend_temp[1]); }); + ACTION_ITEM(MSG_PREHEAT_1, []{ _change_filament(ui.material_preset[0].hotend_temp); }); + ACTION_ITEM(MSG_PREHEAT_2, []{ _change_filament(ui.material_preset[1].hotend_temp); }); EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_extruder].target, EXTRUDE_MINTEMP, thermalManager.heater_maxtemp[extruder] - HOTEND_OVERSHOOT, []{ _change_filament(thermalManager.temp_hotend[_change_filament_extruder].target); }); diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index ef269f7088..671fee099e 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -243,7 +243,7 @@ void menu_info_board() { STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 - #if HAS_BED_LEVELING + #if HAS_LEVELING STATIC_ITEM( TERN_(AUTO_BED_LEVELING_3POINT, MSG_3POINT_LEVELING) // 3-Point Leveling TERN_(AUTO_BED_LEVELING_LINEAR, MSG_LINEAR_LEVELING) // Linear Leveling diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 7ef267ff6a..b4f591a62c 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -157,7 +157,9 @@ void menu_main() { SUBMENU(MSG_CUTTER(MENU), menu_spindle_laser); #endif - SUBMENU(MSG_TEMPERATURE, menu_temperature); + #if HAS_TEMPERATURE + SUBMENU(MSG_TEMPERATURE, menu_temperature); + #endif #if HAS_POWER_MONITOR MENU_ITEM(submenu, MSG_POWER_MONITOR, menu_power_monitor); diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index e95a7cf22f..9ff2e75807 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -24,9 +24,9 @@ // Temperature Menu // -#include "../../inc/MarlinConfigPre.h" +#include "../../inc/MarlinConfig.h" -#if HAS_LCD_MENU +#if HAS_LCD_MENU && HAS_TEMPERATURE #include "menu.h" #include "../../module/temperature.h" @@ -39,23 +39,19 @@ #include "../../module/tool_change.h" #endif -// Initialized by settings.load() -int16_t MarlinUI::preheat_hotend_temp[2], MarlinUI::preheat_bed_temp[2]; -uint8_t MarlinUI::preheat_fan_speed[2]; - // // "Temperature" submenu items // void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) { #if HAS_HOTEND - if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0) - setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.preheat_hotend_temp[indh]), e); + if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0) + setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e); #else UNUSED(e); UNUSED(indh); #endif #if HAS_HEATED_BED - if (indb >= 0 && ui.preheat_bed_temp[indb] > 0) setTargetBed(ui.preheat_bed_temp[indb]); + if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp); #else UNUSED(indb); #endif @@ -64,7 +60,7 @@ void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t i #if FAN_COUNT > 1 active_extruder < FAN_COUNT ? active_extruder : #endif - 0), ui.preheat_fan_speed[indh] + 0), ui.material_preset[indh].fan_speed ); #endif ui.return_to_status(); @@ -82,68 +78,66 @@ void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t i #if HAS_TEMP_HOTEND || HAS_HEATED_BED - #define _PREHEAT_ITEMS(M,N) do{ \ - ACTION_ITEM_N(N, MSG_PREHEAT_##M##_H, []{ _preheat_both(M-1, MenuItemBase::itemIndex); }); \ - ACTION_ITEM_N(N, MSG_PREHEAT_##M##_END_E, []{ _preheat_end(M-1, MenuItemBase::itemIndex); }); \ - }while(0) - #if HAS_HEATED_BED - #define PREHEAT_ITEMS(M,N) _PREHEAT_ITEMS(M,N) + #if HAS_TEMP_HOTEND && HAS_HEATED_BED + #define _PREHEAT_ITEMS(M,E) do{ \ + ACTION_ITEM_N_P(E, msg_preheat_h[M], []{ _preheat_both(M, MenuItemBase::itemIndex); }); \ + ACTION_ITEM_N_P(E, msg_preheat_end_e[M], []{ _preheat_end(M, MenuItemBase::itemIndex); }); \ + }while(0) + #if HAS_HEATED_BED + #define PREHEAT_ITEMS(M,E) _PREHEAT_ITEMS(M,E) + #endif #else - #define PREHEAT_ITEMS(M,N) \ - ACTION_ITEM_N(N, MSG_PREHEAT_##M##_H, []{ _preheat_end(M-1, MenuItemBase::itemIndex); }) + #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N(E, msg_preheat_h[M], []{ _preheat_end(M, MenuItemBase::itemIndex); }) #endif - void menu_preheat_m1() { + void menu_preheat_m(const uint8_t m) { + editable.int8 = m; + #if HOTENDS == 1 + PGM_P msg_preheat[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1), GET_TEXT(MSG_PREHEAT_2), GET_TEXT(MSG_PREHEAT_3), GET_TEXT(MSG_PREHEAT_4), GET_TEXT(MSG_PREHEAT_5)); + PGM_P msg_preheat_end[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1_END), GET_TEXT(MSG_PREHEAT_2_END), GET_TEXT(MSG_PREHEAT_3_END), GET_TEXT(MSG_PREHEAT_4_END), GET_TEXT(MSG_PREHEAT_5_END)); + #elif HAS_MULTI_HOTEND + PGM_P msg_preheat_all[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1_ALL), GET_TEXT(MSG_PREHEAT_2_ALL), GET_TEXT(MSG_PREHEAT_3_ALL), GET_TEXT(MSG_PREHEAT_4_ALL), GET_TEXT(MSG_PREHEAT_5_ALL)); + #endif + PGM_P msg_preheat_end_e[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1_END_E), GET_TEXT(MSG_PREHEAT_2_END_E), GET_TEXT(MSG_PREHEAT_3_END_E), GET_TEXT(MSG_PREHEAT_4_END_E), GET_TEXT(MSG_PREHEAT_5_END_E)); + PGM_P msg_preheat_bed[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1_BEDONLY), GET_TEXT(MSG_PREHEAT_2_BEDONLY), GET_TEXT(MSG_PREHEAT_3_BEDONLY), GET_TEXT(MSG_PREHEAT_4_BEDONLY), GET_TEXT(MSG_PREHEAT_5_BEDONLY)); + PGM_P msg_preheat_h[] = ARRAY_N(PREHEAT_COUNT, GET_TEXT(MSG_PREHEAT_1_H), GET_TEXT(MSG_PREHEAT_2_H), GET_TEXT(MSG_PREHEAT_3_H), GET_TEXT(MSG_PREHEAT_4_H), GET_TEXT(MSG_PREHEAT_5_H)); + START_MENU(); BACK_ITEM(MSG_TEMPERATURE); #if HOTENDS == 1 #if HAS_HEATED_BED - ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_both(0, 0); }); - ACTION_ITEM(MSG_PREHEAT_1_END, []{ _preheat_end(0, 0); }); + ACTION_ITEM_P(msg_preheat[m], []{ _preheat_both(editable.int8, 0); }); + ACTION_ITEM_P(msg_preheat_end[m], []{ _preheat_end(editable.int8, 0); }); #else - ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); }); + ACTION_ITEM_P(msg_preheat[m], []{ _preheat_end(editable.int8, 0); }); #endif #elif HAS_MULTI_HOTEND #if HAS_HEATED_BED - _PREHEAT_ITEMS(1,0); + _PREHEAT_ITEMS(editable.int8,0); #endif - LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(1,n); - ACTION_ITEM(MSG_PREHEAT_1_ALL, []() { - TERN_(HAS_HEATED_BED, _preheat_bed(0)); - HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e); + LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(editable.int8,n); + ACTION_ITEM_P(msg_preheat_all[m], []() { + TERN_(HAS_HEATED_BED, _preheat_bed(editable.int8)); + HOTEND_LOOP() thermalManager.setTargetHotend(ui.material_preset[editable.int8].hotend_temp, e); }); #endif // HAS_MULTI_HOTEND #if HAS_HEATED_BED - ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, []{ _preheat_bed(0); }); + ACTION_ITEM_P(msg_preheat_bed[m], []{ _preheat_bed(editable.int8); }); #endif END_MENU(); } - void menu_preheat_m2() { - START_MENU(); - BACK_ITEM(MSG_TEMPERATURE); - #if HOTENDS == 1 - #if HAS_HEATED_BED - ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_both(1, 0); }); - ACTION_ITEM(MSG_PREHEAT_2_END, []{ _preheat_end(1, 0); }); - #else - ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); }); + void menu_preheat_m1() { menu_preheat_m(0); } + void menu_preheat_m2() { menu_preheat_m(1); } + #if PREHEAT_COUNT >= 3 + void menu_preheat_m3() { menu_preheat_m(2); } + #if PREHEAT_COUNT >= 4 + void menu_preheat_m4() { menu_preheat_m(3); } + #if PREHEAT_COUNT >= 5 + void menu_preheat_m5() { menu_preheat_m(4); } #endif - #elif HAS_MULTI_HOTEND - #if HAS_HEATED_BED - _PREHEAT_ITEMS(2,0); - #endif - LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(2,n); - ACTION_ITEM(MSG_PREHEAT_2_ALL, []() { - TERN_(HAS_HEATED_BED, _preheat_bed(1)); - HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], e); - }); - #endif // HAS_MULTI_HOTEND - #if HAS_HEATED_BED - ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, []{ _preheat_bed(1); }); #endif - END_MENU(); - } + #endif void lcd_cooldown() { thermalManager.zero_fan_speeds(); @@ -269,12 +263,30 @@ void menu_temperature() { // // Preheat for Material 1 and 2 // - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_5 != 0 || TEMP_SENSOR_6 != 0 || TEMP_SENSOR_7 != 0 || HAS_HEATED_BED + #if HOTENDS > 1 || HAS_HEATED_BED SUBMENU(MSG_PREHEAT_1, menu_preheat_m1); SUBMENU(MSG_PREHEAT_2, menu_preheat_m2); + #if PREHEAT_COUNT >= 3 + SUBMENU(MSG_PREHEAT_3, menu_preheat_m3); + #if PREHEAT_COUNT >= 4 + SUBMENU(MSG_PREHEAT_4, menu_preheat_m4); + #if PREHEAT_COUNT >= 5 + SUBMENU(MSG_PREHEAT_5, menu_preheat_m5); + #endif + #endif + #endif #else ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); }); ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); }); + #if PREHEAT_COUNT >= 3 + ACTION_ITEM(MSG_PREHEAT_3, []{ _preheat_end(2, 0); }); + #if PREHEAT_COUNT >= 3 + ACTION_ITEM(MSG_PREHEAT_4, []{ _preheat_end(3, 0); }); + #if PREHEAT_COUNT >= 3 + ACTION_ITEM(MSG_PREHEAT_5, []{ _preheat_end(4, 0); }); + #endif + #endif + #endif #endif // @@ -288,4 +300,4 @@ void menu_temperature() { END_MENU(); } -#endif // HAS_LCD_MENU +#endif // HAS_LCD_MENU && HAS_TEMPERATURE diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index fa0c5d21c4..f17ac5f3b7 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -128,7 +128,9 @@ void _lcd_ubl_build_custom_mesh() { void _lcd_ubl_custom_mesh() { START_MENU(); BACK_ITEM(MSG_UBL_BUILD_MESH_MENU); - EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT); + #if HAS_HOTEND + EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT); + #endif #if HAS_HEATED_BED EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET); #endif @@ -182,39 +184,48 @@ void _lcd_ubl_edit_mesh() { END_MENU(); } -/** - * UBL Validate Custom Mesh Command - */ -void _lcd_ubl_validate_custom_mesh() { - char ubl_lcd_gcode[24]; - const int16_t temp = TERN(HAS_HEATED_BED, custom_bed_temp, 0); - sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26 C B%" PRIi16 " H%" PRIi16 " P"), temp, custom_hotend_temp); - queue.inject(ubl_lcd_gcode); -} +#if ENABLED(G26_MESH_VALIDATION) -/** - * UBL Validate Mesh submenu - * - * << UBL Tools - * Mesh Validation with Material 1 - * Mesh Validation with Material 2 - * Validate Custom Mesh - * << Info Screen - */ -void _lcd_ubl_validate_mesh() { - START_MENU(); - BACK_ITEM(MSG_UBL_TOOLS); - #if HAS_HEATED_BED - GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); - GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); - #else - GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); - GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); - #endif - ACTION_ITEM(MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); - ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); - END_MENU(); -} + /** + * UBL Validate Custom Mesh Command + */ + void _lcd_ubl_validate_custom_mesh() { + char ubl_lcd_gcode[24]; + const int16_t temp = TERN(HAS_HEATED_BED, custom_bed_temp, 0); + sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26 C P H%" PRIi16 TERN_(HAS_HEATED_BED, " B%" PRIi16)) + , custom_hotend_temp + #if HAS_HEATED_BED + , temp + #endif + ); + queue.inject(ubl_lcd_gcode); + } + + /** + * UBL Validate Mesh submenu + * + * << UBL Tools + * Mesh Validation with Material 1 + * Mesh Validation with Material 2 + * Validate Custom Mesh + * << Info Screen + */ + void _lcd_ubl_validate_mesh() { + START_MENU(); + BACK_ITEM(MSG_UBL_TOOLS); + #if HAS_HEATED_BED + GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); + GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); + #else + GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); + GCODES_ITEM(MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); + #endif + ACTION_ITEM(MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); + ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); + END_MENU(); + } + +#endif /** * UBL Grid Leveling submenu @@ -530,36 +541,42 @@ void _menu_ubl_tools() { BACK_ITEM(MSG_UBL_LEVEL_BED); SUBMENU(MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); GCODES_ITEM(MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0")); - SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + #if ENABLED(G26_MESH_VALIDATION) + SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + #endif SUBMENU(MSG_EDIT_MESH, _lcd_ubl_edit_mesh); SUBMENU(MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling); END_MENU(); } -/** - * UBL Step-By-Step submenu - * - * << Unified Bed Leveling - * 1 Build Cold Mesh - * 2 Smart Fill-in - * - 3 Validate Mesh >> - * 4 Fine Tune All - * - 5 Validate Mesh >> - * 6 Fine Tune All - * 7 Save Bed Mesh - */ -void _lcd_ubl_step_by_step() { - START_MENU(); - BACK_ITEM(MSG_UBL_LEVEL_BED); - GCODES_ITEM(MSG_UBL_1_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); - GCODES_ITEM(MSG_UBL_2_SMART_FILLIN, PSTR("G29 P3 T0")); - SUBMENU(MSG_UBL_3_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); - SUBMENU(MSG_UBL_5_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); - ACTION_ITEM(MSG_UBL_7_SAVE_MESH, _lcd_ubl_save_mesh_cmd); - END_MENU(); -} +#if ENABLED(G26_MESH_VALIDATION) + + /** + * UBL Step-By-Step submenu + * + * << Unified Bed Leveling + * 1 Build Cold Mesh + * 2 Smart Fill-in + * - 3 Validate Mesh >> + * 4 Fine Tune All + * - 5 Validate Mesh >> + * 6 Fine Tune All + * 7 Save Bed Mesh + */ + void _lcd_ubl_step_by_step() { + START_MENU(); + BACK_ITEM(MSG_UBL_LEVEL_BED); + GCODES_ITEM(MSG_UBL_1_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); + GCODES_ITEM(MSG_UBL_2_SMART_FILLIN, PSTR("G29 P3 T0")); + SUBMENU(MSG_UBL_3_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + SUBMENU(MSG_UBL_5_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + ACTION_ITEM(MSG_UBL_7_SAVE_MESH, _lcd_ubl_save_mesh_cmd); + END_MENU(); + } + +#endif /** * UBL System submenu @@ -574,7 +591,6 @@ void _lcd_ubl_step_by_step() { * - UBL Tools >> * - Output UBL Info >> */ - void _lcd_ubl_level_bed() { START_MENU(); BACK_ITEM(MSG_MOTION); @@ -582,7 +598,9 @@ void _lcd_ubl_level_bed() { GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); else GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); - SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); + #if ENABLED(G26_MESH_VALIDATION) + SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); + #endif ACTION_ITEM(MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd); SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 98f29804c8..271de72722 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -86,6 +86,10 @@ MarlinUI ui; } #endif +#if EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD) + preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() +#endif + #if HAS_SPI_LCD #if HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 6eaca31c71..4faeea63f6 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -256,6 +256,14 @@ }; #endif +#if PREHEAT_COUNT + typedef struct { + TERN_(HAS_HOTEND, uint16_t hotend_temp); + TERN_(HAS_HEATED_BED, uint16_t bed_temp ); + TERN_(HAS_FAN, uint16_t fan_speed ); + } preheat_t; +#endif + //////////////////////////////////////////// //////////// MarlinUI Singleton //////////// //////////////////////////////////////////// @@ -469,6 +477,10 @@ public: static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); #endif + #if PREHEAT_COUNT + static preheat_t material_preset[PREHEAT_COUNT]; + #endif + #if HAS_LCD_MENU #if ENABLED(TOUCH_BUTTONS) @@ -494,9 +506,6 @@ public: static constexpr int8_t manual_move_e_index = 0; #endif - static int16_t preheat_hotend_temp[2], preheat_bed_temp[2]; - static uint8_t preheat_fan_speed[2]; - // Select Screen (modal NO/YES style dialog) static bool selection; static void set_selection(const bool sel) { selection = sel; } diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 77b807ec4c..e7de76000e 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V80" +#define EEPROM_VERSION "V81" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -281,11 +281,11 @@ typedef struct SettingsDataStruct { #endif // - // ULTIPANEL + // Material Presets // - int16_t ui_preheat_hotend_temp[2], // M145 S0 H - ui_preheat_bed_temp[2]; // M145 S0 B - uint8_t ui_preheat_fan_speed[2]; // M145 S0 F + #if PREHEAT_COUNT + preheat_t ui_material_preset[PREHEAT_COUNT]; // M145 S0 H B F + #endif // // PIDTEMP @@ -811,27 +811,10 @@ void MarlinSettings::postprocess() { // // LCD Preheat settings // - { - _FIELD_TEST(ui_preheat_hotend_temp); - - #if HAS_HOTEND && HAS_LCD_MENU - const int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, - (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; - const uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; - #elif ENABLED(DWIN_CREALITY_LCD) - const int16_t (&ui_preheat_hotend_temp)[2] = HMI_ValueStruct.preheat_hotend_temp, - (&ui_preheat_bed_temp)[2] = HMI_ValueStruct.preheat_bed_temp; - const uint8_t (&ui_preheat_fan_speed)[2] = HMI_ValueStruct.preheat_fan_speed; - #else - constexpr int16_t ui_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND }, - ui_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED }; - constexpr uint8_t ui_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED }; - #endif - - EEPROM_WRITE(ui_preheat_hotend_temp); - EEPROM_WRITE(ui_preheat_bed_temp); - EEPROM_WRITE(ui_preheat_fan_speed); - } + #if PREHEAT_COUNT + _FIELD_TEST(ui_material_preset); + EEPROM_WRITE(ui.material_preset); + #endif // // PIDTEMP @@ -1688,25 +1671,10 @@ void MarlinSettings::postprocess() { // // LCD Preheat settings // - { - _FIELD_TEST(ui_preheat_hotend_temp); - - #if HAS_HOTEND && HAS_LCD_MENU - int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, - (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; - uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; - #elif ENABLED(DWIN_CREALITY_LCD) - int16_t (&ui_preheat_hotend_temp)[2] = HMI_ValueStruct.preheat_hotend_temp, - (&ui_preheat_bed_temp)[2] = HMI_ValueStruct.preheat_bed_temp; - uint8_t (&ui_preheat_fan_speed)[2] = HMI_ValueStruct.preheat_fan_speed; - #else - int16_t ui_preheat_hotend_temp[2], ui_preheat_bed_temp[2]; - uint8_t ui_preheat_fan_speed[2]; - #endif - EEPROM_READ(ui_preheat_hotend_temp); // 2 floats - EEPROM_READ(ui_preheat_bed_temp); // 2 floats - EEPROM_READ(ui_preheat_fan_speed); // 2 floats - } + #if PREHEAT_COUNT + _FIELD_TEST(ui_material_preset); + EEPROM_READ(ui.material_preset); + #endif // // Hotend PID @@ -2587,22 +2555,27 @@ void MarlinSettings::reset() { // // Preheat parameters // - #if HAS_HOTEND - #if ENABLED(DWIN_CREALITY_LCD) - HMI_ValueStruct.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; - HMI_ValueStruct.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; - HMI_ValueStruct.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED; - HMI_ValueStruct.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED; - HMI_ValueStruct.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED; - HMI_ValueStruct.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; - #elif HAS_LCD_MENU - ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; - ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; - ui.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED; - ui.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED; - ui.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED; - ui.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; + #if PREHEAT_COUNT + #if HAS_HOTEND + constexpr uint16_t hpre[] = ARRAY_N(PREHEAT_COUNT, PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND, PREHEAT_3_TEMP_HOTEND, PREHEAT_4_TEMP_HOTEND, PREHEAT_5_TEMP_HOTEND); #endif + #if HAS_HEATED_BED + constexpr uint16_t bpre[] = ARRAY_N(PREHEAT_COUNT, PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED, PREHEAT_3_TEMP_BED, PREHEAT_4_TEMP_BED, PREHEAT_5_TEMP_BED); + #endif + #if HAS_FAN + constexpr uint8_t fpre[] = ARRAY_N(PREHEAT_COUNT, PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED, PREHEAT_3_FAN_SPEED, PREHEAT_4_FAN_SPEED, PREHEAT_5_FAN_SPEED); + #endif + LOOP_L_N(i, PREHEAT_COUNT) { + #if HAS_HOTEND + ui.material_preset[i].hotend_temp = hpre[i]; + #endif + #if HAS_HEATED_BED + ui.material_preset[i].bed_temp = bpre[i]; + #endif + #if HAS_FAN + ui.material_preset[i].fan_speed = fpre[i]; + #endif + } #endif // @@ -3131,16 +3104,22 @@ void MarlinSettings::reset() { #endif // [XYZ]_DUAL_ENDSTOPS - #if HAS_HOTEND && HAS_LCD_MENU + #if PREHEAT_COUNT CONFIG_ECHO_HEADING("Material heatup parameters:"); - LOOP_L_N(i, COUNT(ui.preheat_hotend_temp)) { + LOOP_L_N(i, PREHEAT_COUNT) { CONFIG_ECHO_START(); SERIAL_ECHOLNPAIR( - " M145 S", (int)i - , " H", TEMP_UNIT(ui.preheat_hotend_temp[i]) - , " B", TEMP_UNIT(ui.preheat_bed_temp[i]) - , " F", int(ui.preheat_fan_speed[i]) + " M145 S", (int)i + #if HAS_HOTEND + , " H", TEMP_UNIT(ui.material_preset[i].hotend_temp) + #endif + #if HAS_HEATED_BED + , " B", TEMP_UNIT(ui.material_preset[i].bed_temp) + #endif + #if HAS_FAN + , " F", ui.material_preset[i].fan_speed + #endif ); } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 16e29f7b36..9d55867c5b 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3128,7 +3128,7 @@ void Temperature::tick() { #if ENABLED(DWIN_CREALITY_LCD) HMI_flag.heat_flag = 0; duration_t elapsed = print_job_timer.duration(); // print timer - heat_time = elapsed.value; + dwin_heat_time = elapsed.value; #else ui.reset_status(); #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 0f95d0a726..fca88608b5 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -797,7 +797,7 @@ class Temperature { TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e)); - #if HAS_LCD_MENU + #if HAS_LCD_MENU && HAS_TEMPERATURE static void lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb); #endif