Fix issues with no hotend / bed / fan (#18395)

This commit is contained in:
Scott Lahteine 2020-06-24 19:44:50 -05:00 committed by GitHub
parent b0aad414ec
commit 4275466f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 732 additions and 585 deletions

View File

@ -541,7 +541,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 120: M120(); break; // M120: Enable endstops case 120: M120(); break; // M120: Enable endstops
case 121: M121(); break; // M121: Disable 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 case 145: M145(); break; // M145: Set material heatup parameters
#endif #endif

View File

@ -608,7 +608,7 @@ private:
static void M191(); static void M191();
#endif #endif
#if HAS_HOTEND && HAS_LCD_MENU #if PREHEAT_COUNT
static void M145(); static void M145();
#endif #endif

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if HAS_HOTEND && HAS_LCD_MENU #if PREHEAT_COUNT
#include "../gcode.h" #include "../gcode.h"
#include "../../lcd/ultralcd.h" #include "../../lcd/ultralcd.h"
@ -37,25 +37,23 @@
*/ */
void GcodeSuite::M145() { void GcodeSuite::M145() {
const uint8_t material = (uint8_t)parser.intval('S'); 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); SERIAL_ERROR_MSG(STR_ERR_MATERIAL_INDEX);
else { else {
int v; preset_t &mat = ui.material_preset[material];
if (parser.seenval('H')) { #if HAS_HOTEND
v = parser.value_int(); if (parser.seenval('H'))
ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT)); mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT));
} #endif
if (parser.seenval('F')) {
v = parser.value_int();
ui.preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255);
}
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
if (parser.seenval('B')) { if (parser.seenval('B'))
v = parser.value_int(); mat.bed_temp = constrain(parser.value_int(), BED_MINTEMP, BED_MAX_TARGET);
ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAX_TARGET); #endif
} #if HAS_FAN
if (parser.seenval('F'))
mat.fan_speed = constrain(parser.value_int(), 0, 255);
#endif #endif
} }
} }
#endif // HOTENDS && HAS_LCD_MENU #endif // PREHEAT_COUNT

View File

@ -1859,6 +1859,10 @@
#define HAS_CONTROLLER_FAN 1 #define HAS_CONTROLLER_FAN 1
#endif #endif
#if BED_OR_CHAMBER || HAS_FAN0
#define BED_OR_CHAMBER_OR_FAN 1
#endif
// Servos // Servos
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0 #if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
#define HAS_SERVO_0 1 #define HAS_SERVO_0 1
@ -2080,6 +2084,16 @@
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING) #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING)
#endif #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 * Up to 3 PWM fans
*/ */

View File

@ -1404,13 +1404,17 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif #endif
#if HAS_MESH #if HAS_MESH && HAS_CLASSIC_JERK
#if HAS_CLASSIC_JERK
static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
#endif #endif
#elif ENABLED(G26_MESH_VALIDATION)
#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." #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."
#endif #endif
#endif
#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_GRAPHICAL_LCD) #if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_GRAPHICAL_LCD)
#error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD." #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD."

View File

@ -860,8 +860,6 @@
#define STATUS_CHAMBER_WIDTH 0 #define STATUS_CHAMBER_WIDTH 0
#endif #endif
#define BED_OR_CHAMBER_OR_FAN (BED_OR_CHAMBER || HAS_FAN0)
// Can also be overridden in Configuration_adv.h // Can also be overridden in Configuration_adv.h
// If you can afford it, try the 3-frame fan animation! // If you can afford it, try the 3-frame fan animation!
// Don't compile in the fan animation with no fan // Don't compile in the fan animation with no fan

View File

