From ee19e1d3ffd38ddbf9675a3731ea10725be0905e Mon Sep 17 00:00:00 2001 From: Steven Haigh Date: Sat, 22 Aug 2020 14:44:21 +1000 Subject: [PATCH] Translatable strings on Ender-3 V2 DWIN (#19053) Co-authored-by: Scott Lahteine --- Marlin/src/lcd/dwin/dwin.cpp | 392 +++++++++++++++++++---------------- Marlin/src/lcd/dwin/dwin.h | 8 +- 2 files changed, 218 insertions(+), 182 deletions(-) diff --git a/Marlin/src/lcd/dwin/dwin.cpp b/Marlin/src/lcd/dwin/dwin.cpp index e527c8dba0..0d719542e1 100644 --- a/Marlin/src/lcd/dwin/dwin.cpp +++ b/Marlin/src/lcd/dwin/dwin.cpp @@ -190,23 +190,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 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) +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) DWIN_JPG_CacheTo1(Language_Chinese); else DWIN_JPG_CacheTo1(Language_English); } -void set_english_to_eeprom(void) { - HMI_flag.language_flag = 0; +void HMI_SetAndSaveLanguageWestern(void) { + HMI_flag.language_chinese = false; DWIN_JPG_CacheTo1(Language_English); - BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_flag, sizeof(HMI_flag.language_flag)); + BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); } -void set_chinese_to_eeprom(void) { - HMI_flag.language_flag = 1; +void HMI_SetAndSaveLanguageChinese(void) { + HMI_flag.language_chinese = true; DWIN_JPG_CacheTo1(Language_Chinese); - BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_flag, sizeof(HMI_flag.language_flag)); + BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); } 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) { @@ -223,14 +223,14 @@ void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNu void ICON_Print() { if (select_page.now == 0) { DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130); - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -240,14 +240,14 @@ void ICON_Print() { void ICON_Prepare() { if (select_page.now == 1) { DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130); - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -257,14 +257,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -274,14 +274,14 @@ void ICON_Control() { void ICON_StartInfo(bool show) { if (show) { DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246); - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 91, 405, 271 - 153, 420, 186, 318); else DWIN_Frame_AreaCopy(1, 132, 423, 159, 423 + 12, 186, 318); @@ -291,14 +291,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 211, 405, 238, 420, 186, 318); else DWIN_Frame_AreaCopy(1, 84, 465, 120, 478, 200 - 18, 318); @@ -308,14 +308,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -325,14 +325,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -342,14 +342,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -359,14 +359,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_flag) + if (HMI_flag.language_chinese) 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_flag) + if (HMI_flag.language_chinese) 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); @@ -454,7 +454,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_flag) + if (HMI_flag.language_chinese) 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)); @@ -476,7 +476,7 @@ inline void draw_move_en(const uint16_t line) { } inline void Prepare_Item_Move(const uint8_t row) { - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 159, 70, 271 - 71, 479 - 395, LBLX, MBASE(row)); else draw_move_en(MBASE(row)); // "Move >" @@ -485,7 +485,7 @@ inline void Prepare_Item_Move(const uint8_t row) { } inline void Prepare_Item_Disable(const uint8_t row) { - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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" @@ -493,7 +493,7 @@ inline void Prepare_Item_Disable(const uint8_t row) { } inline void Prepare_Item_Home(const uint8_t row) { - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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" @@ -501,7 +501,7 @@ inline void Prepare_Item_Home(const uint8_t row) { } inline void Prepare_Item_Offset(const uint8_t row) { - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { #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); @@ -521,7 +521,7 @@ inline void Prepare_Item_Offset(const uint8_t row) { } inline void Prepare_Item_PLA(const uint8_t row) { - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 100, 89, 271 - 93 - 27, 479 - 378, LBLX, MBASE(row)); } else { @@ -532,7 +532,7 @@ inline void Prepare_Item_PLA(const uint8_t row) { } inline void Prepare_Item_ABS(const uint8_t row) { - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 180, 89, 271 - 11 - 27, 479 - 379, LBLX, MBASE(row)); } else { @@ -543,7 +543,7 @@ inline void Prepare_Item_ABS(const uint8_t row) { } inline void Prepare_Item_Cool(const uint8_t row) { - if (HMI_flag.language_flag) + if (HMI_flag.language_chinese) 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" @@ -551,7 +551,7 @@ inline void Prepare_Item_Cool(const uint8_t row) { } inline void Prepare_Item_Lang(const uint8_t row) { - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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"); } @@ -569,7 +569,7 @@ inline void Draw_Prepare_Menu() { #define PSCROL(L) (scroll + (L)) #define PVISI(L) WITHIN(PSCROL(L), 0, MROWS) - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 133, 1, 271 - 111, 479 - 465 - 1, 14, 8); // "Prepare" } else { @@ -604,7 +604,7 @@ inline void Draw_Control_Menu() { if (CVISI(0)) Draw_Back_First(select_control.now == 0); // < Back - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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 > @@ -618,22 +618,25 @@ 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)) @@ -651,9 +654,8 @@ inline void Draw_Control_Menu() { inline void Draw_Tune_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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)); @@ -663,16 +665,21 @@ 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); @@ -723,7 +730,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_flag) { + if (HMI_flag.language_chinese) { 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 @@ -737,13 +744,17 @@ 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); @@ -766,7 +777,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_flag) { + if (HMI_flag.language_chinese) { 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); @@ -778,7 +789,7 @@ void Popup_Window_Temperature(const bool toohigh) { } else { DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 165); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 103, 371, 271 - 1, 479 - 93, 52, 285); DWIN_Frame_AreaCopy(1, 189, 389, 271 - 0, 402, 95, 310); } @@ -799,7 +810,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_flag) { + if (HMI_flag.language_chinese) { 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); @@ -815,7 +826,7 @@ inline void Draw_Popup_Bkgd_60() { void Popup_Window_Resume(void) { Clear_Popup_Area(); Draw_Popup_Bkgd_105(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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); @@ -834,13 +845,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_flag) { + if (HMI_flag.language_chinese) { 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*)"Auto homing..."); + 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, 24, 260, (char*)"Please wait until completed"); } } @@ -849,12 +860,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_flag) { + if (HMI_flag.language_chinese) { 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*)"Auto leveling..."); + 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, 24, 260, (char*)"Please wait until completed"); } } @@ -872,7 +883,7 @@ void Draw_Select_Highlight(const bool sel) { void Popup_window_PauseOrStop(void) { Clear_Main_Window(); Draw_Popup_Bkgd_60(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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); @@ -880,8 +891,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*)"Pause print?"); - else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 150, (char*)"Stop print?"); + 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)); DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280); DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280); } @@ -889,7 +900,7 @@ void Popup_window_PauseOrStop(void) { } void Draw_Printing_Screen(void) { - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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 @@ -949,7 +960,7 @@ void Goto_MainMenu(void) { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 2, 2, 271 - 244, 479 - 465, 14, 9); // "Home" } else { @@ -1715,7 +1726,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_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 30, 17, 271 - 214, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 197, 149, 271 - 19, 479 - 318, 108, 102); @@ -1746,7 +1757,7 @@ inline void Draw_Info_Menu() { inline void Draw_Print_File_Menu() { Clear_Title_Bar(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 0, 31, 271 - 216, 479 - 435, 14, 8); } else { @@ -2093,7 +2104,7 @@ void HMI_PauseOrStop(void) { inline void Draw_Move_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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)); @@ -2239,13 +2250,13 @@ void HMI_Prepare(void) { break; case 8: // language /* select language */ - HMI_flag.language_flag = !HMI_flag.language_flag; - if (HMI_flag.language_flag) { - set_chinese_to_eeprom(); + HMI_flag.language_chinese ^= true; + if (HMI_flag.language_chinese) { + HMI_SetAndSaveLanguageChinese(); DWIN_JPG_CacheTo1(Language_Chinese); } else { - set_english_to_eeprom(); + HMI_SetAndSaveLanguageWestern(); DWIN_JPG_CacheTo1(Language_English); } Draw_Prepare_Menu(); @@ -2260,7 +2271,7 @@ void HMI_Prepare(void) { void Draw_Temperature_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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)); @@ -2272,21 +2283,25 @@ 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); @@ -2319,7 +2334,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_flag) + if (HMI_flag.language_chinese) 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)); @@ -2523,7 +2538,7 @@ void HMI_Temperature(void) { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 59, 16, 271 - 132, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 100, 89, 124, 479 - 378, LBLX, MBASE(1)); @@ -2537,19 +2552,22 @@ 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(); @@ -2572,7 +2590,7 @@ void HMI_Temperature(void) { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 142, 16, 271 - 48, 479 - 450, 14, 8); DWIN_Frame_AreaCopy(1, 180, 89, 204, 479 - 379, LBLX, MBASE(1)); @@ -2587,20 +2605,23 @@ 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(); @@ -2624,7 +2645,7 @@ void HMI_Temperature(void) { inline void Draw_Max_Speed_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); auto say_max_speed = [](const uint16_t row) { @@ -2643,24 +2664,28 @@ 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(); @@ -2675,7 +2700,7 @@ inline void Draw_Max_Speed_Menu() { inline void Draw_Max_Accel_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 173, 133, 200, 479 - 332, LBLX, MBASE(1)); @@ -2693,14 +2718,18 @@ inline void Draw_Max_Accel_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title("Max Accel (mm/s/s)"); // TODO: GET_TEXT_F + 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"); #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(); @@ -2715,7 +2744,7 @@ inline void Draw_Max_Accel_Menu() { inline void Draw_Max_Jerk_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 1, 16, 271 - 243, 479 - 451, 14, 8); DWIN_Frame_AreaCopy(1, 173, 133, 200, 479 - 332, LBLX, MBASE(1)); @@ -2737,30 +2766,33 @@ inline void Draw_Max_Jerk_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title("Max Corner"); // TODO: GET_TEXT_F + 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"); #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(); @@ -2775,7 +2807,7 @@ inline void Draw_Max_Jerk_Menu() { inline void Draw_Steps_Menu() { Clear_Main_Window(); - if (HMI_flag.language_flag) { + if (HMI_flag.language_chinese) { 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)); @@ -2789,14 +2821,18 @@ inline void Draw_Steps_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title("Steps-per-mm"); // TODO: GET_TEXT_F + 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"); #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(); @@ -2947,16 +2983,16 @@ void HMI_Tune(void) { break; case 6: // Language // Select language - HMI_flag.language_flag = !HMI_flag.language_flag; + HMI_flag.language_chinese ^= true; Clear_Main_Window(); - if (HMI_flag.language_flag) { - set_chinese_to_eeprom(); + if (HMI_flag.language_chinese) { + HMI_SetAndSaveLanguageChinese(); DWIN_JPG_CacheTo1(Language_Chinese); } else { - set_english_to_eeprom(); + HMI_SetAndSaveLanguageWestern(); DWIN_JPG_CacheTo1(Language_English); } @@ -3304,7 +3340,7 @@ void HMI_Init(void) { delay(20); } - lcd_select_language(); + HMI_SetLanguage(); #if ENABLED(FIX_MOUNTED_PROBE) // For "CREALITY_TOUCH" probe too? SET_OUTPUT(COM_PIN); @@ -3345,7 +3381,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_flag ? ICON_Confirm_C : ICON_Confirm_E, 86, 302 - 19); + DWIN_ICON_Show(ICON, HMI_flag.language_chinese ? ICON_Confirm_C : ICON_Confirm_E, 86, 302 - 19); } else if (HMI_flag.pause_flag != printingIsPaused()) { // print status update diff --git a/Marlin/src/lcd/dwin/dwin.h b/Marlin/src/lcd/dwin/dwin.h index cddc582fc2..3446a0d4c1 100644 --- a/Marlin/src/lcd/dwin/dwin.h +++ b/Marlin/src/lcd/dwin/dwin.h @@ -244,7 +244,7 @@ typedef struct { } HMI_value_t; typedef struct { - bool language_flag; // 0: EN, 1: CN + bool language_chinese; // 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 lcd_select_language(void); -void set_english_to_eeprom(void); -void set_chinese_to_eeprom(void); +void HMI_SetLanguage(void); +void HMI_SetAndSaveLanguageWestern(void); +void HMI_SetAndSaveLanguageChinese(void); // Show ICO void ICON_Print(bool show);