浏览代码

🚚 Relocate and adjust DWIN E3V2 (#22471)

Scott Lahteine 3 年前
父节点
当前提交
9bb5b10c0c
没有帐户链接到提交者的电子邮件

+ 8
- 5
Marlin/Configuration_adv.h 查看文件

@@ -1304,11 +1304,14 @@
1304 1304
   //#define LCD_SHOW_E_TOTAL
1305 1305
 #endif
1306 1306
 
1307
-#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, EXTENSIBLE_UI)
1308
-  //#define SHOW_REMAINING_TIME       // Display estimated time to completion
1309
-  #if ENABLED(SHOW_REMAINING_TIME)
1310
-    //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
1311
-    //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
1307
+// LCD Print Progress options
1308
+#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
1309
+  #if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
1310
+    //#define SHOW_REMAINING_TIME         // Display estimated time to completion
1311
+    #if ENABLED(SHOW_REMAINING_TIME)
1312
+      //#define USE_M73_REMAINING_TIME    // Use remaining time from M73 command instead of estimation
1313
+      //#define ROTATE_PROGRESS_DISPLAY   // Display (P)rogress, (E)lapsed, and (R)emaining time
1314
+    #endif
1312 1315
   #endif
1313 1316
 
1314 1317
   #if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI)

+ 3
- 7
Marlin/src/MarlinCore.cpp 查看文件

@@ -75,8 +75,8 @@
75 75
 #endif
76 76
 
77 77
 #if ENABLED(DWIN_CREALITY_LCD)
78
-  #include "lcd/dwin/e3v2/dwin.h"
79
-  #include "lcd/dwin/e3v2/rotary_encoder.h"
78
+  #include "lcd/e3v2/creality/dwin.h"
79
+  #include "lcd/e3v2/creality/rotary_encoder.h"
80 80
 #endif
81 81
 
82 82
 #if ENABLED(EXTENSIBLE_UI)
@@ -1310,11 +1310,7 @@ void setup() {
1310 1310
   // (because EEPROM code calls the UI).
1311 1311
 
1312 1312
   #if ENABLED(DWIN_CREALITY_LCD)
1313
-    delay(800);   // Required delay (since boot?)
1314
-    SERIAL_ECHOPGM("\nDWIN handshake ");
1315
-    if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
1316
-    DWIN_Frame_SetDir(1); // Orientation 90°
1317
-    DWIN_UpdateLCD();     // Show bootscreen (first image)
1313
+    SETUP_RUN(DWIN_Startup());
1318 1314
   #else
1319 1315
     SETUP_RUN(ui.init());
1320 1316
     #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)

+ 1
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp 查看文件

@@ -61,7 +61,7 @@
61 61
 #endif
62 62
 
63 63
 #if ENABLED(DWIN_CREALITY_LCD)
64
-  #include "../../../lcd/dwin/e3v2/dwin.h"
64
+  #include "../../../lcd/e3v2/creality/dwin.h"
65 65
 #endif
66 66
 
67 67
 #if HAS_MULTI_HOTEND

+ 1
- 1
Marlin/src/gcode/calibrate/G28.cpp 查看文件

@@ -47,7 +47,7 @@
47 47
 
48 48
 #include "../../lcd/marlinui.h"
49 49
 #if ENABLED(DWIN_CREALITY_LCD)
50
-  #include "../../lcd/dwin/e3v2/dwin.h"
50
+  #include "../../lcd/e3v2/creality/dwin.h"
51 51
 #endif
52 52
 
53 53
 #if ENABLED(EXTENSIBLE_UI)

+ 4
- 4
Marlin/src/inc/Conditionals_LCD.h 查看文件

@@ -482,10 +482,6 @@
482 482
 #endif
483 483
 
484 484
 // Aliases for LCD features
485
-#if EITHER(IS_ULTRA_LCD, EXTENSIBLE_UI)
486
-  #define HAS_DISPLAY 1
487
-#endif
488
-
489 485
 #if IS_ULTRA_LCD
490 486
   #define HAS_WIRED_LCD 1
491 487
   #if ENABLED(DOGLCD)
@@ -497,6 +493,10 @@
497 493
   #endif
498 494
 #endif
499 495
 
496
+#if EITHER(HAS_WIRED_LCD, EXTENSIBLE_UI)
497
+  #define HAS_DISPLAY 1
498
+#endif
499
+
500 500
 #if ANY(HAS_DISPLAY, DWIN_CREALITY_LCD, GLOBAL_STATUS_MESSAGE)
501 501
   #define HAS_STATUS_MESSAGE 1
502 502
 #endif

+ 4
- 3
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp 查看文件

@@ -791,9 +791,10 @@ void MarlinUI::draw_status_screen() {
791 791
   //
792 792
 
793 793
   lcd.setCursor(0, 0);
794
-  _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position.x)), blink); lcd.write(' ');
795
-  _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position.y)), blink); lcd.write(' ');
796
-  _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
794
+  const xyz_pos_t lpos = current_position.asLogical();
795
+  _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink); lcd.write(' ');
796
+  _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink); lcd.write(' ');
797
+  _draw_axis_value(Z_AXIS, ftostr52sp(lpos.z), blink);
797 798
 
798 799
   #if HAS_LEVELING && !HAS_HEATED_BED
799 800
     lcd.write(planner.leveling_active || blink ? '_' : ' ');

Marlin/src/lcd/dwin/e3v2/README.md → Marlin/src/lcd/e3v2/creality/README.md 查看文件


Marlin/src/lcd/dwin/e3v2/dwin.cpp → Marlin/src/lcd/e3v2/creality/dwin.cpp 查看文件

@@ -42,10 +42,6 @@
42 42
   #define JUST_BABYSTEP 1
43 43
 #endif
44 44
 
45
-#include <WString.h>
46
-#include <stdio.h>
47
-#include <string.h>
48
-
49 45
 #include "../../fontutils.h"
50 46
 #include "../../marlinui.h"
51 47
 
@@ -85,6 +81,10 @@
85 81
   #include "../../../feature/powerloss.h"
86 82
 #endif
87 83
 
84
+#include <WString.h>
85
+#include <stdio.h>
86
+#include <string.h>
87
+
88 88
 #ifndef MACHINE_SIZE
89 89
   #define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
90 90
 #endif
@@ -97,10 +97,6 @@
97 97
 #define USE_STRING_HEADINGS
98 98
 //#define USE_STRING_TITLES
99 99
 