@ -87,7 +87,7 @@ HMI_Flag HMI_flag{0};
millis_t Encoder_ms = 0; millis_t Encoder_ms = 0;
millis_t Wait_ms = 0; millis_t Wait_ms = 0;
millis_t heat_time = 0; millis_t dwin_heat_time = 0;
int checkkey = 0, last_checkkey = 0; int checkkey = 0, last_checkkey = 0;
@ -743,6 +743,8 @@ inline void Draw_Popup_Bkgd_60() {
DWIN_Draw_Rectangle(1, Background_window, 14, 60, 271-13, 330); DWIN_Draw_Rectangle(1, Background_window, 14, 60, 271-13, 330);
} }
#if HAS_HOTEND
void Popup_Window_ETempTooLow(void) { void Popup_Window_ETempTooLow(void) {
Clear_Main_Window(); Clear_Main_Window();
Draw_Popup_Bkgd_60(); Draw_Popup_Bkgd_60();
@ -758,6 +760,8 @@ void Popup_Window_ETempTooLow(void) {
} }
} }
#endif
void Popup_Window_Resume(void) { void Popup_Window_Resume(void) {
Clear_Popup_Area(); Clear_Popup_Area();
Draw_Popup_Bkgd_105(); Draw_Popup_Bkgd_105();
@ -1074,6 +1078,8 @@ void HMI_Zoffset(void) {
} }
} }
#if HAS_HOTEND
void HMI_ETemp(void) { void HMI_ETemp(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
@ -1089,14 +1095,14 @@ void HMI_ETemp(void) {
} }
else if (HMI_ValueStruct.show_mode == -2) { else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
HMI_ValueStruct.preheat_hotend_temp[0] = HMI_ValueStruct.E_Temp; ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
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(1), ui.material_preset[0].hotend_temp);
return; return;
} }
else if (HMI_ValueStruct.show_mode == -3) { else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat; checkkey = ABSPreheat;
HMI_ValueStruct.preheat_hotend_temp[1] = HMI_ValueStruct.E_Temp; ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp;
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(1), ui.material_preset[1].hotend_temp);
return; return;
} }
else { // tune else { // tune
@ -1117,6 +1123,10 @@ void HMI_ETemp(void) {
} }
} }
#endif
#if HAS_HEATED_BED
void HMI_BedTemp(void) { void HMI_BedTemp(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
@ -1132,14 +1142,14 @@ void HMI_BedTemp(void) {
} }
else if (HMI_ValueStruct.show_mode == -2) { else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
HMI_ValueStruct.preheat_bed_temp[0] = HMI_ValueStruct.Bed_Temp; ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
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(2), ui.material_preset[0].bed_temp);
return; return;
} }
else if (HMI_ValueStruct.show_mode == -3) { else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat; checkkey = ABSPreheat;
HMI_ValueStruct.preheat_bed_temp[1] = HMI_ValueStruct.Bed_Temp; ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp;
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(2), ui.material_preset[1].bed_temp);
return; return;
} }
else { else {
@ -1160,6 +1170,10 @@ void HMI_BedTemp(void) {
} }
} }
#endif
#if HAS_FAN
void HMI_FanSpeed(void) { void HMI_FanSpeed(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
@ -1175,14 +1189,14 @@ void HMI_FanSpeed(void) {
} }
else if (HMI_ValueStruct.show_mode == -2) { else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
HMI_ValueStruct.preheat_fan_speed[0] = HMI_ValueStruct.Fan_speed; ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
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(3), ui.material_preset[0].fan_speed);
return; return;
} }
else if (HMI_ValueStruct.show_mode == -3) { else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat; checkkey = ABSPreheat;
HMI_ValueStruct.preheat_fan_speed[1] = HMI_ValueStruct.Fan_speed; ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed;
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(3), ui.material_preset[1].fan_speed);
return; return;
} }
else { else {
@ -1203,6 +1217,8 @@ void HMI_FanSpeed(void) {
} }
} }
#endif
void HMI_PrintSpeed(void) { void HMI_PrintSpeed(void) {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
@ -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); 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 == 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 == Z_AXIS) planner.set_max_feedrate(Z_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); 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
return; 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;} 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 == 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 == Z_AXIS) {if (HMI_ValueStruct.Max_Feedspeed > default_max_feedrate[Z_AXIS]*2) HMI_ValueStruct.Max_Feedspeed = default_max_feedrate[Z_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;} 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; if (HMI_ValueStruct.Max_Feedspeed < min_MaxFeedspeed) HMI_ValueStruct.Max_Feedspeed = min_MaxFeedspeed;
//MaxFeedspeed value //MaxFeedspeed value
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed); 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); 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 == 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 == Z_AXIS) planner.set_max_acceleration(Z_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); 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Background_black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
return; 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;} 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 == 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 == Z_AXIS) {if (HMI_ValueStruct.Max_Acceleration > default_max_acceleration[Z_AXIS]*2) HMI_ValueStruct.Max_Acceleration = default_max_acceleration[Z_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;} 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; if (HMI_ValueStruct.Max_Acceleration < min_MaxAcceleration) HMI_ValueStruct.Max_Acceleration = min_MaxAcceleration;
// MaxAcceleration value // MaxAcceleration value
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration); 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 #endif
break; break;
case 5: // PLA preheat case 5: // PLA preheat
thermalManager.setTargetHotend(HMI_ValueStruct.preheat_hotend_temp[0], 0); thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
thermalManager.setTargetBed(HMI_ValueStruct.preheat_bed_temp[0]); thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
thermalManager.set_fan_speed(0, HMI_ValueStruct.preheat_fan_speed[0]); thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed);
break; break;
case 6: // ABS preheat case 6: // ABS preheat
thermalManager.setTargetHotend(HMI_ValueStruct.preheat_hotend_temp[1], 0); thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0);
thermalManager.setTargetBed(HMI_ValueStruct.preheat_bed_temp[1]); thermalManager.setTargetBed(ui.material_preset[1].bed_temp);
thermalManager.set_fan_speed(0, HMI_ValueStruct.preheat_fan_speed[1]); thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed);
break; break;
case 7: // cool case 7: // cool
thermalManager.zero_fan_speeds(); thermalManager.zero_fan_speeds();
@ -2287,6 +2311,7 @@ void HMI_AxisMove(void) {
ENCODER_DiffState encoder_diffState = get_encoder_state(); ENCODER_DiffState encoder_diffState = get_encoder_state();
if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_NO) return;
#if HAS_HOTEND
// popup window resume // popup window resume
if (HMI_flag.ETempTooLow_flag) { if (HMI_flag.ETempTooLow_flag) {
if (encoder_diffState == ENCODER_DIFF_ENTER) { if (encoder_diffState == ENCODER_DIFF_ENTER) {
@ -2301,6 +2326,8 @@ void HMI_AxisMove(void) {
} }
return; return;
} }
#endif
// Avoid flicker by updating only the previous menu // Avoid flicker by updating only the previous menu
if (encoder_diffState == ENCODER_DIFF_CW) { if (encoder_diffState == ENCODER_DIFF_CW) {
if (select_axis.inc(4)) Move_Highlight(1, select_axis.now); if (select_axis.inc(4)) Move_Highlight(1, select_axis.now);
@ -2334,6 +2361,7 @@ void HMI_AxisMove(void) {
DWIN_Draw_FloatValue(true,true,0,font8x16,White,Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); DWIN_Draw_FloatValue(true,true,0,font8x16,White,Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#if HAS_HOTEND
case 4: // Extruder case 4: // Extruder
// window tips // window tips
#ifdef PREVENT_COLD_EXTRUSION #ifdef PREVENT_COLD_EXTRUSION
@ -2349,13 +2377,14 @@ void HMI_AxisMove(void) {
show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
default: #endif
break;
} }
} }
DWIN_UpdateLCD(); DWIN_UpdateLCD();
} }
enum
/* TemperatureID */ /* TemperatureID */
void HMI_Temperature(void) { void HMI_Temperature(void) {
ENCODER_DiffState encoder_diffState = get_encoder_state(); ENCODER_DiffState encoder_diffState = get_encoder_state();
@ -2376,24 +2405,31 @@ void HMI_Temperature(void) {
index_control = MROWS; index_control = MROWS;
Draw_Control_Menu(); Draw_Control_Menu();
break; break;
#if HAS_HOTEND
case 1: // nozzle temperature case 1: // nozzle temperature
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_HEATED_BED
case 2: // bed temperature case 2: // bed temperature
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_FAN
case 3: // fan speed case 3: // fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; 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]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_HOTEND
case 4: // PLA preheat setting case 4: // PLA preheat setting
checkkey = PLAPreheat; checkkey = PLAPreheat;
@ -2438,9 +2474,9 @@ void HMI_Temperature(void) {
Draw_Menu_Line(3, ICON_FanSpeed); Draw_Menu_Line(3, ICON_FanSpeed);
Draw_Menu_Line(4, ICON_WriteEEPROM); 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(1), ui.material_preset[0].hotend_temp);
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(2), ui.material_preset[0].bed_temp);
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(3), ui.material_preset[0].fan_speed);
break; break;
case 5: // ABS preheat setting case 5: // ABS preheat setting
@ -2489,13 +2525,12 @@ void HMI_Temperature(void) {
Draw_Menu_Line(3, ICON_FanSpeed); Draw_Menu_Line(3, ICON_FanSpeed);
Draw_Menu_Line(4, ICON_WriteEEPROM); 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(1), ui.material_preset[1].hotend_temp);
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(2), ui.material_preset[1].bed_temp);
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(3), ui.material_preset[1].fan_speed);
break; break;
default: #endif
break;
} }
} }
DWIN_UpdateLCD(); 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1+MROWS-index_tune), feedrate_percentage);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#if HAS_HOTEND
case 2: // nozzle temp case 2: // nozzle temp
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; 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); 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; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_HEATED_BED
case 3: // bed temp case 3: // bed temp
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; 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); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3+MROWS-index_tune), thermalManager.temp_bed.target);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_FAN
case 4: // fan speed case 4: // fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; 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]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(4+MROWS-index_tune), thermalManager.fan_speed[0]);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
case 5: // z-offset case 5: // z-offset
checkkey = Homeoffset; checkkey = Homeoffset;
HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; HMI_ValueStruct.offset_value = BABY_Z_VAR * 100;
@ -2860,24 +2901,30 @@ void HMI_PLAPreheatSetting(void) {
HMI_ValueStruct.show_mode = -1; HMI_ValueStruct.show_mode = -1;
Draw_Temperature_Menu(); Draw_Temperature_Menu();
break; break;
#if HAS_HOTEND
case 1: // set nozzle temperature case 1: // set nozzle temperature
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = HMI_ValueStruct.preheat_hotend_temp[0]; HMI_ValueStruct.E_Temp = ui.material_preset[0].hotend_temp;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[0]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), ui.material_preset[0].hotend_temp);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_HEATED_BED
case 2: // set bed temperature case 2: // set bed temperature
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = HMI_ValueStruct.preheat_bed_temp[0]; HMI_ValueStruct.Bed_Temp = ui.material_preset[0].bed_temp;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[0]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), ui.material_preset[0].bed_temp);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_FAN
case 3: // set fan speed case 3: // set fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = HMI_ValueStruct.preheat_fan_speed[0]; HMI_ValueStruct.Fan_speed = ui.material_preset[0].fan_speed;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[0]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), ui.material_preset[0].fan_speed);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
case 4: // save PLA configuration case 4: // save PLA configuration
if (settings.save()) { if (settings.save()) {
buzzer.tone(100, 659); buzzer.tone(100, 659);
@ -2885,8 +2932,7 @@ void HMI_PLAPreheatSetting(void) {
} }
else buzzer.tone(20, 440); else buzzer.tone(20, 440);
break; break;
default: default: break;
break;
} }
} }
DWIN_UpdateLCD(); DWIN_UpdateLCD();
@ -2912,24 +2958,30 @@ void HMI_ABSPreheatSetting(void) {
HMI_ValueStruct.show_mode = -1; HMI_ValueStruct.show_mode = -1;
Draw_Temperature_Menu(); Draw_Temperature_Menu();
break; break;
#if HAS_HOTEND
case 1: // set nozzle temperature case 1: // set nozzle temperature
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = HMI_ValueStruct.preheat_hotend_temp[1]; HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.preheat_hotend_temp[1]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(1), ui.material_preset[1].hotend_temp);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_HEATED_BED
case 2: // set bed temperature case 2: // set bed temperature
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = HMI_ValueStruct.preheat_bed_temp[1]; HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.preheat_bed_temp[1]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(2), ui.material_preset[1].bed_temp);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
#if HAS_FAN
case 3: // set fan speed case 3: // set fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = HMI_ValueStruct.preheat_fan_speed[1]; HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed;
DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.preheat_fan_speed[1]); DWIN_Draw_IntValue(true,true,0,font8x16,White,Select_Color, 3, 216, MBASE(3), ui.material_preset[1].fan_speed);
EncoderRate.encoderRateEnabled = 1; EncoderRate.encoderRateEnabled = 1;
break; break;
#endif
case 4: // save PLA configuration case 4: // save PLA configuration
if (settings.save()) { if (settings.save()) {
buzzer.tone(100, 659); buzzer.tone(100, 659);
@ -3257,7 +3309,7 @@ void EachMomentUpdate(void) {
/* remain print time */ /* remain print time */
static millis_t next_remain_time_update = 0; 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 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; next_remain_time_update += 20 * 1000UL;
Draw_Print_ProgressRemain(); Draw_Print_ProgressRemain();
} }
@ -3365,9 +3417,15 @@ void DWIN_HandleScreen(void) {
case Move_Z: HMI_Move_Z(); break; case Move_Z: HMI_Move_Z(); break;
case Extruder: HMI_Move_E(); break; case Extruder: HMI_Move_E(); break;
case Homeoffset: HMI_Zoffset(); break; case Homeoffset: HMI_Zoffset(); break;
#if HAS_HOTEND
case ETemp: HMI_ETemp(); break; case ETemp: HMI_ETemp(); break;
#endif
#if HAS_HEATED_BED
case BedTemp: HMI_BedTemp(); break; case BedTemp: HMI_BedTemp(); break;
#endif
#if HAS_FAN
case FanSpeed: HMI_FanSpeed(); break; case FanSpeed: HMI_FanSpeed(); break;
#endif
case PrintSpeed: HMI_PrintSpeed(); break; case PrintSpeed: HMI_PrintSpeed(); break;
case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break; case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break;
case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break; case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break;

View File

@ -81,8 +81,10 @@ enum processID {
Motion, Motion,
Info, Info,
Tune, Tune,
#if HAS_HOTEND
PLAPreheat, PLAPreheat,
ABSPreheat, ABSPreheat,
#endif
MaxSpeed, MaxSpeed,
MaxSpeed_value, MaxSpeed_value,
MaxAcceleration, MaxAcceleration,
@ -105,9 +107,15 @@ enum processID {
Move_Z, Move_Z,
Extruder, Extruder,
Homeoffset, Homeoffset,
#if HAS_HOTEND
ETemp, ETemp,
#endif
#if HAS_HEATED_BED
BedTemp, BedTemp,
#endif
#if HAS_FAN
FanSpeed, FanSpeed,
#endif
PrintSpeed, PrintSpeed,
/*Window ID*/ /*Window ID*/
@ -251,12 +259,18 @@ extern int checkkey, last_checkkey;
extern float zprobe_zoffset; extern float zprobe_zoffset;
extern char print_filename[16]; extern char print_filename[16];
extern millis_t heat_time; extern millis_t dwin_heat_time;
typedef struct { typedef struct {
#if HAS_HOTEND
int16_t E_Temp = 0; int16_t E_Temp = 0;
#endif
#if HAS_HEATED_BED
int16_t Bed_Temp = 0; int16_t Bed_Temp = 0;
#endif
#if HAS_FAN
int16_t Fan_speed = 0; int16_t Fan_speed = 0;
#endif
int16_t print_speed = 100; int16_t print_speed = 100;
float Max_Feedspeed = 0; float Max_Feedspeed = 0;
float Max_Acceleration = 0; float Max_Acceleration = 0;
@ -265,12 +279,11 @@ typedef struct {
float Move_X_scale = 0; float Move_X_scale = 0;
float Move_Y_scale = 0; float Move_Y_scale = 0;
float Move_Z_scale = 0; float Move_Z_scale = 0;
#if EXTRUDERS
float Move_E_scale = 0; float Move_E_scale = 0;
#endif
float offset_value = 0; float offset_value = 0;
char show_mode = 0; // -1: Temperature control 0: Printing temperature 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];
} HMI_value_t; } HMI_value_t;
typedef struct { typedef struct {
@ -281,9 +294,15 @@ typedef struct {
bool select_flag:1; bool select_flag:1;
bool home_flag:1; bool home_flag:1;
bool heat_flag:1; // 0: heating done 1: during heating bool heat_flag:1; // 0: heating done 1: during heating
#if HAS_HOTEND
bool ETempTooLow_flag:1; bool ETempTooLow_flag:1;
#endif
#if HAS_LEVELING
bool leveling_offset_flag:1; bool leveling_offset_flag:1;
#endif
#if HAS_FAN
char feedspeed_flag; char feedspeed_flag;
#endif
char acc_flag; char acc_flag;
char corner_flag; char corner_flag;
char step_flag; char step_flag;
@ -310,8 +329,11 @@ void ICON_Continue(bool show);
void ICON_Stop(bool show); void ICON_Stop(bool show);
/* Popup window tips */ /* Popup window tips */
#if HAS_HOTEND
void Popup_Window_Temperature(const bool toohigh); void Popup_Window_Temperature(const bool toohigh);
void Popup_Window_ETempTooLow(void); void Popup_Window_ETempTooLow(void);
#endif
void Popup_Window_Resume(void); void Popup_Window_Resume(void);
void Popup_Window_Home(void); void Popup_Window_Home(void);
void Popup_Window_Leveling(void); void Popup_Window_Leveling(void);
@ -326,9 +348,16 @@ void HMI_Move_Z(void);
void HMI_Move_E(void); void HMI_Move_E(void);
void HMI_Zoffset(void); void HMI_Zoffset(void);
#if HAS_HOTEND
void HMI_ETemp(void); void HMI_ETemp(void);
#endif
#if HAS_HEATED_BED
void HMI_BedTemp(void); void HMI_BedTemp(void);
#endif
#if HAS_FAN
void HMI_FanSpeed(void); void HMI_FanSpeed(void);
#endif
void HMI_PrintSpeed(void); void HMI_PrintSpeed(void);
void HMI_MaxFeedspeedXYZE(void); void HMI_MaxFeedspeedXYZE(void);
@ -363,8 +392,12 @@ void HMI_Temperature(void); // 温度菜单
void HMI_Motion(void); // 运动菜单 void HMI_Motion(void); // 运动菜单
void HMI_Info(void); // 信息菜单 void HMI_Info(void); // 信息菜单
void HMI_Tune(void); // 调整菜单 void HMI_Tune(void); // 调整菜单
#if HAS_HOTEND
void HMI_PLAPreheatSetting(void); // PLA预热设置 void HMI_PLAPreheatSetting(void); // PLA预热设置
void HMI_ABSPreheatSetting(void); // ABS预热设置 void HMI_ABSPreheatSetting(void); // ABS预热设置
#endif
void HMI_MaxSpeed(void); // 最大速度子菜单 void HMI_MaxSpeed(void); // 最大速度子菜单
void HMI_MaxAcceleration(void); // 最大加速度子菜单 void HMI_MaxAcceleration(void); // 最大加速度子菜单
void HMI_MaxCorner(void); // 最大拐角速度子菜单 void HMI_MaxCorner(void); // 最大拐角速度子菜单

View File

@ -298,7 +298,7 @@ void menu_advanced_settings();
#endif #endif
#if DISABLED(SLIM_LCD_MENUS) #if PREHEAT_COUNT && DISABLED(SLIM_LCD_MENUS)
void _menu_configuration_preheat_settings(const uint8_t material) { void _menu_configuration_preheat_settings(const uint8_t material) {
#define _MINTEMP_ITEM(N) HEATER_##N##_MINTEMP, #define _MINTEMP_ITEM(N) HEATER_##N##_MINTEMP,
@ -307,12 +307,12 @@ void menu_advanced_settings();
#define MAXTEMP_ALL _MAX(REPEAT(HOTENDS, _MAXTEMP_ITEM) 0) #define MAXTEMP_ALL _MAX(REPEAT(HOTENDS, _MAXTEMP_ITEM) 0)
START_MENU(); START_MENU();
BACK_ITEM(MSG_CONFIGURATION); 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 #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 #endif
#if HAS_HEATED_BED #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 #endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ACTION_ITEM(MSG_STORE_EEPROM, ui.store_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_material1_settings() { _menu_configuration_preheat_settings(0); }
void menu_preheat_material2_settings() { _menu_configuration_preheat_settings(1); } 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 #endif
@ -400,10 +409,19 @@ void menu_configuration() {
EDIT_ITEM(bool, MSG_OUTAGE_RECOVERY, &recovery.enabled, recovery.changed); EDIT_ITEM(bool, MSG_OUTAGE_RECOVERY, &recovery.enabled, recovery.changed);
#endif #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_1_SETTINGS, menu_preheat_material1_settings);
SUBMENU(MSG_PREHEAT_2_SETTINGS, menu_preheat_material2_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 #endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)

View File

@ -81,8 +81,8 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
START_MENU(); START_MENU();
if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT); if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT);
BACK_ITEM(MSG_BACK); BACK_ITEM(MSG_BACK);
ACTION_ITEM(MSG_PREHEAT_1, []{ _change_filament(ui.preheat_hotend_temp[0]); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _change_filament(ui.material_preset[0].hotend_temp); });
ACTION_ITEM(MSG_PREHEAT_2, []{ _change_filament(ui.preheat_hotend_temp[1]); }); 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, []{ 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); _change_filament(thermalManager.temp_hotend[_change_filament_extruder].target);
}); });

View File

@ -243,7 +243,7 @@ void menu_info_board() {
STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter
STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com
VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
#if HAS_BED_LEVELING #if HAS_LEVELING
STATIC_ITEM( STATIC_ITEM(
TERN_(AUTO_BED_LEVELING_3POINT, MSG_3POINT_LEVELING) // 3-Point Leveling TERN_(AUTO_BED_LEVELING_3POINT, MSG_3POINT_LEVELING) // 3-Point Leveling
TERN_(AUTO_BED_LEVELING_LINEAR, MSG_LINEAR_LEVELING) // Linear Leveling TERN_(AUTO_BED_LEVELING_LINEAR, MSG_LINEAR_LEVELING) // Linear Leveling

View File

@ -157,7 +157,9 @@ void menu_main() {
SUBMENU(MSG_CUTTER(MENU), menu_spindle_laser); SUBMENU(MSG_CUTTER(MENU), menu_spindle_laser);
#endif #endif
#if HAS_TEMPERATURE
SUBMENU(MSG_TEMPERATURE, menu_temperature); SUBMENU(MSG_TEMPERATURE, menu_temperature);
#endif
#if HAS_POWER_MONITOR #if HAS_POWER_MONITOR
MENU_ITEM(submenu, MSG_POWER_MONITOR, menu_power_monitor); MENU_ITEM(submenu, MSG_POWER_MONITOR, menu_power_monitor);

View File

@ -24,9 +24,9 @@
// Temperature Menu // Temperature Menu
// //
#include "../../inc/MarlinConfigPre.h" #include "../../inc/MarlinConfig.h"
#if HAS_LCD_MENU #if HAS_LCD_MENU && HAS_TEMPERATURE
#include "menu.h" #include "menu.h"
#include "../../module/temperature.h" #include "../../module/temperature.h"
@ -39,23 +39,19 @@
#include "../../module/tool_change.h" #include "../../module/tool_change.h"
#endif #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 // "Temperature" submenu items
// //
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) { void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
#if HAS_HOTEND #if HAS_HOTEND
if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0) if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.preheat_hotend_temp[indh]), e); setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e);
#else #else
UNUSED(e); UNUSED(indh); UNUSED(e); UNUSED(indh);
#endif #endif
#if HAS_HEATED_BED #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 #else
UNUSED(indb); UNUSED(indb);
#endif #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 #if FAN_COUNT > 1
active_extruder < FAN_COUNT ? active_extruder : active_extruder < FAN_COUNT ? active_extruder :
#endif #endif
0), ui.preheat_fan_speed[indh] 0), ui.material_preset[indh].fan_speed
); );
#endif #endif
ui.return_to_status(); 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 #if HAS_TEMP_HOTEND || HAS_HEATED_BED
#define _PREHEAT_ITEMS(M,N) do{ \ #if HAS_TEMP_HOTEND && HAS_HEATED_BED
ACTION_ITEM_N(N, MSG_PREHEAT_##M##_H, []{ _preheat_both(M-1, MenuItemBase::itemIndex); }); \ #define _PREHEAT_ITEMS(M,E) do{ \
ACTION_ITEM_N(N, MSG_PREHEAT_##M##_END_E, []{ _preheat_end(M-1, MenuItemBase::itemIndex); }); \ 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) }while(0)
#if HAS_HEATED_BED #if HAS_HEATED_BED
#define PREHEAT_ITEMS(M,N) _PREHEAT_ITEMS(M,N) #define PREHEAT_ITEMS(M,E) _PREHEAT_ITEMS(M,E)
#endif
#else #else
#define PREHEAT_ITEMS(M,N) \ #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N(E, msg_preheat_h[M], []{ _preheat_end(M, MenuItemBase::itemIndex); })
ACTION_ITEM_N(N, MSG_PREHEAT_##M##_H, []{ _preheat_end(M-1, MenuItemBase::itemIndex); })
#endif #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(); START_MENU();
BACK_ITEM(MSG_TEMPERATURE); BACK_ITEM(MSG_TEMPERATURE);
#if HOTENDS == 1 #if HOTENDS == 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_both(0, 0); }); ACTION_ITEM_P(msg_preheat[m], []{ _preheat_both(editable.int8, 0); });
ACTION_ITEM(MSG_PREHEAT_1_END, []{ _preheat_end(0, 0); }); ACTION_ITEM_P(msg_preheat_end[m], []{ _preheat_end(editable.int8, 0); });
#else #else
ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); }); ACTION_ITEM_P(msg_preheat[m], []{ _preheat_end(editable.int8, 0); });
#endif #endif
#elif HAS_MULTI_HOTEND #elif HAS_MULTI_HOTEND
#if HAS_HEATED_BED #if HAS_HEATED_BED
_PREHEAT_ITEMS(1,0); _PREHEAT_ITEMS(editable.int8,0);
#endif #endif
LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(1,n); LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(editable.int8,n);
ACTION_ITEM(MSG_PREHEAT_1_ALL, []() { ACTION_ITEM_P(msg_preheat_all[m], []() {
TERN_(HAS_HEATED_BED, _preheat_bed(0)); TERN_(HAS_HEATED_BED, _preheat_bed(editable.int8));
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e); HOTEND_LOOP() thermalManager.setTargetHotend(ui.material_preset[editable.int8].hotend_temp, e);
}); });
#endif // HAS_MULTI_HOTEND #endif // HAS_MULTI_HOTEND
#if HAS_HEATED_BED #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 #endif
END_MENU(); END_MENU();
} }
void menu_preheat_m2() { void menu_preheat_m1() { menu_preheat_m(0); }
START_MENU(); void menu_preheat_m2() { menu_preheat_m(1); }
BACK_ITEM(MSG_TEMPERATURE); #if PREHEAT_COUNT >= 3
#if HOTENDS == 1 void menu_preheat_m3() { menu_preheat_m(2); }
#if HAS_HEATED_BED #if PREHEAT_COUNT >= 4
ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_both(1, 0); }); void menu_preheat_m4() { menu_preheat_m(3); }
ACTION_ITEM(MSG_PREHEAT_2_END, []{ _preheat_end(1, 0); }); #if PREHEAT_COUNT >= 5
#else void menu_preheat_m5() { menu_preheat_m(4); }
ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); });
#endif #endif
#elif HAS_MULTI_HOTEND
#if HAS_HEATED_BED
_PREHEAT_ITEMS(2,0);
#endif #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 #endif
END_MENU();
}
void lcd_cooldown() { void lcd_cooldown() {
thermalManager.zero_fan_speeds(); thermalManager.zero_fan_speeds();
@ -269,12 +263,30 @@ void menu_temperature() {
// //
// Preheat for Material 1 and 2 // 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_1, menu_preheat_m1);
SUBMENU(MSG_PREHEAT_2, menu_preheat_m2); 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 #else
ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); });
ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 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 #endif
// //
@ -288,4 +300,4 @@ void menu_temperature() {
END_MENU(); END_MENU();
} }
#endif // HAS_LCD_MENU #endif // HAS_LCD_MENU && HAS_TEMPERATURE

