diff --git a/Marlin/src/lcd/dwin/dwin.cpp b/Marlin/src/lcd/dwin/dwin.cpp index e83669abba..bdbac0bb4d 100644 --- a/Marlin/src/lcd/dwin/dwin.cpp +++ b/Marlin/src/lcd/dwin/dwin.cpp @@ -65,6 +65,8 @@ #include "../../module/probe.h" #endif +#include "../../libs/buzzer.h" + #ifndef MACHINE_SIZE #define MACHINE_SIZE "220x220x250" #endif @@ -190,23 +192,23 @@ float last_zoffset = 0, last_probe_zoffset = 0; #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 -void HMI_SetLanguage(void) { - BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); - if (HMI_flag.language_chinese) +void lcd_select_language(void) { + BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_flag, sizeof(HMI_flag.language_flag)); + if (HMI_flag.language_flag) DWIN_JPG_CacheTo1(Language_Chinese); else DWIN_JPG_CacheTo1(Language_English); } -void HMI_SetAndSaveLanguageWestern(void) { - HMI_flag.language_chinese = false; +void set_english_to_eeprom(void) { + HMI_flag.language_flag = 0; DWIN_JPG_CacheTo1(Language_English); - BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); + BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_flag, sizeof(HMI_flag.language_flag)); } -void HMI_SetAndSaveLanguageChinese(void) { - HMI_flag.language_chinese = true; +void set_chinese_to_eeprom(void) { + HMI_flag.language_flag = 1; DWIN_JPG_CacheTo1(Language_Chinese); - BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); + BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_flag, sizeof(HMI_flag.language_flag)); } void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) { @@ -229,14 +231,14 @@ void ICON_Print() { if (select_page.now == 0) { DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 1, 447, 271 - 243, 479 - 19, 58, 201); else DWIN_Frame_AreaCopy(1, 1, 451, 271 - 240, 479 - 16, 72 - 15, 201); } else { DWIN_ICON_Show(ICON, ICON_Print_0, 17, 130); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 1, 405, 271 - 243, 420, 58, 201); else DWIN_Frame_AreaCopy(1, 1, 423, 271 - 240, 423 + 12, 72 - 15, 201); @@ -252,14 +254,14 @@ void ICON_Prepare() { if (select_page.now == 1) { DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 31, 447, 271 - 213, 479 - 19, 186, 201); else DWIN_Frame_AreaCopy(1, 33, 451, 271 - 189, 479 - 13, 200 - 25, 201); } else { DWIN_ICON_Show(ICON, ICON_Prepare_0, 145, 130); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 31, 405, 271 - 213, 420, 186, 201); else DWIN_Frame_AreaCopy(1, 33, 423, 271 - 189, 423 + 15, 200 - 25, 201); @@ -269,14 +271,14 @@ void ICON_Prepare() { void ICON_Control() { if (select_page.now == 2) { DWIN_ICON_Show(ICON, ICON_Control_1, 17, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 61, 447, 271 - 183, 479 - 19, 58, 318); else DWIN_Frame_AreaCopy(1, 85, 451, 271 - 139, 479 - 16, 72 - 24, 318); } else { DWIN_ICON_Show(ICON, ICON_Control_0, 17, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 61, 405, 271 - 183, 420, 58, 318); else DWIN_Frame_AreaCopy(1, 85, 423, 271 - 139, 479 - 45, 72 - 24, 318); @@ -286,14 +288,14 @@ void ICON_Control() { void ICON_StartInfo(bool show) { if (show) { DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 91, 447, 271 - 153, 479 - 19, 186, 318); else DWIN_Frame_AreaCopy(1, 132, 451, 159, 479 - 13, 186, 318); } else { DWIN_ICON_Show(ICON, ICON_Info_0, 145, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 91, 405, 271 - 153, 420, 186, 318); else DWIN_Frame_AreaCopy(1, 132, 423, 159, 423 + 12, 186, 318); @@ -303,14 +305,14 @@ void ICON_StartInfo(bool show) { void ICON_Leveling(bool show) { if (show) { DWIN_ICON_Show(ICON, ICON_Leveling_1, 145, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 211, 447, 238, 479 - 19, 186, 318); else DWIN_Frame_AreaCopy(1, 84, 437, 120, 449, 200 - 18, 318); } else { DWIN_ICON_Show(ICON, ICON_Leveling_0, 145, 246); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 211, 405, 238, 420, 186, 318); else DWIN_Frame_AreaCopy(1, 84, 465, 120, 478, 200 - 18, 318); @@ -320,14 +322,14 @@ void ICON_Leveling(bool show) { void ICON_Tune() { if (select_print.now == 0) { DWIN_ICON_Show(ICON, ICON_Setup_1, 8, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 121, 447, 271 - 123, 479 - 21, 34, 325); else DWIN_Frame_AreaCopy(1, 1, 465, 271 - 237, 479 - 2, 48 - 17, 325); } else { DWIN_ICON_Show(ICON, ICON_Setup_0, 8, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 121, 405, 271 - 123, 420, 34, 325); else DWIN_Frame_AreaCopy(1, 1, 438, 271 - 239, 479 - 31, 48 - 17, 325); @@ -337,14 +339,14 @@ void ICON_Tune() { void ICON_Pause() { if (select_print.now == 1) { DWIN_ICON_Show(ICON, ICON_Pause_1, 96, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 181, 447, 271 - 63, 479 - 20, 124, 325); else DWIN_Frame_AreaCopy(1, 177, 451, 271 - 55, 479 - 17, 136 - 20, 325); } else { DWIN_ICON_Show(ICON, ICON_Pause_0, 96, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 181, 405, 271 - 63, 420, 124, 325); else DWIN_Frame_AreaCopy(1, 177, 423, 271 - 56, 479 - 46, 136 - 20, 325); @@ -354,14 +356,14 @@ void ICON_Pause() { void ICON_Continue() { if (select_print.now == 1) { DWIN_ICON_Show(ICON, ICON_Continue_1, 96, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 1, 447, 271 - 243, 479 - 19, 124, 325); else DWIN_Frame_AreaCopy(1, 1, 451, 271 - 239, 479 - 16, 136 - 15, 325); } else { DWIN_ICON_Show(ICON, ICON_Continue_0, 96, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 1, 405, 271 - 243, 420, 124, 325); else DWIN_Frame_AreaCopy(1, 1, 424, 271 - 240, 479 - 45, 136 - 15, 325); @@ -371,14 +373,14 @@ void ICON_Continue() { void ICON_Stop() { if (select_print.now == 2) { DWIN_ICON_Show(ICON, ICON_Stop_1, 184, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 151, 447, 271 - 93, 479 - 20, 210, 325); else DWIN_Frame_AreaCopy(1, 218, 451, 271 - 22, 479 - 14, 224 - 15, 325); } else { DWIN_ICON_Show(ICON, ICON_Stop_0, 184, 252); - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 151, 405, 271 - 93, 420, 210, 325); else DWIN_Frame_AreaCopy(1, 218, 423, 271 - 24, 479 - 43, 224 - 15, 325); @@ -466,7 +468,7 @@ inline void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char // The "Back" label is always on the first line inline void Draw_Back_Label(void) { - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 129, 72, 271 - 115, 479 - 395, LBLX, MBASE(0)); else DWIN_Frame_AreaCopy(1, 226, 179, 271 - 15, 479 - 290, LBLX, MBASE(0)); @@ -488,7 +490,7 @@ inline void draw_move_en(const uint16_t line) { } inline void Prepare_Item_Move(const uint8_t row) { - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 159, 70, 271 - 71, 479 - 395, LBLX, MBASE(row)); else draw_move_en(MBASE(row)); // "Move >" @@ -497,7 +499,7 @@ inline void Prepare_Item_Move(const uint8_t row) { } inline void Prepare_Item_Disable(const uint8_t row) { - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 204, 70, 271 - 12, 479 - 397, LBLX, MBASE(row)); else DWIN_Frame_AreaCopy(1, 103, 59, 271 - 71, 479 - 405, LBLX, MBASE(row)); // "Disable Stepper" @@ -505,7 +507,7 @@ inline void Prepare_Item_Disable(const uint8_t row) { } inline void Prepare_Item_Home(const uint8_t row) { - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 0, 89, 271 - 230, 479 - 378, LBLX, MBASE(row)); else DWIN_Frame_AreaCopy(1, 202, 61, 271 - 0, 479 - 408, LBLX, MBASE(row)); // "Auto Home" @@ -513,7 +515,7 @@ inline void Prepare_Item_Home(const uint8_t row) { } inline void Prepare_Item_Offset(const uint8_t row) { - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { #if HAS_BED_PROBE DWIN_Frame_AreaCopy(1, 174, 164, 271 - 48, 479 - 302, LBLX, MBASE(row)); show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(row), probe.offset.z * 100); @@ -533,7 +535,7 @@ inline void Prepare_Item_Offset(const uint8_t row) { } inline void Prepare_Item_PLA(const uint8_t row) { - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 100, 89, 271 - 93 - 27, 479 - 378, LBLX, MBASE(row)); } else { @@ -544,7 +546,7 @@ inline void Prepare_Item_PLA(const uint8_t row) { } inline void Prepare_Item_ABS(const uint8_t row) { - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 180, 89, 271 - 11 - 27, 479 - 379, LBLX, MBASE(row)); } else { @@ -555,7 +557,7 @@ inline void Prepare_Item_ABS(const uint8_t row) { } inline void Prepare_Item_Cool(const uint8_t row) { - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 1, 104, 271 - 215, 479 - 362, LBLX, MBASE(row)); else DWIN_Frame_AreaCopy(1, 200, 76, 271 - 7, 479 - 393, LBLX, MBASE(row));// "Cooldown" @@ -563,7 +565,7 @@ inline void Prepare_Item_Cool(const uint8_t row) { } inline void Prepare_Item_Lang(const uint8_t row) { - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 239, 134, 271 - 5, 479 - 333, LBLX, MBASE(row)); DWIN_Draw_String(false, false, font8x16, White, Background_black, 226, MBASE(row), (char*)"CN"); } @@ -581,7 +583,7 @@ inline void Draw_Prepare_Menu() { #define PSCROL(L) (scroll + (L)) #define PVISI(L) WITHIN(PSCROL(L), 0, MROWS) - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 133, 1, 271 - 111, 479 - 465 - 1, 14, 8); // "Prepare" } else { @@ -616,7 +618,7 @@ inline void Draw_Control_Menu() { if (CVISI(0)) Draw_Back_First(select_control.now == 0); // < Back - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 103, 1, 271 - 141, 479 - 465, 14, 8); DWIN_Frame_AreaCopy(1, 57, 104, 271 - 187, 479 - 363, LBLX, CLINE(1)); // Temperature > DWIN_Frame_AreaCopy(1, 87, 104, 271 - 157, 479 - 363, LBLX, CLINE(2)); // Motion > @@ -630,25 +632,22 @@ inline void Draw_Control_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_CONTROL)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_TEMPERATURE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_MOTION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_LOAD_EEPROM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)GET_TEXT_F(MSG_RESTORE_DEFAULTS)); - if (CVISI(6)) - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 5), (char*)"Info"); #else DWIN_Frame_AreaCopy(1, 128, 2, 271 - 95, 479 - 467, 14, 8); - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX, CLINE(1));// Temperature > - DWIN_Frame_AreaCopy(1, 84, 89, 271 - 143, 479 - 380, LBLX, CLINE(2));// Motion > - DWIN_Frame_AreaCopy(1, 131 + 17, 89, 271 - 3, 479 - 377 - 1, LBLX, CLINE(3));// "Store Configuration" - DWIN_Frame_AreaCopy(1, 26, 104, 271 - 214, 479 - 365, LBLX, CLINE(4)); // "Read" - DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 31 + 3, CLINE(4)); // "Configuration" - DWIN_Frame_AreaCopy(1, 59, 104, 271 - 178, 479 - 365, LBLX, CLINE(5)); // "Reset" - DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 34 + 3, CLINE(5)); // "Configuration" - if (CVISI(6)) - DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(6)); // Info > #endif + + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX, CLINE(1));// Temperature > + DWIN_Frame_AreaCopy(1, 84, 89, 271 - 143, 479 - 380, LBLX, CLINE(2));// Motion > + DWIN_Frame_AreaCopy(1, 131 + 17, 89, 271 - 3, 479 - 377 - 1, LBLX, CLINE(3));// "Store Configuration" + + DWIN_Frame_AreaCopy(1, 26, 104, 271 - 214, 479 - 365, LBLX, CLINE(4)); // "Read" + DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 31 + 3, CLINE(4)); // "Configuration" + + DWIN_Frame_AreaCopy(1, 59, 104, 271 - 178, 479 - 365, LBLX, CLINE(5)); // "Reset" + DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 34 + 3, CLINE(5)); // "Configuration" + + if (CVISI(6)) + DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(6)); // Info > } if (select_control.now && CVISI(select_control.now)) @@ -666,8 +665,9 @@ inline void Draw_Control_Menu() { inline void Draw_Tune_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 73, 2, 271 - 171, 479 - 466, 14, 9); + DWIN_Frame_AreaCopy(1, 116, 164, 271 - 100, 479 - 303, LBLX, MBASE(1)); DWIN_Frame_AreaCopy(1, 1, 134, 271 - 215, 479 - 333, LBLX, MBASE(2)); DWIN_Frame_AreaCopy(1, 58, 134, 271 - 158, 479 - 333, LBLX, MBASE(3)); @@ -677,21 +677,16 @@ inline void Draw_Tune_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_TUNE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); #else DWIN_Frame_AreaCopy(1, 94, 2, 271 - 145, 479 - 467, 14, 9); - DWIN_Frame_AreaCopy(1, 1, 179, 271 - 179, 479 - 287 - 2, LBLX, MBASE(1)); // print speed - DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX, MBASE(2)); // Hotend... - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 41 + 3, MBASE(2)); // ...Temperature - DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX, MBASE(3)); // Bed... - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 3, MBASE(3)); // ...Temperature - DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX, MBASE(4)); // fan speed - DWIN_Frame_AreaCopy(1, 93, 179, 271 - 130, 479 - 290, LBLX, MBASE(5)); // Z-offset #endif + DWIN_Frame_AreaCopy(1, 1, 179, 271 - 179, 479 - 287 - 2, LBLX, MBASE(1)); // print speed + DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX, MBASE(2)); // Hotend... + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 41 + 3, MBASE(2)); // ...Temperature + DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX, MBASE(3)); // Bed... + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 3, MBASE(3)); // ...Temperature + DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX, MBASE(4)); // fan speed + DWIN_Frame_AreaCopy(1, 93, 179, 271 - 130, 479 - 290, LBLX, MBASE(5)); // Z-offset } Draw_Back_First(select_tune.now == 0); @@ -742,7 +737,7 @@ inline void say_e(const uint16_t inset, const uint16_t line) { inline void Draw_Motion_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 173, 133, 228, 479 - 332, LBLX, MBASE(1)); // max speed @@ -756,17 +751,13 @@ inline void Draw_Motion_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_MOTION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Feedrate"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_ACCELERATION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_JERK)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STEPS_PER_MM)); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); - draw_max_en(MBASE(1)); draw_speed_en(24 + 3, MBASE(1)); // "Max Speed" - draw_max_accel_en(MBASE(2)); // "Max Acceleration" - draw_max_en(MBASE(3)); draw_corner_en(MBASE(3)); // "Max Corner" - draw_steps_per_mm(MBASE(4)); // "Steps-per-mm" #endif + draw_max_en(MBASE(1)); draw_speed_en(24 + 3, MBASE(1)); // "Max Speed" + draw_max_accel_en(MBASE(2)); // "Max Acceleration" + draw_max_en(MBASE(3)); draw_corner_en(MBASE(3)); // "Max Corner" + draw_steps_per_mm(MBASE(4)); // "Steps-per-mm" } Draw_Back_First(select_motion.now == 0); @@ -789,7 +780,7 @@ void Popup_Window_Temperature(const bool toohigh) { Draw_Popup_Bkgd_105(); if (toohigh) { DWIN_ICON_Show(ICON, ICON_TempTooHigh, 102, 165); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 103, 371, 237, 479 - 93, 52, 285); DWIN_Frame_AreaCopy(1, 151, 389, 185, 402, 187, 285); DWIN_Frame_AreaCopy(1, 189, 389, 271 - 0, 402, 95, 310); @@ -801,7 +792,7 @@ void Popup_Window_Temperature(const bool toohigh) { } else { DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 165); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 103, 371, 271 - 1, 479 - 93, 52, 285); DWIN_Frame_AreaCopy(1, 189, 389, 271 - 0, 402, 95, 310); } @@ -822,7 +813,7 @@ inline void Draw_Popup_Bkgd_60() { Clear_Main_Window(); Draw_Popup_Bkgd_60(); DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 103, 371, 136, 479 - 93, 69, 240); DWIN_Frame_AreaCopy(1, 170, 371, 271 - 1, 479 - 93, 69 + 33, 240); DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280); @@ -838,7 +829,7 @@ inline void Draw_Popup_Bkgd_60() { void Popup_Window_Resume(void) { Clear_Popup_Area(); Draw_Popup_Bkgd_105(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 160, 338, 271 - 36, 479 - 125, 98, 135); DWIN_Frame_AreaCopy(1, 103, 321, 271 - 0, 479 - 144, 52, 192); DWIN_ICON_Show(ICON, ICON_Continue_C, 26, 307); @@ -857,13 +848,13 @@ void Popup_Window_Home(void) { Clear_Main_Window(); Draw_Popup_Bkgd_60(); DWIN_ICON_Show(ICON, ICON_BLTouch, 101, 105); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 0, 371, 33, 386, 85, 240); DWIN_Frame_AreaCopy(1, 203, 286, 271, 302, 118, 240); DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 80, 230, (char*)GET_TEXT_F(MSG_LEVEL_BED_HOMING)); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 80, 230, (char*)"Auto homing..."); DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, (char*)"Please wait until completed"); } } @@ -872,12 +863,12 @@ void Popup_Window_Leveling(void) { Clear_Main_Window(); Draw_Popup_Bkgd_60(); DWIN_ICON_Show(ICON, ICON_AutoLeveling, 101, 105); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 0, 371, 100, 386, 84, 240); DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 76, 230, (char*)GET_TEXT_F(MSG_BED_LEVELING)); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 76, 230, (char*)"Auto leveling..."); DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, (char*)"Please wait until completed"); } } @@ -895,7 +886,7 @@ void Draw_Select_Highlight(const bool sel) { void Popup_window_PauseOrStop(void) { Clear_Main_Window(); Draw_Popup_Bkgd_60(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { 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); DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150); @@ -903,8 +894,8 @@ void Popup_window_PauseOrStop(void) { DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280); } else { - if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 88, 150, (char*)GET_TEXT_F(MSG_PAUSE_PRINT)); - else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 150, (char*)GET_TEXT_F(MSG_STOP_PRINT)); + if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 88, 150, (char*)"Pause print?"); + else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 150, (char*)"Stop print?"); DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280); DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280); } @@ -912,7 +903,7 @@ void Popup_window_PauseOrStop(void) { } void Draw_Printing_Screen(void) { - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 30, 1, 271 - 200, 479 - 465, 14, 9);// Tune DWIN_Frame_AreaCopy(1, 0, 72, 271 - 208, 479 - 393, 41, 188);// Pause DWIN_Frame_AreaCopy(1, 65, 72, 271 - 143, 479 - 393, 176, 188); // Stop @@ -972,7 +963,7 @@ void Goto_MainMenu(void) { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 2, 2, 271 - 244, 479 - 465, 14, 9); // "Home" } else { @@ -1766,7 +1757,7 @@ inline void Draw_Info_Menu() { DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, (char*)MACHINE_SIZE); DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, (char*)SHORT_BUILD_VERSION); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 30, 17, 271 - 214, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 197, 149, 271 - 19, 479 - 318, 108, 102); @@ -1797,7 +1788,7 @@ inline void Draw_Info_Menu() { inline void Draw_Print_File_Menu() { Clear_Title_Bar(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 0, 31, 271 - 216, 479 - 435, 14, 8); } else { @@ -2144,14 +2135,12 @@ void HMI_PauseOrStop(void) { inline void Draw_Move_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 192, 1, 271 - 38, 479 - 465, 14, 8); DWIN_Frame_AreaCopy(1, 58, 118, 271 - 165, 479 - 347, LBLX, MBASE(1)); DWIN_Frame_AreaCopy(1, 109, 118, 271 - 114, 479 - 347, LBLX, MBASE(2)); DWIN_Frame_AreaCopy(1, 160, 118, 271 - 62, 479 - 347, LBLX, MBASE(3)); - #if HAS_HOTEND - DWIN_Frame_AreaCopy(1, 212, 118, 271 - 18, 479 - 348, LBLX, MBASE(4)); - #endif + DWIN_Frame_AreaCopy(1, 212, 118, 271 - 18, 479 - 348, LBLX, MBASE(4)); } else { #ifdef USE_STRING_HEADINGS @@ -2162,9 +2151,7 @@ inline void Draw_Move_Menu() { draw_move_en(MBASE(1)); say_x(33 + 3, MBASE(1)); // "Move X" draw_move_en(MBASE(2)); say_y(33 + 3, MBASE(2)); // "Move Y" draw_move_en(MBASE(3)); say_z(33 + 3, MBASE(3)); // "Move Z" - #if HAS_HOTEND - DWIN_Frame_AreaCopy(1, 123, 192, 271 - 95, 479 - 277, LBLX, MBASE(4)); // "Extruder" - #endif + DWIN_Frame_AreaCopy(1, 123, 192, 271 - 95, 479 - 277, LBLX, MBASE(4)); // "Extruder" } Draw_Back_First(select_axis.now == 0); @@ -2173,18 +2160,6 @@ inline void Draw_Move_Menu() { LOOP_L_N(i, MROWS) Draw_Menu_Line(i + 1, ICON_MoveX + i); } -#include "../../libs/buzzer.h" - -void HMI_AudioFeedback(const bool success=true) { - if (success) { - buzzer.tone(100, 659); - buzzer.tone(10, 0); - buzzer.tone(100, 698); - } - else - buzzer.tone(40, 440); -} - /* Prepare */ void HMI_Prepare(void) { ENCODER_DiffState encoder_diffState = get_encoder_state(); @@ -2271,7 +2246,8 @@ void HMI_Prepare(void) { #else // Apply workspace offset, making the current position 0,0,0 queue.inject_P(PSTR("G92 X0 Y0 Z0")); - HMI_AudioFeedback(); + buzzer.tone(100, 659); + buzzer.tone(100, 698); #endif break; case 5: // PLA preheat @@ -2290,13 +2266,13 @@ void HMI_Prepare(void) { break; case 8: // language /* select language */ - HMI_flag.language_chinese ^= true; - if (HMI_flag.language_chinese) { - HMI_SetAndSaveLanguageChinese(); + HMI_flag.language_flag = !HMI_flag.language_flag; + if (HMI_flag.language_flag) { + set_chinese_to_eeprom(); DWIN_JPG_CacheTo1(Language_Chinese); } else { - HMI_SetAndSaveLanguageWestern(); + set_english_to_eeprom(); DWIN_JPG_CacheTo1(Language_English); } Draw_Prepare_Menu(); @@ -2311,7 +2287,7 @@ void HMI_Prepare(void) { void Draw_Temperature_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 236, 2, 271 - 8, 479 - 466, 14, 8); DWIN_Frame_AreaCopy(1, 1, 134, 271 - 215, 479 - 333, LBLX, MBASE(1)); @@ -2323,25 +2299,21 @@ void Draw_Temperature_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_TEMPERATURE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"PLA Preheat Settings"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)"ABS Preheat Settings"); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); - DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX, MBASE(1)); // Nozzle... - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 41 + 3, MBASE(1)); // ...Temperature - DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX, MBASE(2)); // Bed... - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 3, MBASE(2)); // ...Temperature - DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX, MBASE(3)); // Fan speed - DWIN_Frame_AreaCopy(1, 107, 76, 271 - 115, 479 - 393, LBLX, MBASE(4)); // Preheat... - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX + 49 + 3, MBASE(4)); // ...PLA - DWIN_Frame_AreaCopy(1, 131, 119, 271 - 89, 479 - 347, LBLX + 49 + 24 + 6, MBASE(4)); // PLA setting - DWIN_Frame_AreaCopy(1, 107, 76, 271 - 115, 479 - 393, LBLX, MBASE(5)); // Preheat... - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX + 49 + 3, MBASE(5)); // ...ABS - DWIN_Frame_AreaCopy(1, 131, 119, 271 - 89, 479 - 347, LBLX + 49 + 3 + 26 + 3, MBASE(5)); // ABS setting #endif + + DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX, MBASE(1)); // Nozzle... + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 41 + 3, MBASE(1)); // ...Temperature + DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX, MBASE(2)); // Bed... + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 3, MBASE(2)); // ...Temperature + DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX, MBASE(3)); // Fan speed + DWIN_Frame_AreaCopy(1, 107, 76, 271 - 115, 479 - 393, LBLX, MBASE(4)); // Preheat... + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX + 49 + 3, MBASE(4)); // ...PLA + DWIN_Frame_AreaCopy(1, 131, 119, 271 - 89, 479 - 347, LBLX + 49 + 24 + 6, MBASE(4)); // PLA setting + DWIN_Frame_AreaCopy(1, 107, 76, 271 - 115, 479 - 393, LBLX, MBASE(5)); // Preheat... + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX + 49 + 3, MBASE(5)); // ...ABS + DWIN_Frame_AreaCopy(1, 131, 119, 271 - 89, 479 - 347, LBLX + 49 + 3 + 26 + 3, MBASE(5)); // ABS setting } Draw_Back_First(select_temp.now == 0); @@ -2374,7 +2346,7 @@ void HMI_Control(void) { Draw_More_Icon(2 + MROWS - index_control); // Motion > if (index_control > MROWS) { Draw_More_Icon(6 + MROWS - index_control); // Info > - if (HMI_flag.language_chinese) + if (HMI_flag.language_flag) DWIN_Frame_AreaCopy(1, 231, 104, 271 - 13, 479 - 363, LBLX, MBASE(5)); else DWIN_Frame_AreaCopy(1, 0, 104, 271 - 247, 479 - 365, LBLX, MBASE(5)); @@ -2419,17 +2391,27 @@ void HMI_Control(void) { select_motion.reset(); Draw_Motion_Menu(); break; - case 3: { // write EEPROM - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; - case 4: { // read EEPROM - const bool success = settings.load(); - HMI_AudioFeedback(success); - } break; + case 3: // write EEPROM + if (settings.save()) { + buzzer.tone(100, 659); + buzzer.tone(100, 698); + } + else + buzzer.tone(20, 440); + break; + case 4: // read EEPROM + if (settings.load()) { + buzzer.tone(100, 659); + buzzer.tone(100, 698); + } + else {buzzer.tone(20, 440);} + break; case 5: // resume EEPROM settings.reset(); - HMI_AudioFeedback(); + #if HAS_BUZZER + buzzer.tone(100, 659); + buzzer.tone(100, 698); + #endif break; case 6: // info checkkey = Info; @@ -2584,7 +2566,7 @@ void HMI_Temperature(void) { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 59, 16, 271 - 132, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 100, 89, 124, 479 - 378, LBLX, MBASE(1)); @@ -2598,22 +2580,19 @@ void HMI_Temperature(void) { else { #ifdef USE_STRING_HEADINGS Draw_Title("PLA Settings"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Nozzle Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Bed Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX + 24 + 3, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 41 + 6, MBASE(1)); // PLA nozzle temp - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(2) + 3); - DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX + 24 + 3, MBASE(2) + 3); - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 24 + 6, MBASE(2) + 3); // PLA bed temp - DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX + 24 + 3, MBASE(3)); // PLA fan speed - DWIN_Frame_AreaCopy(1, 97, 165, 271 - 42, 479 - 301 - 1, LBLX, MBASE(4)); // save PLA configuration #endif + + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX + 24 + 3, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 41 + 6, MBASE(1)); // PLA nozzle temp + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(2) + 3); + DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX + 24 + 3, MBASE(2) + 3); + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 24 + 6, MBASE(2) + 3); // PLA bed temp + DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX + 24 + 3, MBASE(3)); // PLA fan speed + DWIN_Frame_AreaCopy(1, 97, 165, 271 - 42, 479 - 301 - 1, LBLX, MBASE(4)); // save PLA configuration } Draw_Back_First(); @@ -2636,7 +2615,7 @@ void HMI_Temperature(void) { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 142, 16, 271 - 48, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 180, 89, 204, 479 - 379, LBLX, MBASE(1)); @@ -2651,23 +2630,20 @@ void HMI_Temperature(void) { else { #ifdef USE_STRING_HEADINGS Draw_Title("ABS Settings"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Nozzle Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Bed Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(1)); - DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX + 24 + 3, MBASE(1)); - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 41 + 6, MBASE(1)); // ABS nozzle temp - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(2) + 3); - DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX + 24 + 3, MBASE(2) + 3); - DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 24 + 6, MBASE(2) + 3); // ABS bed temp - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(3)); - DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX + 24 + 3, MBASE(3)); // ABS fan speed - DWIN_Frame_AreaCopy(1, 97, 165, 271 - 42, 479 - 301 - 1, LBLX, MBASE(4)); - DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX + 33, MBASE(4)); // save ABS configuration #endif + + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(1)); + DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX + 24 + 3, MBASE(1)); + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 41 + 6, MBASE(1)); // ABS nozzle temp + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(2) + 3); + DWIN_Frame_AreaCopy(1, 240, 104, 271 - 7, 479 - 365, LBLX + 24 + 3, MBASE(2) + 3); + DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX + 24 + 24 + 6, MBASE(2) + 3); // ABS bed temp + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(3)); + DWIN_Frame_AreaCopy(1, 0, 119, 271 - 207, 479 - 347, LBLX + 24 + 3, MBASE(3)); // ABS fan speed + DWIN_Frame_AreaCopy(1, 97, 165, 271 - 42, 479 - 301 - 1, LBLX, MBASE(4)); + DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX + 33, MBASE(4)); // save ABS configuration } Draw_Back_First(); @@ -2691,7 +2667,7 @@ void HMI_Temperature(void) { inline void Draw_Max_Speed_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); auto say_max_speed = [](const uint16_t row) { @@ -2710,28 +2686,24 @@ inline void Draw_Max_Speed_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title("Max Speed (mm/s)"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Feedrate X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Feedrate Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Feedrate Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Feedrate E"); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); - - draw_max_en(MBASE(1)); // "Max" - DWIN_Frame_AreaCopy(1, 184, 119, 271 - 37, 479 - 347, LBLX + 24 + 3, MBASE(1)); // "Speed X" - - draw_max_en(MBASE(2)); // "Max" - draw_speed_en(24 + 3, MBASE(2)); // "Speed" - say_y(24 + 40 + 6, MBASE(2)); // "Y" - - draw_max_en(MBASE(3)); // "Max" - draw_speed_en(24 + 3, MBASE(3)); // "Speed" - say_z(24 + 40 + 6, MBASE(3)); // "Z" - - draw_max_en(MBASE(4)); // "Max" - draw_speed_en(24 + 3, MBASE(4)); // "Speed" - say_e(24 + 40 + 6, MBASE(4)); // "E" #endif + + draw_max_en(MBASE(1)); // "Max" + DWIN_Frame_AreaCopy(1, 184, 119, 271 - 37, 479 - 347, LBLX + 24 + 3, MBASE(1)); // "Speed X" + + draw_max_en(MBASE(2)); // "Max" + draw_speed_en(24 + 3, MBASE(2)); // "Speed" + say_y(24 + 40 + 6, MBASE(2)); // "Y" + + draw_max_en(MBASE(3)); // "Max" + draw_speed_en(24 + 3, MBASE(3)); // "Speed" + say_z(24 + 40 + 6, MBASE(3)); // "Z" + + draw_max_en(MBASE(4)); // "Max" + draw_speed_en(24 + 3, MBASE(4)); // "Speed" + say_e(24 + 40 + 6, MBASE(4)); // "E" } Draw_Back_First(); @@ -2746,7 +2718,7 @@ inline void Draw_Max_Speed_Menu() { inline void Draw_Max_Accel_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 173, 133, 200, 479 - 332, LBLX, MBASE(1)); @@ -2764,18 +2736,14 @@ inline void Draw_Max_Accel_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_ACCELERATION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Accel X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Accel Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Accel Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Accel E"); + Draw_Title("Max Accel (mm/s/s)"); // TODO: GET_TEXT_F #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); - draw_max_accel_en(MBASE(1)); say_x(24 + 78 + 6, MBASE(1)); // "Max Acceleration X" - draw_max_accel_en(MBASE(2)); say_y(24 + 78 + 6, MBASE(2)); // "Max Acceleration Y" - draw_max_accel_en(MBASE(3)); say_z(24 + 78 + 6, MBASE(3)); // "Max Acceleration Z" - draw_max_accel_en(MBASE(4)); say_e(24 + 78 + 6, MBASE(4)); // "Max Acceleration E" #endif + draw_max_accel_en(MBASE(1)); say_x(24 + 78 + 6, MBASE(1)); // "Max Acceleration X" + draw_max_accel_en(MBASE(2)); say_y(24 + 78 + 6, MBASE(2)); // "Max Acceleration Y" + draw_max_accel_en(MBASE(3)); say_z(24 + 78 + 6, MBASE(3)); // "Max Acceleration Z" + draw_max_accel_en(MBASE(4)); say_e(24 + 78 + 6, MBASE(4)); // "Max Acceleration E" } Draw_Back_First(); @@ -2790,7 +2758,7 @@ inline void Draw_Max_Accel_Menu() { inline void Draw_Max_Jerk_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 173, 133, 200, 479 - 332, LBLX, MBASE(1)); @@ -2812,33 +2780,30 @@ inline void Draw_Max_Jerk_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_JERK)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Jerk X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Jerk Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Jerk Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Jerk E"); + Draw_Title("Max Corner"); // TODO: GET_TEXT_F #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); - draw_max_en(MBASE(1)); // "Max" - draw_corner_en(MBASE(1)); // "Corner" - draw_speed_en(66 + 6, MBASE(1)); // "Speed" - say_x(106 + 9, MBASE(1)); // "X" - - draw_max_en(MBASE(2)); // "Max" - draw_corner_en(MBASE(2)); // "Corner" - draw_speed_en(66 + 6, MBASE(2)); // "Speed" - say_y(106 + 9, MBASE(2)); // "Y" - - draw_max_en(MBASE(3)); // "Max" - draw_corner_en(MBASE(3)); // "Corner" - draw_speed_en(66 + 6, MBASE(3)); // "Speed" - say_z(106 + 9, MBASE(3)); // "Z" - - draw_max_en(MBASE(4)); // "Max" - draw_corner_en(MBASE(4)); // "Corner" - draw_speed_en(66 + 6, MBASE(4)); // "Speed" - say_e(106 + 9, MBASE(4)); // "E" #endif + + draw_max_en(MBASE(1)); // "Max" + draw_corner_en(MBASE(1)); // "Corner" + draw_speed_en(66 + 6, MBASE(1)); // "Speed" + say_x(106 + 9, MBASE(1)); // "X" + + draw_max_en(MBASE(2)); // "Max" + draw_corner_en(MBASE(2)); // "Corner" + draw_speed_en(66 + 6, MBASE(2)); // "Speed" + say_y(106 + 9, MBASE(2)); // "Y" + + draw_max_en(MBASE(3)); // "Max" + draw_corner_en(MBASE(3)); // "Corner" + draw_speed_en(66 + 6, MBASE(3)); // "Speed" + say_z(106 + 9, MBASE(3)); // "Z" + + draw_max_en(MBASE(4)); // "Max" + draw_corner_en(MBASE(4)); // "Corner" + draw_speed_en(66 + 6, MBASE(4)); // "Speed" + say_e(106 + 9, MBASE(4)); // "E" } Draw_Back_First(); @@ -2853,7 +2818,7 @@ inline void Draw_Max_Jerk_Menu() { inline void Draw_Steps_Menu() { Clear_Main_Window(); - if (HMI_flag.language_chinese) { + if (HMI_flag.language_flag) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 153, 148, 271 - 77, 479 - 318, LBLX, MBASE(1)); @@ -2867,18 +2832,14 @@ inline void Draw_Steps_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_STEPS_PER_MM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Steps/mm X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Steps/mm Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Steps/mm Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Steps/mm E"); + Draw_Title("Steps-per-mm"); // TODO: GET_TEXT_F #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); - draw_steps_per_mm(MBASE(1)); say_x(100 + 3, MBASE(1)); // "Steps-per-mm X" - draw_steps_per_mm(MBASE(2)); say_y(100 + 3, MBASE(2)); // "Y" - draw_steps_per_mm(MBASE(3)); say_z(100 + 3, MBASE(3)); // "Z" - draw_steps_per_mm(MBASE(4)); say_e(100 + 3, MBASE(4)); // "E" #endif + draw_steps_per_mm(MBASE(1)); say_x(100 + 3, MBASE(1)); // "Steps-per-mm X" + draw_steps_per_mm(MBASE(2)); say_y(100 + 3, MBASE(2)); // "Y" + draw_steps_per_mm(MBASE(3)); say_z(100 + 3, MBASE(3)); // "Z" + draw_steps_per_mm(MBASE(4)); say_e(100 + 3, MBASE(4)); // "E" } Draw_Back_First(); @@ -2944,8 +2905,6 @@ void HMI_Info(void) { if (encoder_diffState == ENCODER_DIFF_ENTER) { #if HAS_LEVELING checkkey = Control; - Clear_Main_Window(); - //Goto_MainMenu(); select_control.set(CONTROL_ITEMS); Draw_Control_Menu(); #else @@ -3031,16 +2990,16 @@ void HMI_Tune(void) { break; case 6: // Language // Select language - HMI_flag.language_chinese ^= true; + HMI_flag.language_flag = !HMI_flag.language_flag; Clear_Main_Window(); - if (HMI_flag.language_chinese) { - HMI_SetAndSaveLanguageChinese(); + if (HMI_flag.language_flag) { + set_chinese_to_eeprom(); DWIN_JPG_CacheTo1(Language_Chinese); } else { - HMI_SetAndSaveLanguageWestern(); + set_english_to_eeprom(); DWIN_JPG_CacheTo1(Language_English); } @@ -3097,10 +3056,14 @@ void HMI_PLAPreheatSetting(void) { EncoderRate.encoderRateEnabled = 1; break; #endif - case 4: { // save PLA configuration - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; + case 4: // save PLA configuration + if (settings.save()) { + buzzer.tone(100, 659); + buzzer.tone(100, 698); + } + else + buzzer.tone(20, 440); + break; default: break; } } @@ -3151,10 +3114,14 @@ void HMI_ABSPreheatSetting(void) { EncoderRate.encoderRateEnabled = 1; break; #endif - case 4: { // save ABS configuration - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; + case 4: // save PLA configuration + if (settings.save()) { + buzzer.tone(100, 659); + buzzer.tone(100, 698); + } + else + buzzer.tone(20, 440); + break; default: break; } @@ -3388,7 +3355,14 @@ void HMI_Init(void) { delay(20); } - HMI_SetLanguage(); + lcd_select_language(); + + #if ENABLED(FIX_MOUNTED_PROBE) // For "CREALITY_TOUCH" probe too? + SET_OUTPUT(COM_PIN); + WRITE(COM_PIN, 1); + #endif + + delay(200); } void DWIN_Update(void) { @@ -3422,7 +3396,7 @@ void EachMomentUpdate(void) { // show print done confirm DWIN_Draw_Rectangle(1, Background_black, 0, 250, 271, 360); - DWIN_ICON_Show(ICON, HMI_flag.language_chinese ? ICON_Confirm_C : ICON_Confirm_E, 86, 302 - 19); + DWIN_ICON_Show(ICON, HMI_flag.language_flag ? ICON_Confirm_C : ICON_Confirm_E, 86, 302 - 19); } else if (HMI_flag.pause_flag != printingIsPaused()) { // print status update @@ -3572,11 +3546,11 @@ void DWIN_HandleScreen(void) { case Move_X: HMI_Move_X(); break; case Move_Y: HMI_Move_Y(); break; case Move_Z: HMI_Move_Z(); break; + case Extruder: HMI_Move_E(); break; + case Homeoffset: HMI_Zoffset(); break; #if HAS_HOTEND - case Extruder: HMI_Move_E(); break; case ETemp: HMI_ETemp(); break; #endif - case Homeoffset: HMI_Zoffset(); break; #if HAS_HEATED_BED case BedTemp: HMI_BedTemp(); break; #endif diff --git a/Marlin/src/lcd/dwin/dwin.h b/Marlin/src/lcd/dwin/dwin.h index 3446a0d4c1..2d24d2504e 100644 --- a/Marlin/src/lcd/dwin/dwin.h +++ b/Marlin/src/lcd/dwin/dwin.h @@ -68,11 +68,11 @@ enum processID { Move_X, Move_Y, Move_Z, + Extruder, + Homeoffset, #if HAS_HOTEND - Extruder, ETemp, #endif - Homeoffset, #if HAS_HEATED_BED BedTemp, #endif @@ -244,7 +244,7 @@ typedef struct { } HMI_value_t; typedef struct { - bool language_chinese; // 0: EN, 1: CN + bool language_flag; // 0: EN, 1: CN bool pause_flag:1; bool print_finish:1; bool confirm_flag:1; @@ -269,9 +269,9 @@ extern HMI_value_t HMI_ValueStruct; extern HMI_Flag HMI_flag; // Language -void HMI_SetLanguage(void); -void HMI_SetAndSaveLanguageWestern(void); -void HMI_SetAndSaveLanguageChinese(void); +void lcd_select_language(void); +void set_english_to_eeprom(void); +void set_chinese_to_eeprom(void); // Show ICO void ICON_Print(bool show);