100
-#define DWIN_FONT_MENU font8x16
101
-#define DWIN_FONT_STAT font10x20
102
-#define DWIN_FONT_HEAD font10x20
103
-
104 100
 #define MENU_CHAR_LIMIT  24
105 101
 #define STATUS_Y        360
106 102
 
@@ -135,6 +131,9 @@ constexpr uint16_t TROWS = 6, MROWS = TROWS - 1,        // Total rows, and other
135 131
 
136 132
 #define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, dwin_zoffset)
137 133
 
134
+#define DWIN_BOTTOM (DWIN_HEIGHT-1)
135
+#define DWIN_RIGHT (DWIN_WIDTH-1)
136
+
138 137
 /* Value Init */
139 138
 HMI_value_t HMI_ValueStruct;
140 139
 HMI_Flag_t HMI_flag{0};
@@ -220,11 +219,11 @@ void HMI_ToggleLanguage() {
220 219
 
221 220
 void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) {
222 221
   if (value < 0) {
223
-    DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F("-"));
222
+    DWIN_Draw_String(true, size, Color_White, bColor, x - 6, y, F("-"));
224 223
     DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, -value);
225 224
   }
226 225
   else {
227
-    DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F(" "));
226
+    DWIN_Draw_String(true, size, Color_White, bColor, x - 6, y, F(" "));
228 227
     DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value);
229 228
   }
230 229
 }
@@ -391,20 +390,20 @@ void ICON_Stop() {
391 390
   }
392 391
 }
393 392
 
394
-void Clear_Title_Bar() {
395
-  DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, 30);
393
+inline void Clear_Title_Bar() {
394
+  DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT);
396 395
 }
397 396
 
398 397
 void Draw_Title(const char * const title) {
399
-  DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
398
+  DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
400 399
 }
401 400
 
402 401
 void Draw_Title(const __FlashStringHelper * title) {
403
-  DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
402
+  DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
404 403
 }
405 404
 
406
-void Clear_Menu_Area() {
407
-  DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y - 1);
405
+inline void Clear_Menu_Area() {
406
+  DWIN_Draw_Box(1, Color_Bg_Black, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT);
408 407
 }
409 408
 
410 409
 void Clear_Main_Window() {
@@ -465,7 +464,7 @@ void Erase_Menu_Text(const uint8_t line) {
465 464
 }
466 465
 
467 466
 void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
468
-  if (label) DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
467
+  if (label) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
469 468
   if (icon) Draw_Menu_Icon(line, icon);
470 469
   if (more) Draw_More_Icon(line);
471 470
 }
@@ -494,7 +493,8 @@ void Draw_Back_First(const bool is_sel=true) {
494 493
   if (is_sel) Draw_Menu_Cursor(0);
495 494
 }
496 495
 
497
-inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, auto &valref) {
496
+template <typename T>
497
+inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, T &valref) {
498 498
   if (encoder_diffState == ENCODER_DIFF_CW)
499 499
     valref += EncoderRate.encoderMoveValue;
500 500
   else if (encoder_diffState == ENCODER_DIFF_CCW)
@@ -563,7 +563,7 @@ inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, auto &valr
563 563
 //
564 564
 
565 565
 void DWIN_Draw_Label(const uint16_t y, char *string) {
566
-  DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, y, string);
566
+  DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, LBLX, y, string);
567 567
 }
568 568
 void DWIN_Draw_Label(const uint16_t y, const __FlashStringHelper *title) {
569 569
   DWIN_Draw_Label(y, (char*)title);
@@ -577,7 +577,9 @@ void draw_move_en(const uint16_t line) {
577 577
   #endif
578 578
 }
579 579
 
580
-void DWIN_Frame_TitleCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { DWIN_Frame_AreaCopy(id, x1, y1, x2, y2, 14, 8); }
580
+inline void DWIN_Frame_TitleCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
581
+  DWIN_Frame_AreaCopy(id, x1, y1, x2, y2, 14, 8);
582
+}
581 583
 
582 584
 void Item_Prepare_Move(const uint8_t row) {
583 585
   if (HMI_IsChinese())
@@ -703,7 +705,7 @@ void Item_Prepare_Lang(const uint8_t row) {
703 705
       DWIN_Frame_AreaCopy(1, 0, 194, 121, 207, LBLX, MBASE(row)); // "Language selection"
704 706
     #endif
705 707
   }
706
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), HMI_IsChinese() ? F("CN") : F("EN"));
708
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), HMI_IsChinese() ? F("CN") : F("EN"));
707 709
   Draw_Menu_Icon(row, ICON_Language);
708 710
 }
709 711
 
@@ -849,7 +851,7 @@ void Draw_Tune_Menu() {
849 851
   Clear_Main_Window();
850 852
 
851 853
   if (HMI_IsChinese()) {
852
-    DWIN_Frame_AreaCopy(1, 73, 2, 100, 13, 14, 9);
854
+    DWIN_Frame_TitleCopy(1, 73, 2, 100, 13);
853 855
     DWIN_Frame_AreaCopy(1, 116, 164, 171, 176, LBLX, MBASE(TUNE_CASE_SPEED));
854 856
     #if HAS_HOTEND
855 857
       DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX, MBASE(TUNE_CASE_TEMP));
@@ -883,6 +885,7 @@ void Draw_Tune_Menu() {
883 885
       #endif
884 886
       DWIN_Draw_Label(MBASE(TUNE_CASE_ZOFF), GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
885 887
     #else
888
+      DWIN_Frame_TitleCopy(1, 94, 2, 126, 12);
886 889
       DWIN_Frame_AreaCopy(1, 1, 179, 92, 190, LBLX, MBASE(TUNE_CASE_SPEED));      // Print speed
887 890
       #if HAS_HOTEND
888 891
         DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX, MBASE(TUNE_CASE_TEMP));  // Hotend...
@@ -1008,6 +1011,7 @@ void Draw_Motion_Menu() {
1008 1011
 //
1009 1012
 // Draw Popup Windows
1010 1013
 //
1014
+
1011 1015
 #if HAS_HOTEND || HAS_HEATED_BED
1012 1016
 
1013 1017
   void DWIN_Popup_Temperature(const bool toohigh) {
@@ -1021,8 +1025,8 @@ void Draw_Motion_Menu() {
1021 1025
         DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
1022 1026
       }
1023 1027
       else {
1024
-        DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
1025
-        DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high"));
1028
+        DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
1029
+        DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high"));
1026 1030
       }
1027 1031
     }
1028 1032
     else {
@@ -1032,8 +1036,8 @@ void Draw_Motion_Menu() {
1032 1036
         DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
1033 1037
       }
1034 1038
       else {
1035
-        DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
1036
-        DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low"));
1039
+        DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
1040
+        DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low"));
1037 1041
       }
1038 1042
     }
1039 1043
   }
@@ -1052,11 +1056,11 @@ void Draw_Popup_Bkgd_60() {
1052 1056
     DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105);
1053 1057
     if (HMI_IsChinese()) {
1054 1058
       DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240);
1055
-      DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 102, 240);
1059
+      DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 69 + 33, 240);
1056 1060
       DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280);