View File

@ -128,7 +128,9 @@ void _lcd_ubl_build_custom_mesh() {
void _lcd_ubl_custom_mesh() { void _lcd_ubl_custom_mesh() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_UBL_BUILD_MESH_MENU); BACK_ITEM(MSG_UBL_BUILD_MESH_MENU);
#if HAS_HOTEND
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT); EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET); EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET);
#endif #endif
@ -182,13 +184,20 @@ void _lcd_ubl_edit_mesh() {
END_MENU(); END_MENU();
} }
#if ENABLED(G26_MESH_VALIDATION)
/** /**
* UBL Validate Custom Mesh Command * UBL Validate Custom Mesh Command
*/ */
void _lcd_ubl_validate_custom_mesh() { void _lcd_ubl_validate_custom_mesh() {
char ubl_lcd_gcode[24]; char ubl_lcd_gcode[24];
const int16_t temp = TERN(HAS_HEATED_BED, custom_bed_temp, 0); 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); 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); queue.inject(ubl_lcd_gcode);
} }
@ -216,6 +225,8 @@ void _lcd_ubl_validate_mesh() {
END_MENU(); END_MENU();
} }
#endif
/** /**
* UBL Grid Leveling submenu * UBL Grid Leveling submenu
* *
@ -530,12 +541,16 @@ void _menu_ubl_tools() {
BACK_ITEM(MSG_UBL_LEVEL_BED); BACK_ITEM(MSG_UBL_LEVEL_BED);
SUBMENU(MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); SUBMENU(MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh);
GCODES_ITEM(MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0")); GCODES_ITEM(MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0"));
#if ENABLED(G26_MESH_VALIDATION)
SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
#endif
SUBMENU(MSG_EDIT_MESH, _lcd_ubl_edit_mesh); SUBMENU(MSG_EDIT_MESH, _lcd_ubl_edit_mesh);
SUBMENU(MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling); SUBMENU(MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling);
END_MENU(); END_MENU();
} }
#if ENABLED(G26_MESH_VALIDATION)
/** /**
* UBL Step-By-Step submenu * UBL Step-By-Step submenu
* *
@ -561,6 +576,8 @@ void _lcd_ubl_step_by_step() {
END_MENU(); END_MENU();
} }
#endif
/** /**
* UBL System submenu * UBL System submenu
* *
@ -574,7 +591,6 @@ void _lcd_ubl_step_by_step() {
* - UBL Tools >> * - UBL Tools >>
* - Output UBL Info >> * - Output UBL Info >>
*/ */
void _lcd_ubl_level_bed() { void _lcd_ubl_level_bed() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MOTION); BACK_ITEM(MSG_MOTION);
@ -582,7 +598,9 @@ void _lcd_ubl_level_bed() {
GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
else else
GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
#if ENABLED(G26_MESH_VALIDATION)
SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); 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); 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_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);

