🩹 Fix DWIN Enhanced Tune menu during homing (#22773)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
x301
Miguel Risco-Castillo 3 years ago committed by Scott Lahteine
parent 1386e78369
commit 84d1619127

@ -30,6 +30,9 @@
#include "dwin.h"
//#define USE_STRING_HEADINGS
//#define USE_STRING_TITLES
#if ENABLED(LCD_BED_LEVELING) && DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
#define HAS_ONESTEP_LEVELING 1
#endif
@ -141,6 +144,17 @@ millis_t dwin_heat_time = 0;
uint8_t checkkey = 0;
enum SelectItem : uint8_t {
PAGE_PRINT = 0,
PAGE_PREPARE,
PAGE_CONTROL,
PAGE_INFO_LEVELING,
PRINT_SETUP = 0,
PRINT_PAUSE_RESUME,
PRINT_STOP
};
typedef struct {
uint8_t now, last;
void set(uint8_t v) { now = last = v; }
@ -235,7 +249,7 @@ void ICON_Print() {
{ 1, { 417, 449 }, 30, 14 },
{ 1, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 0, ICON_Print_0, ico, txt);
ICON_Button(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt);
}
//
@ -247,7 +261,7 @@ void ICON_Prepare() {
{ 33, { 417, 449 }, 51, 14 },
{ 31, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 1, ICON_Prepare_0, ico, txt);
ICON_Button(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt);
}
//
@ -259,7 +273,7 @@ void ICON_Control() {
{ 85, { 417, 449 }, 46, 14 },
{ 61, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 2, ICON_Control_0, ico, txt);
ICON_Button(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt);
}
//
@ -271,7 +285,7 @@ void ICON_StartInfo() {
{ 133, { 417, 449 }, 23, 14 },
{ 91, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 3, ICON_Info_0, ico, txt);
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Info_0, ico, txt);
}
//
@ -283,7 +297,7 @@ void ICON_Leveling() {
{ 88, { 433, 464 }, 36, 14 },
{ 211, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 3, ICON_Leveling_0, ico, txt);
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Leveling_0, ico, txt);
}
//
@ -295,7 +309,7 @@ void ICON_Tune() {
{ 0, { 433, 464 }, 32, 14 },
{ 121, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 0, ICON_Setup_0, ico, txt);
ICON_Button(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt);
}
//
@ -307,7 +321,7 @@ void ICON_Pause() {
{ 157, { 417, 449 }, 39, 14 },
{ 181, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 1, ICON_Pause_0, ico, txt);
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt);
}
//
@ -319,7 +333,7 @@ void ICON_Resume() {
{ 33, { 433, 464 }, 53, 14 },
{ 1, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 1, ICON_Continue_0, ico, txt);
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt);
}
void ICON_ResumeOrPause() {
@ -338,7 +352,7 @@ void ICON_Stop() {
{ 196, { 417, 449 }, 29, 14 },
{ 151, { 405, 447 }, 27, 12 }
};
ICON_Button(select_print.now == 2, ICON_Stop_0, ico, txt);
ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt);
}
inline void Clear_Title_Bar() {
@ -467,6 +481,7 @@ inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, T &valref)
//
// Draw Menus
//
#define CASE_BACK 0
#define MOTION_CASE_RATE 1
#define MOTION_CASE_ACCEL 2
@ -759,7 +774,7 @@ void Draw_Prepare_Menu() {
#endif
}
if (PVISI(0)) Draw_Back_First(select_prepare.now == 0); // < Back
if (PVISI(0)) Draw_Back_First(select_prepare.now == CASE_BACK); // < Back
if (PVISI(PREPARE_CASE_MOVE)) Item_Prepare_Move(PSCROL(PREPARE_CASE_MOVE)); // Move >
if (PVISI(PREPARE_CASE_DISA)) Item_Prepare_Disable(PSCROL(PREPARE_CASE_DISA)); // Disable Stepper
if (PVISI(PREPARE_CASE_HOME)) Item_Prepare_Home(PSCROL(PREPARE_CASE_HOME)); // Auto Home
@ -775,7 +790,7 @@ void Draw_Prepare_Menu() {
#endif
if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN
if (select_prepare.now) Draw_Menu_Cursor(PSCROL(select_prepare.now));
if (select_prepare.now != CASE_BACK) Draw_Menu_Cursor(PSCROL(select_prepare.now));
}
//
@ -860,7 +875,7 @@ void Draw_Control_Menu() {
#endif
}
if (CVISI(0)) Draw_Back_First(select_control.now == 0); // < Back
if (CVISI(0)) Draw_Back_First(select_control.now == CASE_BACK); // < Back
if (CVISI(CONTROL_CASE_TEMP)) Item_Control_Temp(CSCROL(CONTROL_CASE_TEMP)); // Temperature >
if (CVISI(CONTROL_CASE_MOVE)) Item_Control_Motion(CSCROL(CONTROL_CASE_MOVE)); // Motion >
@ -897,7 +912,7 @@ void Draw_Control_Menu() {
if (CVISI(CONTROL_CASE_ADVSET)) Item_Control_Advanced(CSCROL(CONTROL_CASE_ADVSET));
if (CVISI(CONTROL_CASE_INFO)) Item_Control_Info(CSCROL(CONTROL_CASE_INFO));
if (select_control.now && CVISI(select_control.now))
if (select_control.now != CASE_BACK && CVISI(select_control.now))
Draw_Menu_Cursor(CSCROL(select_control.now));
// Draw icons and lines
@ -977,8 +992,8 @@ void Draw_Tune_Menu() {
#endif
}
Draw_Back_First(select_tune.now == 0);
if (select_tune.now) Draw_Menu_Cursor(select_tune.now);
Draw_Back_First(select_tune.now == CASE_BACK);
if (select_tune.now != CASE_BACK) Draw_Menu_Cursor(select_tune.now);
Draw_Menu_Line(TUNE_CASE_SPEED, ICON_Speed);
Draw_Edit_Integer3(TUNE_CASE_SPEED, feedrate_percentage);
@ -1042,8 +1057,8 @@ void Draw_Motion_Menu() {
#endif
}
Draw_Back_First(select_motion.now == 0);
if (select_motion.now) Draw_Menu_Cursor(select_motion.now);
Draw_Back_First(select_motion.now == CASE_BACK);
if (select_motion.now != CASE_BACK) Draw_Menu_Cursor(select_motion.now);
uint8_t i = 0;
#define _MOTION_ICON(N) Draw_Menu_Line(++i, ICON_MaxSpeed + (N) - 1)
@ -1179,15 +1194,15 @@ void Popup_window_PauseOrStop() {
Clear_Main_Window();
Draw_Popup_Bkgd_60();
if (HMI_IsChinese()) {
if (select_print.now == 1) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); // Pause
else if (select_print.now == 2) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); // Stop
if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); // Pause
else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); // Stop
DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150); // Print
DWIN_ICON_Show(ICON, ICON_Confirm_C, 26, 280);
DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280);
}
else {
if (select_print.now == 1) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
else if (select_print.now == 2) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
else if (select_print.now == PRINT_STOP) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280);
DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280);
}
@ -1823,7 +1838,7 @@ void MarlinUI::refresh() { /* Nothing to see here */ }
void Init_SDItem_Shift() {
shift_amt = 0;
shift_ms = select_file.now > 0 && strlen(shift_name) > MENU_CHAR_LIMIT
shift_ms = select_file.now != CASE_BACK && strlen(shift_name) > MENU_CHAR_LIMIT
? millis() + 750UL : 0;
}
@ -2068,45 +2083,45 @@ void HMI_MainMenu() {
if (encoder_diffState == ENCODER_DIFF_CW) {
if (select_page.inc(4)) {
switch (select_page.now) {
case 0: ICON_Print(); break;
case 1: ICON_Print(); ICON_Prepare(); break;
case 2: ICON_Prepare(); ICON_Control(); break;
case 3: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_PRINT: ICON_Print(); break;
case PAGE_PREPARE: ICON_Print(); ICON_Prepare(); break;
case PAGE_CONTROL: ICON_Prepare(); ICON_Control(); break;
case PAGE_INFO_LEVELING: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
if (select_page.dec()) {
switch (select_page.now) {
case 0: ICON_Print(); ICON_Prepare(); break;
case 1: ICON_Prepare(); ICON_Control(); break;
case 2: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case 3: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_PRINT: ICON_Print(); ICON_Prepare(); break;
case PAGE_PREPARE: ICON_Prepare(); ICON_Control(); break;
case PAGE_CONTROL: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_INFO_LEVELING: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_page.now) {
case 0: // Print File
case PAGE_PRINT:
checkkey = SelectFile;
Draw_Print_File_Menu();
break;
case 1: // Prepare
case PAGE_PREPARE:
checkkey = Prepare;
select_prepare.reset();
index_prepare = MROWS;
Draw_Prepare_Menu();
break;
case 2: // Control
case PAGE_CONTROL:
checkkey = Control;
select_control.reset();
index_control = MROWS;
Draw_Control_Menu();
break;
case 3: // Leveling or Info
case PAGE_INFO_LEVELING:
#if HAS_ONESTEP_LEVELING
checkkey = Leveling;
HMI_Leveling();
@ -2196,7 +2211,7 @@ void HMI_SelectFile() {
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_file.now == 0) { // Back
if (select_file.now == CASE_BACK) { // Back
select_page.set(0);
Goto_MainMenu();
}
@ -2257,43 +2272,32 @@ void HMI_Printing() {
if (encoder_diffState == ENCODER_DIFF_CW) {
if (select_print.inc(3)) {
switch (select_print.now) {
case 0: ICON_Tune(); break;
case 1:
ICON_Tune();
ICON_ResumeOrPause();
break;
case 2:
ICON_ResumeOrPause();
ICON_Stop();
break;
case PRINT_SETUP: ICON_Tune(); break;
case PRINT_PAUSE_RESUME: ICON_Tune(); ICON_ResumeOrPause(); break;
case PRINT_STOP: ICON_ResumeOrPause(); ICON_Stop(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
if (select_print.dec()) {
switch (select_print.now) {
case 0:
ICON_Tune();
ICON_ResumeOrPause();
break;
case 1:
ICON_ResumeOrPause();
ICON_Stop();
break;
case 2: ICON_Stop(); break;
case PRINT_SETUP: ICON_Tune(); ICON_ResumeOrPause(); break;
case PRINT_PAUSE_RESUME: ICON_ResumeOrPause(); ICON_Stop(); break;
case PRINT_STOP: ICON_Stop(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_print.now) {
case 0: // Tune
case PRINT_SETUP:
checkkey = Tune;
HMI_ValueStruct.show_mode = 0;
select_tune.reset();
index_tune = MROWS;
Draw_Tune_Menu();
break;
case 1: // Pause
case PRINT_PAUSE_RESUME:
if (HMI_flag.pause_flag) {
ICON_Pause();
@ -2317,7 +2321,7 @@ void HMI_Printing() {
}
break;
case 2: // Stop
case PRINT_STOP:
HMI_flag.select_flag = true;
checkkey = Print_window;
Popup_window_PauseOrStop();
@ -2339,14 +2343,14 @@ void HMI_PauseOrStop() {
else if (encoder_diffState == ENCODER_DIFF_CCW)
Draw_Select_Highlight(true);
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_print.now == 1) { // pause window
if (select_print.now == PRINT_PAUSE_RESUME) {
if (HMI_flag.select_flag) {
HMI_flag.pause_action = true;
queue.inject_P(PSTR("M25"));
}
Goto_PrintProcess();
}
else if (select_print.now == 2) { // stop window
else if (select_print.now == PRINT_STOP) {
if (HMI_flag.select_flag) {
checkkey = Back_Main;
wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user
@ -2395,8 +2399,8 @@ void Draw_Move_Menu() {
#endif
}
Draw_Back_First(select_axis.now == 0);
if (select_axis.now) Draw_Menu_Cursor(select_axis.now);
Draw_Back_First(select_axis.now == CASE_BACK);
if (select_axis.now != CASE_BACK) Draw_Menu_Cursor(select_axis.now);
// Draw separators and icons
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MoveX + i);
@ -2506,7 +2510,7 @@ void Draw_AdvancedSettings_Menu() {
#endif
}
if (AVISI(0)) Draw_Back_First(select_advset.now == 0);
if (AVISI(0)) Draw_Back_First(select_advset.now == CASE_BACK);
if (AVISI(ADVSET_CASE_HOMEOFF)) Item_Adv_HomeOffsets(ASCROL(ADVSET_CASE_HOMEOFF)); // Set Home Offsets >
#if HAS_ONESTEP_LEVELING
if (AVISI(ADVSET_CASE_PROBEOFF)) Item_Adv_ProbeOffsets(ASCROL(ADVSET_CASE_PROBEOFF)); // Probe Offsets >
@ -2516,7 +2520,7 @@ void Draw_AdvancedSettings_Menu() {
#if ENABLED(POWER_LOSS_RECOVERY)
if (AVISI(ADVSET_CASE_PWRLOSSR)) Item_Adv_PLR(ASCROL(ADVSET_CASE_PWRLOSSR)); // Power-loss recovery
#endif
if (select_advset.now) Draw_Menu_Cursor(ASCROL(select_advset.now));
if (select_advset.now != CASE_BACK) Draw_Menu_Cursor(ASCROL(select_advset.now));
}
void Item_HomeOffs_X(const uint8_t row) {
@ -2576,18 +2580,18 @@ void Draw_HomeOff_Menu() {
DWIN_Frame_TitleCopy(1, 401, 91, 12); // "Home Offsets"
#endif
}
Draw_Back_First(select_item.now == 0);
Draw_Back_First(select_item.now == CASE_BACK);
Item_HomeOffs_X(1); // "Home Offset X"
Item_HomeOffs_Y(2); // "Home Offset Y"
Item_HomeOffs_Z(3); // "Home Offset Z"
if (select_item.now) Draw_Menu_Cursor(select_item.now);
if (select_item.now != CASE_BACK) Draw_Menu_Cursor(select_item.now);
}
#if HAS_ONESTEP_LEVELING
void Draw_ProbeOff_Menu() {
Clear_Main_Window();
Draw_Back_First(select_item.now == 0);
Draw_Back_First(select_item.now == CASE_BACK);
if (false && HMI_IsChinese()) {
// TODO: Chinese "Probe Offsets"
}
@ -2609,7 +2613,7 @@ void Draw_HomeOff_Menu() {
Draw_Edit_Signed_Float3(1, HMI_ValueStruct.Probe_OffX_scaled);
Draw_Edit_Signed_Float3(2, HMI_ValueStruct.Probe_OffY_scaled);
if (select_item.now) Draw_Menu_Cursor(select_item.now);
if (select_item.now != CASE_BACK) Draw_Menu_Cursor(select_item.now);
}
#endif
@ -2682,11 +2686,11 @@ void HMI_Prepare() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_prepare.now) {
case 0: // Back
case CASE_BACK:
select_page.set(1);
Goto_MainMenu();
break;
case PREPARE_CASE_MOVE: // Axis move
case PREPARE_CASE_MOVE:
checkkey = AxisMove;
select_axis.reset();
Draw_Move_Menu();
@ -2699,9 +2703,9 @@ void HMI_Prepare() {
Draw_Edit_Signed_Float3(4, HMI_ValueStruct.Move_E_scaled);
#endif
break;
case PREPARE_CASE_DISA: // Disable steppers
queue.inject_P(PSTR("M84"));
break;
case PREPARE_CASE_DISA: queue.inject_P(PSTR("M84")); break;
case PREPARE_CASE_HOME: // Homing
checkkey = Last_Prepare;
index_prepare = MROWS;
@ -2709,7 +2713,7 @@ void HMI_Prepare() {
Popup_Window_Home();
break;
#if HAS_ZOFFSET_ITEM
case PREPARE_CASE_ZOFF: // Z-offset
case PREPARE_CASE_ZOFF:
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
checkkey = Homeoffset;
HMI_ValueStruct.show_mode = -4;
@ -2724,24 +2728,24 @@ void HMI_Prepare() {
break;
#endif
#if HAS_PREHEAT
case PREPARE_CASE_PLA: // PLA preheat
case PREPARE_CASE_PLA:
TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0));
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[0].bed_temp));
TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed));
break;
case PREPARE_CASE_ABS: // ABS preheat
case PREPARE_CASE_ABS:
TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0));
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[1].bed_temp));
TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed));
break;
case PREPARE_CASE_COOL: // Cool
case PREPARE_CASE_COOL:
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
#if HAS_HOTEND || HAS_HEATED_BED
thermalManager.disable_all_heaters();
#endif
break;
#endif
case PREPARE_CASE_LANG: // Toggle Language
case PREPARE_CASE_LANG:
HMI_ToggleLanguage();
Draw_Prepare_Menu();
break;
@ -2814,8 +2818,8 @@ void Draw_Temperature_Menu() {
#endif
}
Draw_Back_First(select_temp.now == 0);
if (select_temp.now) Draw_Menu_Cursor(select_temp.now);
Draw_Back_First(select_temp.now == CASE_BACK);
if (select_temp.now != CASE_BACK) Draw_Menu_Cursor(select_temp.now);
// Draw icons and lines
uint8_t i = 0;
@ -2884,41 +2888,41 @@ void HMI_Control() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_control.now) {
case 0: // Back
case CASE_BACK:
select_page.set(2);
Goto_MainMenu();
break;
case CONTROL_CASE_TEMP: // Temperature
case CONTROL_CASE_TEMP:
checkkey = TemperatureID;
HMI_ValueStruct.show_mode = -1;
select_temp.reset();
Draw_Temperature_Menu();
break;
case CONTROL_CASE_MOVE: // Motion
case CONTROL_CASE_MOVE:
checkkey = Motion;
select_motion.reset();
Draw_Motion_Menu();
break;
#if ENABLED(EEPROM_SETTINGS)
case CONTROL_CASE_SAVE: { // Write EEPROM
case CONTROL_CASE_SAVE: {
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;
case CONTROL_CASE_LOAD: { // Read EEPROM
case CONTROL_CASE_LOAD: {
const bool success = settings.load();
HMI_AudioFeedback(success);
} break;
case CONTROL_CASE_RESET: // Reset EEPROM
case CONTROL_CASE_RESET:
settings.reset();
HMI_AudioFeedback();
break;
#endif
case CONTROL_CASE_ADVSET: // Advanced Settings
case CONTROL_CASE_ADVSET:
checkkey = AdvSet;
select_advset.reset();
Draw_AdvancedSettings_Menu();
break;
case CONTROL_CASE_INFO: // Info
case CONTROL_CASE_INFO:
checkkey = Info;
Draw_Info_Menu();
break;
@ -2971,7 +2975,7 @@ void HMI_AxisMove() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_axis.now) {
case 0: // Back
case CASE_BACK:
checkkey = Prepare;
select_prepare.set(1);
index_prepare = MROWS;
@ -2997,8 +3001,7 @@ void HMI_AxisMove() {
break;
#if HAS_HOTEND
case 4: // Extruder
// window tips
#ifdef PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (thermalManager.tooColdToExtrude(0)) {
HMI_flag.ETempTooLow_flag = true;
Popup_Window_ETempTooLow();
@ -3031,14 +3034,14 @@ void HMI_Temperature() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_temp.now) {
case 0: // Back
case CASE_BACK:
checkkey = Control;
select_control.set(1);
index_control = MROWS;
Draw_Control_Menu();
break;
#if HAS_HOTEND
case TEMP_CASE_TEMP: // Nozzle temperature
case TEMP_CASE_TEMP:
checkkey = ETemp;
HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0);
Draw_Edit_Integer3(1, HMI_ValueStruct.E_Temp, true);
@ -3046,7 +3049,7 @@ void HMI_Temperature() {
break;
#endif
#if HAS_HEATED_BED
case TEMP_CASE_BED: // Bed temperature
case TEMP_CASE_BED:
checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed();
Draw_Edit_Integer3(2, HMI_ValueStruct.Bed_Temp, true);
@ -3054,7 +3057,7 @@ void HMI_Temperature() {
break;
#endif
#if HAS_FAN
case TEMP_CASE_FAN: // Fan speed
case TEMP_CASE_FAN:
checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
Draw_Edit_Integer3(3, HMI_ValueStruct.Fan_speed, true);
@ -3062,7 +3065,7 @@ void HMI_Temperature() {
break;
#endif
#if HAS_HOTEND
case TEMP_CASE_PLA: { // PLA preheat setting
case TEMP_CASE_PLA: {
checkkey = PLAPreheat;
select_PLA.reset();
HMI_ValueStruct.show_mode = -2;
@ -3458,30 +3461,30 @@ void HMI_Motion() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_motion.now) {
case 0: // Back
case CASE_BACK:
checkkey = Control;
select_control.set(CONTROL_CASE_MOVE);
index_control = MROWS;
Draw_Control_Menu();
break;
case MOTION_CASE_RATE: // Max speed
case MOTION_CASE_RATE:
checkkey = MaxSpeed;
select_speed.reset();
Draw_Max_Speed_Menu();
break;
case MOTION_CASE_ACCEL: // Max acceleration
case MOTION_CASE_ACCEL:
checkkey = MaxAcceleration;
select_acc.reset();
Draw_Max_Accel_Menu();
break;
#if HAS_CLASSIC_JERK
case MOTION_CASE_JERK: // Max jerk
case MOTION_CASE_JERK:
checkkey = MaxJerk;
select_jerk.reset();
Draw_Max_Jerk_Menu();
break;
#endif
case MOTION_CASE_STEPS: // Steps per mm
case MOTION_CASE_STEPS:
checkkey = Step;
select_step.reset();
Draw_Steps_Menu();
@ -3533,7 +3536,7 @@ void HMI_AdvSet() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_advset.now) {
case 0: // Back
case CASE_BACK:
checkkey = Control;
select_control.set(CONTROL_CASE_ADVSET);
index_control = CONTROL_CASE_ADVSET;
@ -3541,7 +3544,7 @@ void HMI_AdvSet() {
break;
#if HAS_HOME_OFFSET
case ADVSET_CASE_HOMEOFF: // Home Offsets
case ADVSET_CASE_HOMEOFF:
checkkey = HomeOff;
select_item.reset();
HMI_ValueStruct.Home_OffX_scaled = home_offset[X_AXIS] * 10;
@ -3552,7 +3555,7 @@ void HMI_AdvSet() {
#endif
#if HAS_ONESTEP_LEVELING
case ADVSET_CASE_PROBEOFF: // Probe Offsets
case ADVSET_CASE_PROBEOFF:
checkkey = ProbeOff;
select_item.reset();
HMI_ValueStruct.Probe_OffX_scaled = probe.offset.x * 10;
@ -3562,21 +3565,21 @@ void HMI_AdvSet() {
#endif
#if HAS_HOTEND
case ADVSET_CASE_HEPID: // Nozzle PID Autotune
case ADVSET_CASE_HEPID:
thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
thermalManager.PID_autotune(ui.material_preset[0].hotend_temp, H_E0, 10, true);
break;
#endif
#if HAS_HEATED_BED
case ADVSET_CASE_BEDPID: // Bed PID Autotune
case ADVSET_CASE_BEDPID:
thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
thermalManager.PID_autotune(ui.material_preset[0].bed_temp, H_BED, 10, true);
break;
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
case ADVSET_CASE_PWRLOSSR: // Power-loss recovery
case ADVSET_CASE_PWRLOSSR:
recovery.enable(!recovery.enabled);
Draw_Checkbox_Line(ADVSET_CASE_PWRLOSSR + MROWS - index_advset, recovery.enabled);
break;
@ -3603,7 +3606,7 @@ void HMI_AdvSet() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_item.now) {
case 0: // Back
case CASE_BACK:
checkkey = AdvSet;
select_advset.set(ADVSET_CASE_HOMEOFF);
Draw_AdvancedSettings_Menu();
@ -3665,7 +3668,7 @@ void HMI_AdvSet() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_item.now) {
case 0: // Back
case CASE_BACK:
checkkey = AdvSet;
select_advset.set(ADVSET_CASE_PROBEOFF);
Draw_AdvancedSettings_Menu();
@ -3675,7 +3678,7 @@ void HMI_AdvSet() {
Draw_Edit_Signed_Float3(1, HMI_ValueStruct.Probe_OffX_scaled, true);
EncoderRate.enabled = true;
break;
case 2: // Probe Offset X
case 2: // Probe Offset Y
checkkey = ProbeOffY;
Draw_Edit_Signed_Float3(2, HMI_ValueStruct.Probe_OffY_scaled, true);
EncoderRate.enabled = true;
@ -3822,14 +3825,14 @@ void HMI_Tune() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_PLA.now) {
case 0: // Back
case CASE_BACK:
checkkey = TemperatureID;
select_temp.now = TEMP_CASE_PLA;
HMI_ValueStruct.show_mode = -1;
Draw_Temperature_Menu();
break;
#if HAS_HOTEND
case PREHEAT_CASE_TEMP: // Nozzle temperature
case PREHEAT_CASE_TEMP:
checkkey = ETemp;
HMI_ValueStruct.E_Temp = ui.material_preset[0].hotend_temp;
Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[0].hotend_temp, true);
@ -3837,7 +3840,7 @@ void HMI_Tune() {
break;
#endif
#if HAS_HEATED_BED
case PREHEAT_CASE_BED: // Bed temperature
case PREHEAT_CASE_BED:
checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = ui.material_preset[0].bed_temp;
Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[0].bed_temp, true);
@ -3845,7 +3848,7 @@ void HMI_Tune() {
break;
#endif
#if HAS_FAN
case PREHEAT_CASE_FAN: // Fan speed
case PREHEAT_CASE_FAN:
checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = ui.material_preset[0].fan_speed;
Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[0].fan_speed, true);
@ -3853,7 +3856,7 @@ void HMI_Tune() {
break;
#endif
#if ENABLED(EEPROM_SETTINGS)
case 4: { // Save PLA configuration
case PREHEAT_CASE_SAVE: {
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;
@ -3878,14 +3881,14 @@ void HMI_Tune() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_ABS.now) {
case 0: // Back
case CASE_BACK:
checkkey = TemperatureID;
select_temp.now = TEMP_CASE_ABS;
HMI_ValueStruct.show_mode = -1;
Draw_Temperature_Menu();
break;
#if HAS_HOTEND
case PREHEAT_CASE_TEMP: // Set nozzle temperature
case PREHEAT_CASE_TEMP:
checkkey = ETemp;
HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp;
Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true);
@ -3893,7 +3896,7 @@ void HMI_Tune() {
break;
#endif
#if HAS_HEATED_BED
case PREHEAT_CASE_BED: // Set bed temperature
case PREHEAT_CASE_BED:
checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp;
Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true);
@ -3901,7 +3904,7 @@ void HMI_Tune() {
break;
#endif
#if HAS_FAN
case PREHEAT_CASE_FAN: // Set fan speed
case PREHEAT_CASE_FAN:
checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed;
Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true);
@ -3909,7 +3912,7 @@ void HMI_Tune() {
break;
#endif
#if ENABLED(EEPROM_SETTINGS)
case PREHEAT_CASE_SAVE: { // Save ABS configuration
case PREHEAT_CASE_SAVE: {
const bool success = settings.save();
HMI_AudioFeedback(success);
} break;

@ -31,9 +31,6 @@
#include <stdint.h>
//#define USE_STRING_HEADINGS
//#define USE_STRING_TITLES
#define RECEIVED_NO_DATA 0x00
#define RECEIVED_SHAKE_HAND_ACK 0x01

@ -86,9 +86,6 @@
#define PAUSE_HEAT
#define USE_STRING_HEADINGS
#define USE_STRING_TITLES
#define MENU_CHAR_LIMIT 24
// Print speed limit
@ -133,8 +130,20 @@ HMI_data_t HMI_data;
millis_t dwin_heat_time = 0;
uint8_t checkkey = MainMenu;
uint8_t last_checkkey = MainMenu;
uint8_t checkkey = MainMenu, last_checkkey = MainMenu;
enum SelectItem : uint8_t {
PAGE_PRINT = 0,
PAGE_PREPARE,
PAGE_CONTROL,
PAGE_INFO_LEVELING,
PAGE_COUNT,
PRINT_SETUP = 0,
PRINT_PAUSE_RESUME,
PRINT_STOP,
PRINT_COUNT
};
typedef struct {
uint8_t now, last;
@ -266,7 +275,7 @@ void ICON_Print() {
{ 1, { 417, 449 }, 30, 14 },
{ 1, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 0, ICON_Print_0, ico, txt);
ICON_Button(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt);
}
//
@ -278,7 +287,7 @@ void ICON_Prepare() {
{ 33, { 417, 449 }, 51, 14 },
{ 31, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 1, ICON_Prepare_0, ico, txt);
ICON_Button(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt);
}
//
@ -290,7 +299,7 @@ void ICON_Control() {
{ 85, { 417, 449 }, 46, 14 },
{ 61, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 2, ICON_Control_0, ico, txt);
ICON_Button(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt);
}
//
@ -302,7 +311,7 @@ void ICON_StartInfo() {
{ 133, { 417, 449 }, 23, 14 },
{ 91, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 3, ICON_Info_0, ico, txt);
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Info_0, ico, txt);
}
//
@ -314,7 +323,7 @@ void ICON_Leveling() {
{ 88, { 433, 464 }, 36, 14 },
{ 211, { 405, 447 }, 27, 15 }
};
ICON_Button(select_page.now == 3, ICON_Leveling_0, ico, txt);
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Leveling_0, ico, txt);
}
//
@ -326,7 +335,7 @@ void ICON_Tune() {
{ 0, { 433, 464 }, 32, 14 },
{ 121, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 0, ICON_Setup_0, ico, txt);
ICON_Button(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt);
}
//
@ -338,7 +347,7 @@ void ICON_Pause() {
{ 157, { 417, 449 }, 39, 14 },
{ 181, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 1, ICON_Pause_0, ico, txt);
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt);
}
//
@ -350,7 +359,7 @@ void ICON_Resume() {
{ 33, { 433, 464 }, 53, 14 },
{ 1, { 405, 447 }, 27, 15 }
};
ICON_Button(select_print.now == 1, ICON_Continue_0, ico, txt);
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt);
}
//
@ -362,7 +371,7 @@ void ICON_Stop() {
{ 196, { 417, 449 }, 29, 14 },
{ 151, { 405, 447 }, 27, 12 }
};
ICON_Button(select_print.now == 2, ICON_Stop_0, ico, txt);
ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt);
}
void Draw_Menu_Cursor(const uint8_t line) {
@ -537,14 +546,14 @@ void Popup_window_PauseOrStop() {
if (HMI_IsChinese()) {
DWINUI::ClearMenuArea();
Draw_Popup_Bkgd_60();
if (select_print.now == 1) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150);
else if (select_print.now == 2) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150);
if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150);
else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150);
DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150);
DWINUI::Draw_Icon(ICON_Confirm_C, 26, 280);
DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
}
else {
DWIN_Draw_Popup(ICON_BLTouch, "Please confirm",(select_print.now == 1) ? GET_TEXT(MSG_PAUSE_PRINT) : GET_TEXT(MSG_STOP_PRINT));
DWIN_Draw_Popup(ICON_BLTouch, "Please confirm", select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT(MSG_PAUSE_PRINT) : GET_TEXT(MSG_STOP_PRINT));
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
}
@ -589,16 +598,9 @@ void Draw_Print_Labels() {
DWIN_Frame_AreaCopy(1, 65, 72, 128, 86, 176, 173); // Remain
}
else {
#ifdef USE_STRING_TITLES
Title.ShowCaption(GET_TEXT(MSG_PRINTING));
DWINUI::Draw_String( 46, 173, F("Print Time"));
DWINUI::Draw_String(181, 173, F("Remain"));
#else
const uint16_t y = 168;
Title.FrameCopy(42, 0, 47, 14); // "Printing"
DWIN_Frame_AreaCopy(1, 0, 44, 96, 58, 41, y); // Printing Time
DWIN_Frame_AreaCopy(1, 98, 44, 152, 58, 176, y); // Remain
#endif
Title.ShowCaption(GET_TEXT(MSG_PRINTING));
DWINUI::Draw_String( 46, 173, F("Print Time"));
DWINUI::Draw_String(181, 173, F("Remain"));
}
}
@ -678,13 +680,8 @@ void Draw_Main_Menu() {
if (HMI_IsChinese())
Title.FrameCopy(2, 2, 26, 13); // "Home" etc
else {
#ifdef USE_STRING_HEADINGS
Title.ShowCaption(MACHINE_NAME);
#else
Title.FrameCopy(0, 2, 40, 11); // "Home"
#endif
}
else
Title.ShowCaption(MACHINE_NAME);
DWINUI::Draw_Icon(ICON_LOGO, 71, 52); // CREALITY logo
@ -1075,11 +1072,7 @@ void Draw_Info_Menu() {
DWIN_Frame_AreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details"
}
else {
#ifdef USE_STRING_HEADINGS
Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN));
#else
Title.FrameCopy(192, 15, 23, 12); // "Info"
#endif
Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN));
DWIN_Frame_AreaCopy(1, 120, 150, 146, 161, 124, 102); // "Size"
DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175); // "Firmware Version"
@ -1098,13 +1091,8 @@ void Draw_Info_Menu() {
void Draw_Print_File_Menu() {
if (HMI_IsChinese())
Title.FrameCopy(0, 31, 56, 14); // "Print file"
else {
#ifdef USE_STRING_HEADINGS
Title.ShowCaption(GET_TEXT_F(MSG_MEDIA_MENU));
#else
Title.FrameCopy(52, 31, 86, 11); // "Print file"
#endif
}
else
Title.ShowCaption(GET_TEXT_F(MSG_MEDIA_MENU));
Redraw_SD_List();
}
@ -1114,43 +1102,39 @@ void HMI_MainMenu() {
if (encoder_diffState == ENCODER_DIFF_NO) return;
if (encoder_diffState == ENCODER_DIFF_CW) {
if (select_page.inc(4)) {
if (select_page.inc(PAGE_COUNT)) {
switch (select_page.now) {
case 0: ICON_Print(); break;
case 1: ICON_Print(); ICON_Prepare(); break;
case 2: ICON_Prepare(); ICON_Control(); break;
case 3: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_PRINT: ICON_Print(); break;
case PAGE_PREPARE: ICON_Print(); ICON_Prepare(); break;
case PAGE_CONTROL: ICON_Prepare(); ICON_Control(); break;
case PAGE_INFO_LEVELING: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
if (select_page.dec()) {
switch (select_page.now) {
case 0: ICON_Print(); ICON_Prepare(); break;
case 1: ICON_Prepare(); ICON_Control(); break;
case 2: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case 3: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_PRINT: ICON_Print(); ICON_Prepare(); break;
case PAGE_PREPARE: ICON_Prepare(); ICON_Control(); break;
case PAGE_CONTROL: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_INFO_LEVELING: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_page.now) {
case 0: // Print File
case PAGE_PRINT:
checkkey = SelectFile;
Draw_Print_File_Menu();
break;
case 1: // Prepare
Draw_Prepare_Menu();
break;
case PAGE_PREPARE: Draw_Prepare_Menu(); break;
case 2: // Control
Draw_Control_Menu();
break;
case PAGE_CONTROL: Draw_Control_Menu(); break;
case 3: // Leveling or Info
case PAGE_INFO_LEVELING:
#if HAS_ONESTEP_LEVELING
queue.inject_P(PSTR("G28XYO\nG28Z\nG29"));
queue.inject_P(PSTR("G28XYO\nG28Z\nG29")); // TODO: 'G29' should be homing when needed. Does it make sense for every LCD to do this differently?
#else
checkkey = Info;
Draw_Info_Menu();
@ -1238,8 +1222,8 @@ void HMI_SelectFile() {
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_file.now == 0) { // Back
select_page.set(0);
if (select_file.now == 0) {
select_page.set(PAGE_PRINT);
Goto_Main_Menu();
}
else if (hasUpDir && select_file.now == 1) { // CD-Up
@ -1276,7 +1260,8 @@ void HMI_SelectFile() {
DWIN_Print_Started(true);
}
}
HMI_SelectFileExit:
HMI_SelectFileExit:
DWIN_UpdateLCD();
}
@ -1286,44 +1271,30 @@ void HMI_Printing() {
if (encoder_diffState == ENCODER_DIFF_NO) return;
// Avoid flicker by updating only the previous menu
if (encoder_diffState == ENCODER_DIFF_CW) {
if (select_print.inc(3)) {
if (select_print.inc(PRINT_COUNT)) {
switch (select_print.now) {
case 0: ICON_Tune(); break;
case 1:
ICON_Tune();
ICON_ResumeOrPause();
break;
case 2:
ICON_ResumeOrPause();
ICON_Stop();
break;
case PRINT_SETUP: ICON_Tune(); break;
case PRINT_PAUSE_RESUME: ICON_Tune(); ICON_ResumeOrPause(); break;
case PRINT_STOP: ICON_ResumeOrPause(); ICON_Stop(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
if (select_print.dec()) {
switch (select_print.now) {
case 0:
ICON_Tune();
ICON_ResumeOrPause();
break;
case 1:
ICON_ResumeOrPause();
ICON_Stop();
break;
case 2: ICON_Stop(); break;
case PRINT_SETUP: ICON_Tune(); ICON_ResumeOrPause(); break;
case PRINT_PAUSE_RESUME: ICON_ResumeOrPause(); ICON_Stop(); break;
case PRINT_STOP: ICON_Stop(); break;
}
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (select_print.now) {
case 0: // Tune
Draw_Tune_Menu();
break;
case 1: // Pause
case PRINT_SETUP: Draw_Tune_Menu(); break;
case PRINT_PAUSE_RESUME:
if (HMI_flag.pause_flag) {
ICON_Pause();
#ifndef ADVANCED_PAUSE_FEATURE
#if DISABLED(ADVANCED_PAUSE_FEATURE)
char cmd[40];
cmd[0] = '\0';
#if BOTH(HAS_HEATED_BED, PAUSE_HEAT)
@ -1346,7 +1317,7 @@ void HMI_Printing() {
}
break;
case 2: // Stop
case PRINT_STOP:
HMI_flag.select_flag = true;
checkkey = PauseOrStop;
Popup_window_PauseOrStop();
@ -1378,7 +1349,7 @@ void HMI_PauseOrStop() {
else if (encoder_diffState == ENCODER_DIFF_CCW)
Draw_Select_Highlight(true);
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_print.now == 1) { // pause window
if (select_print.now == PRINT_PAUSE_RESUME) {
if (HMI_flag.select_flag) {
HMI_flag.pause_action = true;
ICON_Resume();
@ -1389,7 +1360,7 @@ void HMI_PauseOrStop() {
}
Goto_PrintProcess();
}
else if (select_print.now == 2) { // stop window
else if (select_print.now == PRINT_STOP) {
if (HMI_flag.select_flag) {
checkkey = MainMenu;
if (HMI_flag.home_flag) planner.synchronize(); // Wait for planner moves to finish!
@ -1511,22 +1482,12 @@ void EachMomentUpdate() {
if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) {
HMI_flag.pause_action = false;
#if ENABLED(PAUSE_HEAT)
if (sdprint) {
TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.degTargetHotend(0));
TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.degTargetBed());
}
else {
TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.wholeDegHotend(0));
TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.wholeDegBed());
}
TERN_(HAS_HOTEND, resume_hotend_temp = sdprint ? thermalManager.degTargetHotend(0) : thermalManager.wholeDegHotend(0));
TERN_(HAS_HEATED_BED, resume_bed_temp = sdprint ? thermalManager.degTargetBed() : thermalManager.wholeDegBed());
TERN_(HAS_FAN, resume_fan = thermalManager.fan_speed[0]);
#endif
#if DISABLED(ADVANCED_PAUSE_FEATURE)
thermalManager.disable_all_heaters();
#endif
#if DISABLED(PARK_HEAD_ON_PAUSE)
queue.inject_P(PSTR("G1 F1200 X0 Y0"));
#endif
IF_DISABLED(ADVANCED_PAUSE_FEATURE, thermalManager.disable_all_heaters());
IF_DISABLED(PARK_HEAD_ON_PAUSE, queue.inject_P(PSTR("G1 F1200 X0 Y0")));
}
if (checkkey == PrintProcess) { // print process
@ -1565,7 +1526,7 @@ void EachMomentUpdate() {
else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
dwin_abort_flag = false;
dwin_zoffset = BABY_Z_VAR;
select_page.set(0);
select_page.set(PAGE_PRINT);
Goto_Main_Menu();
}
@ -1615,7 +1576,7 @@ void EachMomentUpdate() {
watchdog_refresh();
}
select_print.set(0);
select_print.set(PRINT_SETUP);
queue.inject_P(PSTR("M1000"));
sdprint = true;
Goto_PrintProcess();
@ -1735,7 +1696,6 @@ void DWIN_PidTuning(pidresult_t result) {
// Update filename on print
void DWIN_Print_Header(const char *text = nullptr) {
static char headertxt[31] = ""; // Print header text
if (text != nullptr) {
@ -1917,6 +1877,7 @@ void DWIN_Redraw_screen() {
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
Draw_Select_Highlight(true);
DWIN_UpdateLCD();
}
// Handle responses such as:
@ -1981,7 +1942,6 @@ void DWIN_LockScreen(const bool flag) {
// LiveUpdate: live update function when the encoder changes
// Apply: update function when the encoder is pressed
void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr) {
last_checkkey = Menu;
checkkey = process;
HMI_value.MinValue = lo;
HMI_value.MaxValue = hi;
@ -2092,13 +2052,9 @@ void Goto_InfoMenu(){
Draw_Info_Menu();
}
void DisableMotors() {
queue.inject_P(PSTR("M84"));
}
void DisableMotors() { queue.inject_P(PSTR("M84")); }
void AutoHome() {
queue.inject_P(G28_STR);
}
void AutoHome() { queue.inject_P(G28_STR); }
void SetHome() {
// Apply workspace offset, making the current position 0,0,0
@ -2116,9 +2072,11 @@ void SetHome() {
if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset);
#endif
}
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
void SetZOffset() { SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset); }
#endif
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
void SetZOffset() {
SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset);
}
#endif
#endif
#if HAS_PREHEAT
@ -2233,9 +2191,7 @@ void SetPID(celsius_t t, heater_id_t h) {
}
#endif
void Goto_LockScreen() {
DWIN_LockScreen(true);
}
void Goto_LockScreen() { DWIN_LockScreen(true); }
#if HAS_HOME_OFFSET
void ApplyHomeOffset() { set_home_offset(HMI_value.axis, HMI_value.Value / MINUNITMULT); }
@ -2327,6 +2283,7 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
void ChangeFilament() {
HMI_SaveProcessID(NothingToDo);
queue.inject_P(PSTR("M600 B2"));
@ -2348,7 +2305,8 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
queue.inject_P(PSTR("M701 Z20"));
}
#endif
#endif
#endif // ADVANCED_PAUSE_FEATURE
void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW); }
@ -2414,6 +2372,7 @@ void LevBedBL() { LevBed(3); }
void LevBedC () { LevBed(4); }
#if ENABLED(MESH_BED_LEVELING)
void ManualMeshStart(){
ui.set_status_P(GET_TEXT(MSG_UBL_BUILD_MESH_MENU));
gcode.process_subcommands_now_P(PSTR("G28 XYO\nG28 Z\nM211 S0\nG29S1"));
@ -2443,7 +2402,8 @@ void LevBedC () { LevBed(4); }
ui.set_status_P(GET_TEXT(MSG_UBL_STORAGE_MESH_MENU));
queue.inject_P(PSTR("M211 S1\nM500"));
}
#endif
#endif // MESH_BED_LEVELING
#if HAS_PREHEAT
#if HAS_HOTEND
@ -2516,6 +2476,7 @@ void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP
SetFloatOnClick(0, 1000, 2, value, ApplyPIDd);
}
#endif
// Menuitem Drawing functions =================================================
void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) {
@ -2721,7 +2682,6 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) {
void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
void onDrawSpeedItem(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 116, 164, 171, 176);
onDrawPIntMenu(menuitem, line);
@ -2748,30 +2708,6 @@ void onDrawSpeedItem(MenuItemClass* menuitem, int8_t line) {
}
#endif
void onDrawSpeed(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 173, 133, 228, 147);
onDrawSubMenu(menuitem, line);
}
void onDrawAcc(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration
}
onDrawSubMenu(menuitem, line);
}
#if HAS_CLASSIC_JERK
void onDrawJerk(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ...
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk
}
onDrawSubMenu(menuitem, line);
}
#endif
void onDrawSteps(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 153, 148, 194, 161);
onDrawSubMenu(menuitem, line);
@ -2786,10 +2722,10 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) {
#if HAS_PREHEAT
#if HAS_HOTEND
void onDrawSetPreheatHotend(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146);
onDrawPIntMenu(menuitem, line);
}
void onDrawSetPreheatHotend(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146);
onDrawPIntMenu(menuitem, line);
}
#endif
#if HAS_HEATED_BED
void onDrawSetPreheatBed(MenuItemClass* menuitem, int8_t line) {
@ -2811,7 +2747,13 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 260, 100);
onDrawSubMenu(menuitem,line);
}
#endif // HAS_HOTEND
#endif // HAS_PREHEAT
void onDrawSpeed(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese())
menuitem->SetFrame(1, 173, 133, 228, 147);
onDrawSubMenu(menuitem, line);
}
void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
@ -2847,9 +2789,17 @@ void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) {
}
#endif
void onDrawAcc(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration
}
onDrawSubMenu(menuitem, line);
}
void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X
}
@ -2858,7 +2808,7 @@ void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) {
void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y
}
@ -2867,7 +2817,7 @@ void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) {
void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z
}
@ -2877,7 +2827,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
#if HAS_HOTEND
void onDrawMaxAccelE(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(line)); // E
}
@ -2886,9 +2836,19 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
#endif
#if HAS_CLASSIC_JERK
void onDrawJerk(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ...
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk
}
onDrawSubMenu(menuitem, line);
}
void onDrawMaxJerkX(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line));
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line));
@ -2898,7 +2858,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
void onDrawMaxJerkY(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line));
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line));
@ -2908,7 +2868,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
void onDrawMaxJerkZ(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line));
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line));
@ -2919,7 +2879,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
#if HAS_HOTEND
void onDrawMaxJerkE(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 173, 133, 200, 147);
menuitem->SetFrame(1, 173, 133, 200, 147);
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line));
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line));
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(line));
@ -2927,11 +2887,12 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
onDrawPFloatMenu(menuitem, line);
}
#endif
#endif // HAS_CLASSIC_JERK
void onDrawStepsX(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 153, 148, 194, 161);
menuitem->SetFrame(1, 153, 148, 194, 161);
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X
}
onDrawPFloatMenu(menuitem, line);
@ -2939,7 +2900,7 @@ void onDrawStepsX(MenuItemClass* menuitem, int8_t line) {
void onDrawStepsY(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 153, 148, 194, 161);
menuitem->SetFrame(1, 153, 148, 194, 161);
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y
}
onDrawPFloatMenu(menuitem, line);
@ -2947,7 +2908,7 @@ void onDrawStepsY(MenuItemClass* menuitem, int8_t line) {
void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 153, 148, 194, 161);
menuitem->SetFrame(1, 153, 148, 194, 161);
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z
}
onDrawPFloatMenu(menuitem, line);
@ -2956,7 +2917,7 @@ void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) {
#if HAS_HOTEND
void onDrawStepsE(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) {
menuitem->SetFrame (1, 153, 148, 194, 161);
menuitem->SetFrame(1, 153, 148, 194, 161);
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(line)); // E
}
onDrawPFloatMenu(menuitem, line);
@ -2986,7 +2947,7 @@ int8_t HMI_GetIntNoDraw(const int32_t lo, const int32_t hi) {
if (encoder_diffState != ENCODER_DIFF_NO) {
if (Apply_Encoder(encoder_diffState, HMI_value.Value)) {
EncoderRate.enabled = false;
checkkey = last_checkkey;
checkkey = Menu;
return 2;
}
LIMIT(HMI_value.Value, lo, hi);
@ -3008,7 +2969,7 @@ int8_t HMI_GetInt(const int32_t lo, const int32_t hi) {
if (Apply_Encoder(encoder_diffState, HMI_value.Value)) {
EncoderRate.enabled = false;
DWINUI::Draw_Int(HMI_data.Text_Color, HMI_data.Background_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, HMI_value.Value);
checkkey = last_checkkey;
checkkey = Menu;
return 2;
}
LIMIT(HMI_value.Value, lo, hi);
@ -3048,7 +3009,7 @@ void HMI_SetPInt() {
} else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate();
}
// Get an scaled float value using the encoder
// Get a scaled float value using the encoder
// dp: decimal places
// lo: scaled low limit
// hi: scaled high limit
@ -3062,7 +3023,7 @@ int8_t HMI_GetFloat(uint8_t dp, int32_t lo, int32_t hi) {
if (Apply_Encoder(encoder_diffState, HMI_value.Value)) {
EncoderRate.enabled = false;
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::Get_font_width(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), HMI_value.Value / POW(10, dp));
checkkey = last_checkkey;
checkkey = Menu;
return 2;
}
LIMIT(HMI_value.Value, lo, hi);
@ -3072,38 +3033,34 @@ int8_t HMI_GetFloat(uint8_t dp, int32_t lo, int32_t hi) {
return 0;
}
// Set an scaled float using the encoder
// Set a scaled float using the encoder
void HMI_SetFloat() {
int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
switch (val) {
case 0: return; break;
case 0: return;
case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break;
case 2: if (HMI_value.Apply != nullptr) HMI_value.Apply(); break;
}
}
// Set an scaled float pointer variable using the encoder
// Set a scaled float pointer variable using the encoder
void HMI_SetPFloat() {
int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
if (!val) return;
else if (val == 2) { // Apply
if (val == 2) { // Apply
*HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp);
if (HMI_value.Apply != nullptr) HMI_value.Apply();
} else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate();
}
else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate();
}
// Menu Creation and Drawing functions ======================================================
void SetMenuTitle(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* text) {
if (HMI_IsChinese() && (cn.w != 0))
CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
else {
#ifdef USE_STRING_HEADINGS
CurrentMenu->MenuTitle.SetCaption(text);
#else
if (en.w != 0) CurrentMenu->MenuTitle.SetFrame(en.x, en.y, en.w, en.h);
#endif
}
if (HMI_IsChinese() && (cn.w != 0))
CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
else
CurrentMenu->MenuTitle.SetCaption(text);
}
void Draw_Prepare_Menu() {
@ -3301,7 +3258,8 @@ void Draw_Move_Menu() {
}
CurrentMenu->Draw();
}
#endif
#endif // HAS_FILAMENT_SENSOR
void Draw_SelectColors_Menu() {
checkkey = Menu;
if (SelectColorMenu == nullptr) SelectColorMenu = new MenuClass();
@ -3441,6 +3399,7 @@ void Draw_Motion_Menu() {
#endif
#if HAS_PREHEAT
void Draw_Preheat_Menu(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* text) {
checkkey = Menu;
if (CurrentMenu != PreheatMenu) {
@ -3485,7 +3444,7 @@ void Draw_Motion_Menu() {
}
#endif
#endif
#endif // HAS_PREHEAT
void Draw_Temperature_Menu() {
checkkey = Menu;
@ -3653,5 +3612,4 @@ void Draw_Steps_Menu() {
}
#endif
#endif // DWIN_CREALITY_LCD_ENHANCED

@ -157,15 +157,9 @@ void Popup_Window_Resume();
void HMI_SDCardInit();
void HMI_SDCardUpdate();
// Main Process
//void Icon_print();
//void Icon_control();
//void Icon_leveling(bool value);
// Other
void Goto_PrintProcess();
void Goto_Main_Menu();
void update_variable();
void Draw_Select_Highlight(const bool sel);
void Draw_Status_Area(const bool with_update); // Status Area
void Draw_Main_Area(); // Redraw main area;
@ -178,19 +172,15 @@ void HMI_ReturnScreen(); // Return to previous screen before popups
void ApplyExtMinT();
void HMI_SetLanguageCache(); // Set the languaje image cache
//void HMI_Leveling(); // Level the page
//void HMI_LevBedCorners(); // Tramming menu
//void HMI_Info(); // Information menu
void HMI_Init();
void HMI_Popup();
void HMI_SaveProcessID(const uint8_t id);
void HMI_AudioFeedback(const bool success=true);
void EachMomentUpdate();
void update_variable();
void DWIN_HandleScreen();
void DWIN_Startup();
void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text);
void DWIN_StatusChanged(const char * const text);
void DWIN_StatusChanged_P(PGM_P const text);

@ -141,15 +141,24 @@ constexpr float default_steps[] = DEFAULT_AXIS_STEPS_PER_UNIT;
constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
#endif
uint8_t active_menu = MainMenu;
uint8_t last_menu = MainMenu;
uint8_t selection = 0;
uint8_t last_selection = 0;
enum SelectItem : uint8_t {
PAGE_PRINT = 0,
PAGE_PREPARE,
PAGE_CONTROL,
PAGE_INFO_LEVELING,
PAGE_COUNT,
PRINT_SETUP = 0,
PRINT_PAUSE_RESUME,
PRINT_STOP,
PRINT_COUNT
};
uint8_t active_menu = MainMenu, last_menu = MainMenu;
uint8_t selection = 0, last_selection = 0;
uint8_t scrollpos = 0;
uint8_t process = Main;
uint8_t last_process = Main;
PopupID popup;
PopupID last_popup;
uint8_t process = Main, last_process = Main;
PopupID popup, last_popup;
void (*funcpointer)() = nullptr;
void *valuepointer = nullptr;
@ -4208,7 +4217,7 @@ void CrealityDWINClass::Confirm_Handler(PopupID popupid) {
void CrealityDWINClass::Main_Menu_Control() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState == ENCODER_DIFF_NO) return;
if (encoder_diffState == ENCODER_DIFF_CW && selection < 3) {
if (encoder_diffState == ENCODER_DIFF_CW && selection < PAGE_COUNT - 1) {
selection++; // Select Down
Main_Menu_Icons();
}
@ -4218,10 +4227,10 @@ void CrealityDWINClass::Main_Menu_Control() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER)
switch (selection) {
case 0: card.mount(); Draw_SD_List(); break;
case 1: Draw_Menu(Prepare); break;
case 2: Draw_Menu(Control); break;
case 3: Draw_Menu(TERN(HAS_MESH, Leveling, InfoMain)); break;
case PAGE_PRINT: card.mount(); Draw_SD_List(); break;
case PAGE_PREPARE: Draw_Menu(Prepare); break;
case PAGE_CONTROL: Draw_Menu(Control); break;
case PAGE_INFO_LEVELING: Draw_Menu(TERN(HAS_MESH, Leveling, InfoMain)); break;
}
DWIN_UpdateLCD();
}
@ -4449,7 +4458,7 @@ void CrealityDWINClass::File_Control() {
void CrealityDWINClass::Print_Screen_Control() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState == ENCODER_DIFF_NO) return;
if (encoder_diffState == ENCODER_DIFF_CW && selection < 2) {
if (encoder_diffState == ENCODER_DIFF_CW && selection < PRINT_COUNT - 1) {
selection++; // Select Down
Print_Screen_Icons();
}
@ -4459,11 +4468,11 @@ void CrealityDWINClass::Print_Screen_Control() {
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
switch (selection) {
case 0:
case PRINT_SETUP:
Draw_Menu(Tune);
Update_Status_Bar(true);
break;
case 1:
case PRINT_PAUSE_RESUME:
if (paused) {
if (sdprint) {
wait_for_user = false;
@ -4493,9 +4502,7 @@ void CrealityDWINClass::Print_Screen_Control() {
else
Popup_Handler(Pause);
break;
case 2:
Popup_Handler(Stop);
break;
case PRINT_STOP: Popup_Handler(Stop); break;
}
}
DWIN_UpdateLCD();

Loading…
Cancel
Save