1057 1061
     }
1058 1062
     else {
1059
-      DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold"));
1063
+      DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold"));
1060 1064
       DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280);
1061 1065
     }
1062 1066
   }
@@ -1073,9 +1077,9 @@ void Popup_Window_Resume() {
1073 1077
     DWIN_ICON_Show(ICON, ICON_Continue_C, 146, 307);
1074 1078
   }
1075 1079
   else {
1076
-    DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print"));
1077
-    DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last"));
1078
-    DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted."));
1080
+    DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print"));
1081
+    DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last"));
1082
+    DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted."));
1079 1083
     DWIN_ICON_Show(ICON, ICON_Cancel_E,    26, 307);
1080 1084
     DWIN_ICON_Show(ICON, ICON_Continue_E, 146, 307);
1081 1085
   }
@@ -1091,8 +1095,8 @@ void Popup_Window_Home(const bool parking/*=false*/) {
1091 1095
     DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
1092 1096
   }
1093 1097
   else {
1094
-    DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ"));
1095
-    DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
1098
+    DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ"));
1099
+    DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
1096 1100
   }
1097 1101
 }
1098 1102
 
@@ -1107,8 +1111,8 @@ void Popup_Window_Home(const bool parking/*=false*/) {
1107 1111
       DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
1108 1112
     }
1109 1113
     else {
1110
-      DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING));
1111
-      DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
1114
+      DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING));
1115
+      DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
1112 1116
     }
1113 1117
   }
1114 1118
 
@@ -1135,8 +1139,8 @@ void Popup_window_PauseOrStop() {
1135 1139
     DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280);
1136 1140
   }
1137 1141
   else {
1138
-         if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
1139
-    else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
1142
+         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));
1143
+    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));
1140 1144
     DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280);
1141 1145
     DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280);
1142 1146
   }
@@ -1160,19 +1164,19 @@ void Draw_Print_ProgressBar() {
1160 1164
   DWIN_ICON_Show(ICON, ICON_Bar, 15, 93);
1161 1165
   DWIN_Draw_Rectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, 93, 256, 113);
1162 1166
   DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, 133, _card_percent);
1163
-  DWIN_Draw_String(false, false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
1167
+  DWIN_Draw_String(false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
1164 1168
 }
1165 1169
 
1166 1170
 void Draw_Print_ProgressElapsed() {
1167 1171
   duration_t elapsed = print_job_timer.duration(); // print timer
1168 1172
   DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 42, 212, elapsed.value / 3600);
1169
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 58, 212, F(":"));
1173
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 58, 212, F(":"));
1170 1174
   DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 66, 212, (elapsed.value % 3600) / 60);
1171 1175
 }
1172 1176
 
1173 1177
 void Draw_Print_ProgressRemain() {
1174 1178
   DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 176, 212, _remain_time / 3600);
1175
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
1179
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
1176 1180
   DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 200, 212, (_remain_time % 3600) / 60);
1177 1181
 }
1178 1182
 
@@ -1189,7 +1193,7 @@ void Goto_PrintProcess() {
1189 1193
   // Copy into filebuf string before entry
1190 1194
   char * const name = card.longest_filename();
1191 1195
   const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
1192
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);
1196
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);
1193 1197
 
1194 1198
   DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 193);
1195 1199
   DWIN_ICON_Show(ICON, ICON_RemainTime, 150, 191);
@@ -1204,14 +1208,13 @@ void Goto_MainMenu() {
1204 1208
 
1205 1209
   Clear_Main_Window();
1206 1210
 
1207
-  if (HMI_IsChinese()) {
1208
-    DWIN_Frame_AreaCopy(1, 2, 2, 27, 14, 14, 9); // "Home"
1209
-  }
1211
+  if (HMI_IsChinese())
1212
+    DWIN_Frame_TitleCopy(1, 2, 2, 27, 14); // "Home"
1210 1213
   else {
1211 1214
     #ifdef USE_STRING_HEADINGS
1212 1215
       Draw_Title(GET_TEXT_F(MSG_MAIN));
1213 1216
     #else
1214
-      DWIN_Frame_AreaCopy(1, 0, 2, 39, 12, 14, 9);
1217
+      DWIN_Frame_TitleCopy(1, 0, 2, 39, 12);
1215 1218
     #endif
1216 1219
   }
1217 1220
 
@@ -1588,9 +1591,9 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y,
1588 1591
 
1589 1592
   if (force || changed || draw_qmark || draw_empty) {
1590 1593
     if (blink && draw_qmark)
1591
-      DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?"));
1594
+      DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?"));
1592 1595
     else if (blink && draw_empty)
1593
-      DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, x, y, F("     "));
1596
+      DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F("     "));
1594 1597
     else
1595 1598
       DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p * 10);
1596 1599
   }
@@ -1706,11 +1709,11 @@ void update_variable() {
1706 1709
     _offset = BABY_Z_VAR;
1707 1710
     if (BABY_Z_VAR < 0) {
1708 1711
       DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, -_offset * 100);
1709
-      DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
1712
+      DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
1710 1713
     }
1711 1714
     else {
1712 1715
       DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, _offset * 100);
1713
-      DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
1716
+      DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
1714 1717
     }
1715 1718
   }
1716 1719
 
@@ -1853,7 +1856,7 @@ void Redraw_SD_List() {
1853 1856
   }
1854 1857
   else {
1855 1858
     DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4));
1856
-    DWIN_Draw_String(false, false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media"));
1859
+    DWIN_Draw_String(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media"));
1857 1860
   }
1858 1861
 }
1859 1862
 
@@ -1911,24 +1914,24 @@ void Draw_Status_Area(const bool with_update) {
1911 1914
   #if HAS_HOTEND
1912 1915
     DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
1913 1916
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.wholeDegHotend(0));
1914
-    DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1917
+    DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1915 1918
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
1916 1919
 
1917 1920
     DWIN_ICON_Show(ICON, ICON_StepE, 112, 417);
1918 1921
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
1919
-    DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%"));
1922
+    DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%"));
1920 1923
   #endif