View File

@ -86,6 +86,10 @@ MarlinUI ui;
} }
#endif #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_SPI_LCD
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD

View File

@ -256,6 +256,14 @@
}; };
#endif #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 //////////// //////////// MarlinUI Singleton ////////////
//////////////////////////////////////////// ////////////////////////////////////////////
@ -469,6 +477,10 @@ public:
static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll);
#endif #endif
#if PREHEAT_COUNT
static preheat_t material_preset[PREHEAT_COUNT];
#endif
#if HAS_LCD_MENU #if HAS_LCD_MENU
#if ENABLED(TOUCH_BUTTONS) #if ENABLED(TOUCH_BUTTONS)
@ -494,9 +506,6 @@ public:
static constexpr int8_t manual_move_e_index = 0; static constexpr int8_t manual_move_e_index = 0;
#endif #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) // Select Screen (modal NO/YES style dialog)
static bool selection; static bool selection;
static void set_selection(const bool sel) { selection = sel; } static void set_selection(const bool sel) { selection = sel; }

View File

@ -37,7 +37,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V80" #define EEPROM_VERSION "V81"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -281,11 +281,11 @@ typedef struct SettingsDataStruct {
#endif #endif
// //
// ULTIPANEL // Material Presets
// //
int16_t ui_preheat_hotend_temp[2], // M145 S0 H #if PREHEAT_COUNT
ui_preheat_bed_temp[2]; // M145 S0 B preheat_t ui_material_preset[PREHEAT_COUNT]; // M145 S0 H B F
uint8_t ui_preheat_fan_speed[2]; // M145 S0 F #endif
// //
// PIDTEMP // PIDTEMP
@ -811,28 +811,11 @@ void MarlinSettings::postprocess() {
// //
// LCD Preheat settings // LCD Preheat settings
// //
{ #if PREHEAT_COUNT
_FIELD_TEST(ui_preheat_hotend_temp); _FIELD_TEST(ui_material_preset);
EEPROM_WRITE(ui.material_preset);
#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 #endif
EEPROM_WRITE(ui_preheat_hotend_temp);
EEPROM_WRITE(ui_preheat_bed_temp);
EEPROM_WRITE(ui_preheat_fan_speed);
}
// //
// PIDTEMP // PIDTEMP
// //
@ -1688,25 +1671,10 @@ void MarlinSettings::postprocess() {
// //
// LCD Preheat settings // LCD Preheat settings
// //
{ #if PREHEAT_COUNT
_FIELD_TEST(ui_preheat_hotend_temp); _FIELD_TEST(ui_material_preset);
EEPROM_READ(ui.material_preset);
#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 #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
}
// //
// Hotend PID // Hotend PID
@ -2587,22 +2555,27 @@ void MarlinSettings::reset() {
// //
// Preheat parameters // Preheat parameters
// //
#if PREHEAT_COUNT
#if HAS_HOTEND #if HAS_HOTEND
#if ENABLED(DWIN_CREALITY_LCD) 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);
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;
#endif #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 #endif
// //
@ -3131,16 +3104,22 @@ void MarlinSettings::reset() {
#endif // [XYZ]_DUAL_ENDSTOPS #endif // [XYZ]_DUAL_ENDSTOPS
#if HAS_HOTEND && HAS_LCD_MENU #if PREHEAT_COUNT
CONFIG_ECHO_HEADING("Material heatup parameters:"); CONFIG_ECHO_HEADING("Material heatup parameters:");
LOOP_L_N(i, COUNT(ui.preheat_hotend_temp)) { LOOP_L_N(i, PREHEAT_COUNT) {
CONFIG_ECHO_START(); CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR( SERIAL_ECHOLNPAIR(
" M145 S", (int)i " M145 S", (int)i
, " H", TEMP_UNIT(ui.preheat_hotend_temp[i]) #if HAS_HOTEND
, " B", TEMP_UNIT(ui.preheat_bed_temp[i]) , " H", TEMP_UNIT(ui.material_preset[i].hotend_temp)
, " F", int(ui.preheat_fan_speed[i]) #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
); );
} }

View File

@ -3128,7 +3128,7 @@ void Temperature::tick() {
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
HMI_flag.heat_flag = 0; HMI_flag.heat_flag = 0;
duration_t elapsed = print_job_timer.duration(); // print timer duration_t elapsed = print_job_timer.duration(); // print timer
heat_time = elapsed.value; dwin_heat_time = elapsed.value;
#else #else
ui.reset_status(); ui.reset_status();
#endif #endif

View File

@ -797,7 +797,7 @@ class Temperature {
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e)); 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); static void lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb);
#endif #endif