1921 1924
 
1922 1925
   #if HAS_HEATED_BED
1923 1926
     DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
1924 1927
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.wholeDegBed());
1925
-    DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1928
+    DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1926 1929
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
1927 1930
   #endif
1928 1931
 
1929 1932
   DWIN_ICON_Show(ICON, ICON_Speed, 113, 383);
1930 1933
   DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage);
1931
-  DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%"));
1934
+  DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%"));
1932 1935
 
1933 1936
   #if HAS_FAN
1934 1937
     DWIN_ICON_Show(ICON, ICON_FanSpeed, 187, 383);
@@ -1941,11 +1944,11 @@ void Draw_Status_Area(const bool with_update) {
1941 1944
 
1942 1945
   if (BABY_Z_VAR < 0) {
1943 1946
     DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, -BABY_Z_VAR * 100);
1944
-    DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
1947
+    DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
1945 1948
   }
1946 1949
   else {
1947 1950
     DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, BABY_Z_VAR * 100);
1948
-    DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
1951
+    DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
1949 1952
   }
1950 1953
 
1951 1954
   DWIN_Draw_Rectangle(1, Line_Color, 0, 449, DWIN_WIDTH, 451);
@@ -1969,8 +1972,8 @@ void HMI_StartFrame(const bool with_update) {
1969 1972
 void Draw_Info_Menu() {
1970 1973
   Clear_Main_Window();
1971 1974
 
1972
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE));
1973
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION));
1975
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE));
1976
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION));
1974 1977
 
1975 1978
   if (HMI_IsChinese()) {
1976 1979
     DWIN_Frame_TitleCopy(1, 30, 17, 57, 29); // "Info"
@@ -1990,7 +1993,7 @@ void Draw_Info_Menu() {
1990 1993
     DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175);
1991 1994
     DWIN_Frame_AreaCopy(1, 0, 165, 94, 175, 89, 248);
1992 1995
   }
1993
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE));
1996
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE));
1994 1997
 
1995 1998
   Draw_Back_First();
1996 1999
   LOOP_L_N(i, 3) {
@@ -4007,7 +4010,7 @@ void EachMomentUpdate() {
4007 4010
       //(void)recovery.interrupted_file_exists();
4008 4011
       char * const name = card.longest_filename();
4009 4012
       const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2;
4010
-      DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name);
4013
+      DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name);
4011 4014
       DWIN_UpdateLCD();
4012 4015
 
4013 4016
       while (recovery_flag) {
@@ -4033,7 +4036,7 @@ void EachMomentUpdate() {
4033 4036
       Goto_PrintProcess();
4034 4037
       Draw_Status_Area(true);
4035 4038
     }
4036
-  #endif
4039
+  #endif // POWER_LOSS_RECOVERY
4037 4040
 
4038 4041
   DWIN_UpdateLCD();
4039 4042
 }
@@ -4124,7 +4127,7 @@ void DWIN_CompletedLeveling() {
4124 4127
 void DWIN_StatusChanged(const char *text) {
4125 4128
   DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
4126 4129
   const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(text) * MENU_CHR_W) / 2;
4127
-  DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 2, F(text));
4130
+  DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 2, F(text));
4128 4131
   DWIN_UpdateLCD();
4129 4132
 }
4130 4133
 
@@ -4136,8 +4139,8 @@ void DWIN_StatusChanged_P(PGM_P const pstr) {
4136 4139
 
4137 4140
 // GUI extension
4138 4141
 void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode=false) {
4139
-  DWIN_Draw_String(false,true,font8x16,Select_Color,bcolor,x+4,y,F(mode ? "x" : " "));
4140
-  DWIN_Draw_Rectangle(0,color,x+2,y+2,x+17,y+17);
4142
+  DWIN_Draw_String(true, font8x16, Select_Color, bcolor, x + 4, y, F(mode ? "x" : " "));
4143
+  DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17);
4141 4144
 }
4142 4145
 
4143 4146
 #endif // DWIN_CREALITY_LCD

Marlin/src/lcd/dwin/e3v2/dwin.h → Marlin/src/lcd/e3v2/creality/dwin.h 查看文件

@@ -25,7 +25,7 @@
25 25
  * DWIN by Creality3D
26 26
  */
27 27
 
28
-#include "../dwin_lcd.h"
28
+#include "dwin_lcd.h"
29 29
 #include "rotary_encoder.h"
30 30
 #include "../../../libs/BL24CXX.h"
31 31
 
@@ -103,151 +103,6 @@ enum processID : uint8_t {
103 103
   Popup_Window
104 104
 };
105 105
 
106
-// Picture ID
107
-#define Start_Process       0
108
-#define Language_English    1
109
-#define Language_Chinese    2
110
-
111
-// ICON ID
112
-#define ICON                      0x09
113
-#define ICON_LOGO                  0
114
-#define ICON_Print_0               1
115
-#define ICON_Print_1               2
116
-#define ICON_Prepare_0             3
117
-#define ICON_Prepare_1             4
118
-#define ICON_Control_0             5
119
-#define ICON_Control_1             6
120
-#define ICON_Leveling_0            7
121
-#define ICON_Leveling_1            8
122
-#define ICON_HotendTemp            9
123
-#define ICON_BedTemp              10
124
-#define ICON_Speed                11
125
-#define ICON_Zoffset              12
126
-#define ICON_Back                 13
127
-#define ICON_File                 14
128
-#define ICON_PrintTime            15
129
-#define ICON_RemainTime           16
130
-#define ICON_Setup_0              17
131
-#define ICON_Setup_1              18
132
-#define ICON_Pause_0              19
133
-#define ICON_Pause_1              20
134
-#define ICON_Continue_0           21
135
-#define ICON_Continue_1           22
136
-#define ICON_Stop_0               23
137
-#define ICON_Stop_1               24
138
-#define ICON_Bar                  25
139
-#define ICON_More                 26
140
-
141
-#define ICON_Axis                 27
142
-#define ICON_CloseMotor           28
143
-#define ICON_Homing               29
144
-#define ICON_SetHome              30
145
-#define ICON_PLAPreheat           31
146
-#define ICON_ABSPreheat           32
147
-#define ICON_Cool                 33
148
-#define ICON_Language             34
149
-
150
-#define ICON_MoveX                35
151
-#define ICON_MoveY                36
152
-#define ICON_MoveZ                37
153
-#define ICON_Extruder             38
154
-
155
-#define ICON_Temperature          40
156
-#define ICON_Motion               41
157
-#define ICON_WriteEEPROM          42
158
-#define ICON_ReadEEPROM           43
159
-#define ICON_ResumeEEPROM         44
160
-#define ICON_Info                 45
161
-
162
-#define ICON_SetEndTemp           46
163
-#define ICON_SetBedTemp           47
164
-#define ICON_FanSpeed             48
165
-#define ICON_SetPLAPreheat        49
166
-#define ICON_SetABSPreheat        50
167
-
168
-#define ICON_MaxSpeed             51
169
-#define ICON_MaxAccelerated       52
170
-#define ICON_MaxJerk              53
171
-#define ICON_Step                 54
172
-#define ICON_PrintSize            55
173
-#define ICON_Version              56
174
-#define ICON_Contact              57
175
-#define ICON_StockConfiguraton    58
176
-#define ICON_MaxSpeedX            59
177
-#define ICON_MaxSpeedY            60
178
-#define ICON_MaxSpeedZ            61
179
-#define ICON_MaxSpeedE            62
180
-#define ICON_MaxAccX              63
181
-#define ICON_MaxAccY              64
182
-#define ICON_MaxAccZ              65
183
-#define ICON_MaxAccE              66
184
-#define ICON_MaxSpeedJerkX        67
185
-#define ICON_MaxSpeedJerkY        68
186
-#define ICON_MaxSpeedJerkZ        69
187
-#define ICON_MaxSpeedJerkE        70
188
-#define ICON_StepX                71
189
-#define ICON_StepY                72
190
-#define ICON_StepZ                73
191
-#define ICON_StepE                74
192
-#define ICON_Setspeed             75
193
-#define ICON_SetZOffset           76
194
-#define ICON_Rectangle            77
195
-#define ICON_BLTouch              78
196
-#define ICON_TempTooLow           79
197
-#define ICON_AutoLeveling         80
198
-#define ICON_TempTooHigh          81
199
-#define ICON_NoTips_C             82
200
-#define ICON_NoTips_E             83
201
-#define ICON_Continue_C           84
202
-#define ICON_Continue_E           85
203
-#define ICON_Cancel_C             86
204
-#define ICON_Cancel_E             87
205
-#define ICON_Confirm_C            88
206
-#define ICON_Confirm_E            89
207
-#define ICON_Info_0               90
208
-#define ICON_Info_1               91
209
-
210
-#define ICON_AdvSet               ICON_Language
211
-#define ICON_HomeOff              ICON_AdvSet
212
-#define ICON_HomeOffX             ICON_StepX
213
-#define ICON_HomeOffY             ICON_StepY
214
-#define ICON_HomeOffZ             ICON_StepZ
215
-#define ICON_ProbeOff             ICON_AdvSet
216
-#define ICON_ProbeOffX            ICON_StepX
217
-#define ICON_ProbeOffY            ICON_StepY
218
-#define ICON_PIDNozzle            ICON_SetEndTemp
219
-#define ICON_PIDbed               ICON_SetBedTemp
220
-
221
-/**
222
- * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
223
- * 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28
224
- * 0x05=16*32  0x06=20*40  0x07=24*48  0x08=28*56  0x09=32*64
225
- */
226
-#define font6x12  0x00
227
-#define font8x16  0x01
228
-#define font10x20 0x02
229
-#define font12x24 0x03
230
-#define font14x28 0x04
231
-#define font16x32 0x05
232
-#define font20x40 0x06
233
-#define font24x48 0x07
234
-#define font28x56 0x08
235
-#define font32x64 0x09
236
-
237
-// Color
238
-#define Color_White       0xFFFF
239
-#define Color_Yellow      0xFF0F
240
-#define Color_Bg_Window   0x31E8  // Popup background color
241
-#define Color_Bg_Blue     0x1125  // Dark blue background color
242
-#define Color_Bg_Black    0x0841  // Black background color
243
-#define Color_Bg_Red      0xF00F  // Red background color
244
-#define Popup_Text_Color  0xD6BA  // Popup font background color
245
-#define Line_Color        0x3A6A  // Split line color
246
-#define Rectangle_Color   0xEE2F  // Blue square cursor color
247
-#define Percent_Color     0xFE29  // Percentage color
248
-#define BarFill_Color     0x10E4  // Fill color of progress bar
249
-#define Select_Color      0x33BB  // Selected color
250
-
251 106
 extern uint8_t checkkey;
252 107
 extern float zprobe_zoffset;
253 108
 extern char print_filename[16];

Marlin/src/lcd/dwin/dwin_lcd.cpp → Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp 查看文件

@@ -21,24 +21,24 @@
21 21
  */
22 22
 
23 23
 /********************************************************************************
24
- * @file     dwin_lcd.cpp
24
+ * @file     lcd/e3v2/creality/dwin_lcd.cpp
25 25
  * @author   LEO / Creality3D
26 26
  * @date     2019/07/18
27 27
  * @version  2.0.1
28 28
  * @brief    DWIN screen control functions
29 29
  ********************************************************************************/
30 30
 
31
-#include "../../inc/MarlinConfigPre.h"
31
+#include "../../../inc/MarlinConfigPre.h"
32 32
 
33 33
 #if ENABLED(DWIN_CREALITY_LCD)
34 34
 
35
-#include "../../inc/MarlinConfig.h"
35
+#include "../../../inc/MarlinConfig.h"
36 36
 
37 37
 #include "dwin_lcd.h"
38 38
 #include <string.h> // for memset
39 39
 
40 40
 //#define DEBUG_OUT 1
41
-#include "../../core/debug_out.h"
41
+#include "../../../core/debug_out.h"
42 42
 
43 43
 // Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail.
44 44
 // Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters.
@@ -122,6 +122,17 @@ bool DWIN_Handshake(void) {
122 122
         && databuf[3] == 'K' );
123 123
 }
124 124
 
125
+void DWIN_Startup(void) {
126
+  DEBUG_ECHOPGM("\r\nDWIN handshake ");
127
+  delay(750);   // Delay here or init later in the boot process
128
+  if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
129
+  DWIN_Frame_SetDir(1);
130
+  #if DISABLED(SHOW_BOOTSCREEN)
131
+    DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
132
+  #endif
133
+  DWIN_UpdateLCD();
134
+}
135
+
125 136
 // Set the backlight luminance
126 137
 //  luminance: (0x00-0xFF)
127 138
 void DWIN_Backlight_SetLuminance(const uint8_t luminance) {
@@ -164,9 +175,10 @@ void DWIN_Frame_Clear(const uint16_t color) {
164 175
 //  width: point width   0x01-0x0F
165 176
 //  height: point height 0x01-0x0F
166 177
 //  x,y: upper left point
167
-void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
178
+void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
168 179
   size_t i = 0;
169 180
   DWIN_Byte(i, 0x02);
181
+  DWIN_Word(i, color);
170 182
   DWIN_Byte(i, width);
171 183
   DWIN_Byte(i, height);
172 184
   DWIN_Word(i, x);
@@ -238,8 +250,8 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
238 250
 //  bColor: Background color
239 251
 //  x/y: Upper-left coordinate of the string
240 252
 //  *string: The string
241
-void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
242
-                      uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
253
+void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
254
+  uint8_t widthAdjust = 0;
243 255
   size_t i = 0;
244 256
   DWIN_Byte(i, 0x11);
245 257
   // Bit 7: widthAdjust
@@ -356,6 +368,7 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
356 368
   DWIN_Word(i, x);
357 369
   DWIN_Word(i, y);
358 370
   DWIN_Byte(i, 0x80 | libID);
371
+  //DWIN_Byte(i, libID);
359 372
   DWIN_Byte(i, picID);
360 373
   DWIN_Send(i);
361 374
 }
@@ -421,7 +434,7 @@ void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t pi
421 434
 //  state: 16 bits, each bit is the state of an animation id
422 435
 void DWIN_ICON_AnimationControl(uint16_t state) {
423 436
   size_t i = 0;
424
-  DWIN_Byte(i, 0x28);
437
+  DWIN_Byte(i, 0x29);
425 438
   DWIN_Word(i, state);
426 439
   DWIN_Send(i);
427 440
 }

Marlin/src/lcd/dwin/dwin_lcd.h → Marlin/src/lcd/e3v2/creality/dwin_lcd.h 查看文件

@@ -42,6 +42,163 @@
42 42
 #define DWIN_WIDTH  272
43 43
 #define DWIN_HEIGHT 480
44 44
 
45
+// Character matrix width x height
46
+//#define LCD_WIDTH ((DWIN_WIDTH) / 8)
47
+//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12)
48
+
49
+// Picture ID
50
+#define DWIN_Boot_Screen    0
51
+#define Language_English    1
52
+#define Language_Chinese    2
53
+
54
+// ICON ID
55
+#define ICON                      0x09
56
+
57
+#define ICON_LOGO                  0
58
+#define ICON_Print_0               1
59
+#define ICON_Print_1               2
60
+#define ICON_Prepare_0             3
61
+#define ICON_Prepare_1             4
62
+#define ICON_Control_0             5
63
+#define ICON_Control_1             6
64
+#define ICON_Leveling_0            7
65
+#define ICON_Leveling_1            8
66
+#define ICON_HotendTemp            9
67
+#define ICON_BedTemp              10
68
+#define ICON_Speed                11
69
+#define ICON_Zoffset              12
70
+#define ICON_Back                 13
71
+#define ICON_File                 14
72
+#define ICON_PrintTime            15
73
+#define ICON_RemainTime           16
74
+#define ICON_Setup_0              17
75
+#define ICON_Setup_1              18
76
+#define ICON_Pause_0              19
77
+#define ICON_Pause_1              20
78
+#define ICON_Continue_0           21
79
+#define ICON_Continue_1           22
80
+#define ICON_Stop_0               23
81
+#define ICON_Stop_1               24
82
+#define ICON_Bar                  25
83
+#define ICON_More                 26
84
+
85
+#define ICON_Axis                 27
86
+#define ICON_CloseMotor           28
87
+#define ICON_Homing               29
88
+#define ICON_SetHome              30
89
+#define ICON_PLAPreheat           31
90
+#define ICON_ABSPreheat           32
91
+#define ICON_Cool                 33
92
+#define ICON_Language             34
93
+
94
+#define ICON_MoveX                35
95
+#define ICON_MoveY                36
96
+#define ICON_MoveZ                37
97
+#define ICON_Extruder             38
98
+
99
+#define ICON_Temperature          40
100
+#define ICON_Motion               41
101
+#define ICON_WriteEEPROM          42
102
+#define ICON_ReadEEPROM           43
103
+#define ICON_ResumeEEPROM         44
104
+#define ICON_Info                 45
105
+
106
+#define ICON_SetEndTemp           46
107
+#define ICON_SetBedTemp           47
108
+#define ICON_FanSpeed             48
109
+#define ICON_SetPLAPreheat        49
110
+#define ICON_SetABSPreheat        50
111
+
112
+#define ICON_MaxSpeed             51
113
+#define ICON_MaxAccelerated       52
114
+#define ICON_MaxJerk              53
115
+#define ICON_Step                 54
116
+#define ICON_PrintSize            55
117
+#define ICON_Version              56
118
+#define ICON_Contact              57
119
+#define ICON_StockConfiguraton    58
120
+#define ICON_MaxSpeedX            59
121
+#define ICON_MaxSpeedY            60
122
+#define ICON_MaxSpeedZ            61
123
+#define ICON_MaxSpeedE            62
124
+#define ICON_MaxAccX              63
125
+#define ICON_MaxAccY              64
126
+#define ICON_MaxAccZ              65
127
+#define ICON_MaxAccE              66
128
+#define ICON_MaxSpeedJerkX        67
129
+#define ICON_MaxSpeedJerkY        68
130
+#define ICON_MaxSpeedJerkZ        69
131
+#define ICON_MaxSpeedJerkE        70
132
+#define ICON_StepX                71
133
+#define ICON_StepY                72
134
+#define ICON_StepZ                73
135
+#define ICON_StepE                74
136
+#define ICON_Setspeed             75
137
+#define ICON_SetZOffset           76
138
+#define ICON_Rectangle            77
139
+#define ICON_BLTouch              78
140
+#define ICON_TempTooLow           79
141
+#define ICON_AutoLeveling         80
142
+#define ICON_TempTooHigh          81
143
+#define ICON_NoTips_C             82
144
+#define ICON_NoTips_E             83
145
+#define ICON_Continue_C           84
146
+#define ICON_Continue_E           85
147
+#define ICON_Cancel_C             86
148
+#define ICON_Cancel_E             87
149
+#define ICON_Confirm_C            88
150
+#define ICON_Confirm_E            89
151
+#define ICON_Info_0               90
152
+#define ICON_Info_1               91
153
+
154
+#define ICON_AdvSet               ICON_Language
155
+#define ICON_HomeOff              ICON_AdvSet
156
+#define ICON_HomeOffX             ICON_StepX
157
+#define ICON_HomeOffY             ICON_StepY
158
+#define ICON_HomeOffZ             ICON_StepZ
159
+#define ICON_ProbeOff             ICON_AdvSet
160
+#define ICON_ProbeOffX            ICON_StepX
161
+#define ICON_ProbeOffY            ICON_StepY
162
+#define ICON_PIDNozzle            ICON_SetEndTemp
163
+#define ICON_PIDbed               ICON_SetBedTemp
164
+
165
+/**
166
+ * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
167
+ * 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28
168
+ * 0x05=16*32  0x06=20*40  0x07=24*48  0x08=28*56  0x09=32*64
169
+ */
170
+#define font6x12  0x00
171
+#define font8x16  0x01
172
+#define font10x20 0x02
173
+#define font12x24 0x03
174
+#define font14x28 0x04
175
+#define font16x32 0x05
176
+#define font20x40 0x06
177
+#define font24x48 0x07
178
+#define font28x56 0x08
179
+#define font32x64 0x09
180
+
181
+#define DWIN_FONT_MENU  font10x20
182
+#define DWIN_FONT_STAT  font10x20
183
+#define DWIN_FONT_HEAD  font10x20
184
+#define DWIN_FONT_ALERT font14x28
185
+
186
+// Color
187
+#define Color_White       0xFFFF
188
+#define Color_Yellow      0xFF0F
189
+#define Color_Error_Red   0xB000  // Error!
190
+#define Color_Bg_Red      0xF00F  // Red background color
191
+#define Color_Bg_Window   0x31E8  // Popup background color
192
+#define Color_Bg_Blue     0x1125  // Dark blue background color
193
+#define Color_Bg_Black    0x0841  // Black background color
194
+#define Color_IconBlue    0x45FA  // Lighter blue that matches icons/accents
195
+#define Popup_Text_Color  0xD6BA  // Popup font background color
196
+#define Line_Color        0x3A6A  // Split line color
197
+#define Rectangle_Color   0xEE2F  // Blue square cursor color
198
+#define Percent_Color     0xFE29  // Percentage color
199
+#define BarFill_Color     0x10E4  // Fill color of progress bar
200
+#define Select_Color      0x33BB  // Selected color
201
+
45 202
 /*-------------------------------------- System variable function --------------------------------------*/
46 203
 
47 204
 // Handshake (1: Success, 0: Fail)
@@ -68,10 +225,11 @@ void DWIN_UpdateLCD(void);
68 225
 void DWIN_Frame_Clear(const uint16_t color);
69 226
 
70 227
 // Draw a point
228
+//  color: point color
71 229
 //  width: point width   0x01-0x0F
72 230
 //  height: point height 0x01-0x0F
73 231
 //  x,y: upper left point
74
-void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y);
232
+void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y);
75 233
 
76 234
 // Draw a line
77 235
 //  color: Line segment color
@@ -125,20 +283,18 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
125 283
 /*---------------------------------------- Text related functions ----------------------------------------*/
126 284
 
127 285
 // Draw a string
128
-//  widthAdjust: true=self-adjust character width; false=no adjustment
129 286
 //  bShow: true=display background color; false=don't display background color
130 287
 //  size: Font size
131 288
 //  color: Character color
132 289
 //  bColor: Background color
133 290
 //  x/y: Upper-left coordinate of the string
134 291
 //  *string: The string
135
-void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
136
-                      uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
292
+void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
137 293
 
138 294
 class __FlashStringHelper;
139 295
 
140
-inline void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
141
-  DWIN_Draw_String(widthAdjust, bShow, size, color, bColor, x, y, (char *)title);
296
+inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
297
+  DWIN_Draw_String(bShow, size, color, bColor, x, y, (char *)title);
142 298
 }
143 299
 
144 300
 // Draw a positive integer

Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp → Marlin/src/lcd/e3v2/creality/rotary_encoder.cpp 查看文件

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 /*****************************************************************************
24
- * @file     rotary_encoder.cpp
24
+ * @file     lcd/e3v2/creality/rotary_encoder.cpp
25 25
  * @author   LEO / Creality3D
26 26
  * @date     2019/07/06
27 27
  * @version  2.0.1

Marlin/src/lcd/dwin/e3v2/rotary_encoder.h → Marlin/src/lcd/e3v2/creality/rotary_encoder.h 查看文件

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 /*****************************************************************************
25
-  * @file     rotary_encoder.h
25
+  * @file     lcd/e3v2/creality/rotary_encoder.h
26 26
   * @author   LEO / Creality3D
27 27
   * @date     2019/07/06
28 28
   * @version  2.0.1

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/lock_screen.h 查看文件

@@ -44,8 +44,8 @@ class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
44 44
     static void enable();
45 45
     static void disable();
46 46
 
47
-    static void set_hash(uint16_t pass) {passcode = pass;};
48
-    static uint16_t get_hash() {return passcode;};
47
+    static void set_hash(uint16_t pass) { passcode = pass; }
48
+    static uint16_t get_hash() { return passcode; }
49 49
 
50 50
     static void onEntry();
51 51
     static void onRedraw(draw_mode_t);

+ 1
- 1
Marlin/src/lcd/fontutils.cpp 查看文件

@@ -149,7 +149,7 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
149 149
 static inline uint8_t utf8_strlen_cb(const char *pstart, read_byte_cb_t cb_read_byte) {
150 150
   uint8_t cnt = 0;
151 151
   uint8_t *p = (uint8_t *)pstart;
152
-  for (;;) {
152
+  if (p) for (;;) {
153 153
     const uint8_t b = cb_read_byte(p);
154 154
     if (!b) break;
155 155
     if (utf8_is_start_byte_of_char(b)) cnt++;

+ 9
- 3
Marlin/src/lcd/lcdprint.h 查看文件

@@ -76,8 +76,10 @@
76 76
   #define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
77 77
   #define INFO_FONT_WIDTH   6
78 78
 
79
+  // Graphical LCD uses the menu font size for cursor positioning
79 80
   #define LCD_COL_X(col) ((    (col)) * (MENU_FONT_WIDTH))
80
-  #define LCD_ROW_Y(row) ((1 + (row)) * (MENU_FONT_HEIGHT))
81
+  #define LCD_ROW_Y(row) ((1 + (row)) * (MENU_LINE_HEIGHT))
82
+  #define LCD_COL_X_RJ(len) (LCD_WIDTH - LCD_COL_X(len))
81 83
 
82 84
 #else
83 85
 
@@ -94,13 +96,17 @@
94 96
   #define LCD_PIXEL_WIDTH   LCD_WIDTH
95 97
   #define LCD_PIXEL_HEIGHT  LCD_HEIGHT
96 98
 
99
+  // Character LCD uses direct cursor positioning
97 100
   #define LCD_COL_X(col) (col)
98 101
   #define LCD_ROW_Y(row) (row)
102
+  #define LCD_COL_X_RJ(len) (LCD_PIXEL_WIDTH - LCD_COL_X(len))
99 103
 
100 104
 #endif
101 105
 
102
-#define LCD_COL_X_RJ(len)      (LCD_PIXEL_WIDTH - LCD_COL_X(len))
103
-#define LCD_BOTTOM_ROW         (LCD_PIXEL_HEIGHT - 1)
106
+#ifndef MENU_LINE_HEIGHT
107
+  #define MENU_LINE_HEIGHT MENU_FONT_HEIGHT
108
+#endif
109
+
104 110
 #define SETCURSOR(col, row)    lcd_moveto(LCD_COL_X(col), LCD_ROW_Y(row))
105 111
 #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_COL_X_RJ(len), LCD_ROW_Y(row))
106 112
 #define SETCURSOR_X(col)       SETCURSOR(col, _lcdLineNr)

+ 3
- 10
Marlin/src/lcd/marlinui.cpp 查看文件

@@ -47,7 +47,7 @@ MarlinUI ui;
47 47
 #endif
48 48
 
49 49
 #if ENABLED(DWIN_CREALITY_LCD)
50
-  #include "dwin/e3v2/dwin.h"
50
+  #include "e3v2/creality/dwin.h"
51 51
 #endif
52 52
 
53 53
 #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
@@ -65,15 +65,8 @@ MarlinUI ui;
65 65
 constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
66 66
 
67 67
 #if HAS_STATUS_MESSAGE
68
-  #if HAS_WIRED_LCD
69
-    #if ENABLED(STATUS_MESSAGE_SCROLLING)
70
-      uint8_t MarlinUI::status_scroll_offset; // = 0
71
-      constexpr uint8_t MAX_MESSAGE_LENGTH = _MAX(LONG_FILENAME_LENGTH, MAX_LANG_CHARSIZE * 2 * (LCD_WIDTH));
72
-    #else
73
-      constexpr uint8_t MAX_MESSAGE_LENGTH = MAX_LANG_CHARSIZE * (LCD_WIDTH);
74
-    #endif
75
-  #else
76
-    constexpr uint8_t MAX_MESSAGE_LENGTH = 63;
68
+  #if BOTH(HAS_WIRED_LCD, STATUS_MESSAGE_SCROLLING)
69
+    uint8_t MarlinUI::status_scroll_offset; // = 0
77 70
   #endif
78 71
   char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
79 72
   uint8_t MarlinUI::alert_level; // = 0

+ 11
- 0
Marlin/src/lcd/marlinui.h 查看文件

@@ -296,6 +296,17 @@ public:
296 296
   #endif
297 297
 
298 298
   #if HAS_STATUS_MESSAGE
299
+
300
+    #if HAS_WIRED_LCD
301
+      #if ENABLED(STATUS_MESSAGE_SCROLLING)
302
+        #define MAX_MESSAGE_LENGTH _MAX(LONG_FILENAME_LENGTH, MAX_LANG_CHARSIZE * 2 * (LCD_WIDTH))
303
+      #else
304
+        #define MAX_MESSAGE_LENGTH (MAX_LANG_CHARSIZE * (LCD_WIDTH))
305
+      #endif
306
+    #else
307
+      #define MAX_MESSAGE_LENGTH 63
308
+    #endif
309
+
299 310
     static char status_message[];
300 311
     static uint8_t alert_level; // Higher levels block lower levels
301 312
 

+ 1
- 1
Marlin/src/lcd/menu/menu_bed_corners.cpp 查看文件

@@ -187,7 +187,7 @@ static void _lcd_level_bed_corners_get_next_position() {
187 187
     }
188 188
 
189 189
     --cy;
190
-    y -= MENU_FONT_HEIGHT;
190
+    y -= MENU_LINE_HEIGHT;
191 191
 
192 192
     // Display the Last Z value
193 193
     if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {

+ 1
- 1
Marlin/src/module/temperature.cpp 查看文件

@@ -46,7 +46,7 @@
46 46
 #endif
47 47
 
48 48
 #if ENABLED(DWIN_CREALITY_LCD)
49
-  #include "../lcd/dwin/e3v2/dwin.h"
49
+  #include "../lcd/e3v2/creality/dwin.h"
50 50
 #endif
51 51
 
52 52
 #if ENABLED(EXTENSIBLE_UI)

+ 1
- 1
Marlin/src/sd/cardreader.cpp 查看文件

@@ -32,7 +32,7 @@
32 32
 #include "../lcd/marlinui.h"
33 33
 
34 34
 #if ENABLED(DWIN_CREALITY_LCD)
35
-  #include "../lcd/dwin/e3v2/dwin.h"
35
+  #include "../lcd/e3v2/creality/dwin.h"
36 36
 #endif
37 37
 
38 38
 #include "../module/planner.h"        // for synchronize

+ 1
- 1
ini/features.ini 查看文件

@@ -44,8 +44,8 @@ HAS_SPI_TFT                            = src_filter=+<src/HAL/STM32/tft/tft_spi.
44 44
 I2C_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
45 45
 SOFT_I2C_EEPROM                        = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/master.zip
46 46
 SPI_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
47
+DWIN_CREALITY_LCD                      = src_filter=+<src/lcd/e3v2/creality>
47 48
 HAS_GRAPHICAL_TFT                      = src_filter=+<src/lcd/tft>
48
-DWIN_CREALITY_LCD                      = src_filter=+<src/lcd/dwin>
49 49
 IS_TFTGLCD_PANEL                       = src_filter=+<src/lcd/TFTGLCD>
50 50
 HAS_TOUCH_BUTTONS                      = src_filter=+<src/lcd/touch/touch_buttons.cpp>
51 51
 HAS_LCD_MENU                           = src_filter=+<src/lcd/menu>

+ 1
- 1
platformio.ini 查看文件

@@ -48,7 +48,7 @@ extra_scripts      =
48 48
   post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py
49 49
 lib_deps           =
50 50
 default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
51
-  -<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dwin> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
51
+  -<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/e3v2/creality> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
52 52
   -<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>
53 53
   -<src/lcd/menu>
54 54
   -<src/lcd/menu/game/game.cpp> -<src/lcd/menu/game/brickout.cpp> -<src/lcd/menu/game/invaders.cpp>

正在加载...
取消
保存