소스 검색

🚸 Update Ender3 V2/S1 Pro UI (#23878)

Miguel Risco-Castillo 2 년 전
부모
커밋
79b38e0e14
No account linked to committer's email address
40개의 변경된 파일1574개의 추가작업 그리고 1208개의 파일을 삭제
  1. 2
    6
      Marlin/src/MarlinCore.cpp
  2. 2
    1
      Marlin/src/feature/pause.cpp
  3. 2
    0
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  4. 5
    0
      Marlin/src/gcode/config/M302.cpp
  5. 16
    4
      Marlin/src/gcode/sd/M524.cpp
  6. 2
    1
      Marlin/src/gcode/stats/M75-M78.cpp
  7. 4
    1
      Marlin/src/inc/Conditionals_LCD.h
  8. 20
    0
      Marlin/src/lcd/e3v2/common/encoder.h
  9. 7
    18
      Marlin/src/lcd/e3v2/creality/dwin.cpp
  10. 1
    0
      Marlin/src/lcd/e3v2/creality/dwin.h
  11. 542
    898
      Marlin/src/lcd/e3v2/proui/dwin.cpp
  12. 37
    61
      Marlin/src/lcd/e3v2/proui/dwin.h
  13. 35
    8
      Marlin/src/lcd/e3v2/proui/dwin_defines.h
  14. 51
    5
      Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp
  15. 21
    5
      Marlin/src/lcd/e3v2/proui/dwin_lcd.h
  16. 46
    14
      Marlin/src/lcd/e3v2/proui/dwin_popup.cpp
  17. 15
    12
      Marlin/src/lcd/e3v2/proui/dwin_popup.h
  18. 61
    58
      Marlin/src/lcd/e3v2/proui/dwinui.cpp
  19. 98
    28
      Marlin/src/lcd/e3v2/proui/dwinui.h
  20. 4
    7
      Marlin/src/lcd/e3v2/proui/endstop_diag.cpp
  21. 3
    5
      Marlin/src/lcd/e3v2/proui/endstop_diag.h
  22. 1
    3
      Marlin/src/lcd/e3v2/proui/lockscreen.cpp
  23. 1
    3
      Marlin/src/lcd/e3v2/proui/lockscreen.h
  24. 370
    0
      Marlin/src/lcd/e3v2/proui/menus.cpp
  25. 94
    0
      Marlin/src/lcd/e3v2/proui/menus.h
  26. 42
    26
      Marlin/src/lcd/e3v2/proui/meshviewer.cpp
  27. 11
    6
      Marlin/src/lcd/e3v2/proui/meshviewer.h
  28. 10
    6
      Marlin/src/lcd/e3v2/proui/printstats.cpp
  29. 6
    6
      Marlin/src/lcd/e3v2/proui/printstats.h
  30. 5
    1
      Marlin/src/lcd/language/language_en.h
  31. 4
    3
      Marlin/src/lcd/marlinui.cpp
  32. 5
    9
      Marlin/src/lcd/marlinui.h
  33. 5
    3
      Marlin/src/module/settings.cpp
  34. 3
    0
      Marlin/src/module/stepper.cpp
  35. 1
    1
      Marlin/src/module/temperature.cpp
  36. 1
    1
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h
  37. 24
    2
      Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h
  38. 7
    4
      Marlin/src/sd/cardreader.cpp
  39. 7
    0
      Marlin/src/sd/cardreader.h
  40. 3
    2
      buildroot/tests/STM32F103RE_creality

+ 2
- 6
Marlin/src/MarlinCore.cpp 파일 보기

822
   TERN_(USE_BEEPER, buzzer.tick());
822
   TERN_(USE_BEEPER, buzzer.tick());
823
 
823
 
824
   // Handle UI input / draw events
824
   // Handle UI input / draw events
825
-  TERN(HAS_DWIN_E3V2_BASIC, DWIN_Update(), ui.update());
825
+  TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
826
 
826
 
827
   // Run i2c Position Encoders
827
   // Run i2c Position Encoders
828
   #if ENABLED(I2C_POSITION_ENCODERS)
828
   #if ENABLED(I2C_POSITION_ENCODERS)
1571
   #endif
1571
   #endif
1572
 
1572
 
1573
   #if HAS_DWIN_E3V2_BASIC
1573
   #if HAS_DWIN_E3V2_BASIC
1574
-    SETUP_LOG("E3V2 Init");
1575
-    Encoder_Configuration();
1576
-    HMI_Init();
1577
-    HMI_SetLanguageCache();
1578
-    HMI_StartFrame(true);
1574
+    SETUP_RUN(DWIN_InitScreen());
1579
   #endif
1575
   #endif
1580
 
1576
 
1581
   #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
1577
   #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC

+ 2
- 1
Marlin/src/feature/pause.cpp 파일 보기

407
   #endif
407
   #endif
408
 
408
 
409
   TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
409
   TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
410
+  TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
410
 
411
 
411
   // Indicate that the printer is paused
412
   // Indicate that the printer is paused
412
   ++did_pause_print;
413
   ++did_pause_print;
709
 
710
 
710
   TERN_(HAS_FILAMENT_SENSOR, runout.reset());
711
   TERN_(HAS_FILAMENT_SENSOR, runout.reset());
711
 
712
 
712
-  TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
713
+  TERN(DWIN_LCD_PROUI, DWIN_Print_Resume(), ui.reset_status());
713
   TERN_(HAS_MARLINUI_MENU, ui.return_to_status());
714
   TERN_(HAS_MARLINUI_MENU, ui.return_to_status());
714
   TERN_(DWIN_LCD_PROUI, HMI_ReturnScreen());
715
   TERN_(DWIN_LCD_PROUI, HMI_ReturnScreen());
715
 }
716
 }

+ 2
- 0
Marlin/src/gcode/bedlevel/mbl/G29.cpp 파일 보기

105
       if (!ui.wait_for_move) {
105
       if (!ui.wait_for_move) {
106
         queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
106
         queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
107
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
107
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
108
+        TERN_(DWIN_LCD_PROUI, DWIN_MeshLevelingStart());
108
         return;
109
         return;
109
       }
110
       }
110
       state = MeshNext;
111
       state = MeshNext;
127
         // Save Z for the previous mesh position
128
         // Save Z for the previous mesh position
128
         mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
129
         mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
129
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
130
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
131
+        TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z));
130
         SET_SOFT_ENDSTOP_LOOSE(false);
132
         SET_SOFT_ENDSTOP_LOOSE(false);
131
       }
133
       }
132
       // If there's another point to sample, move there with optional lift.
134
       // If there's another point to sample, move there with optional lift.

+ 5
- 0
Marlin/src/gcode/config/M302.cpp 파일 보기

27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../module/temperature.h"
28
 #include "../../module/temperature.h"
29
 
29
 
30
+#if ENABLED(DWIN_LCD_PROUI)
31
+  #include "../../lcd/e3v2/proui/dwin_defines.h"
32
+#endif
33
+
30
 /**
34
 /**
31
  * M302: Allow cold extrudes, or set the minimum extrude temperature
35
  * M302: Allow cold extrudes, or set the minimum extrude temperature
32
  *
36
  *
47
   if (seen_S) {
51
   if (seen_S) {
48
     thermalManager.extrude_min_temp = parser.value_celsius();
52
     thermalManager.extrude_min_temp = parser.value_celsius();
49
     thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
53
     thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
54
+    TERN_(DWIN_LCD_PROUI, HMI_data.ExtMinT = thermalManager.extrude_min_temp);
50
   }
55
   }
51
 
56
 
52
   if (parser.seen('P'))
57
   if (parser.seen('P'))

+ 16
- 4
Marlin/src/gcode/sd/M524.cpp 파일 보기

27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../sd/cardreader.h"
28
 #include "../../sd/cardreader.h"
29
 
29
 
30
+#if ENABLED(DWIN_LCD_PROUI)
31
+  #include "../../lcd/e3v2/proui/dwin.h"
32
+#endif
33
+
30
 /**
34
 /**
31
  * M524: Abort the current SD print job (started with M24)
35
  * M524: Abort the current SD print job (started with M24)
32
  */
36
  */
33
 void GcodeSuite::M524() {
37
 void GcodeSuite::M524() {
34
 
38
 
35
-  if (IS_SD_PRINTING())
36
-    card.abortFilePrintSoon();
37
-  else if (card.isMounted())
38
-    card.closefile();
39
+  #if ENABLED(DWIN_LCD_PROUI)
40
+
41
+    HMI_flag.abort_flag = true;    // The LCD will handle it
42
+
43
+  #else
44
+
45
+    if (IS_SD_PRINTING())
46
+      card.abortFilePrintSoon();
47
+    else if (card.isMounted())
48
+      card.closefile();
49
+
50
+  #endif
39
 
51
 
40
 }
52
 }
41
 
53
 

+ 2
- 1
Marlin/src/gcode/stats/M75-M78.cpp 파일 보기

39
 void GcodeSuite::M75() {
39
 void GcodeSuite::M75() {
40
   startOrResumeJob();
40
   startOrResumeJob();
41
   #if ENABLED(DWIN_LCD_PROUI)
41
   #if ENABLED(DWIN_LCD_PROUI)
42
-    DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
43
     DWIN_Print_Started(false);
42
     DWIN_Print_Started(false);
43
+    if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
44
   #endif
44
   #endif
45
 }
45
 }
46
 
46
 
50
 void GcodeSuite::M76() {
50
 void GcodeSuite::M76() {
51
   print_job_timer.pause();
51
   print_job_timer.pause();
52
   TERN_(HOST_PAUSE_M76, hostui.pause());
52
   TERN_(HOST_PAUSE_M76, hostui.pause());
53
+  TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
53
 }
54
 }
54
 
55
 
55
 /**
56
 /**

+ 4
- 1
Marlin/src/inc/Conditionals_LCD.h 파일 보기

479
 #if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
479
 #if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
480
   #define HAS_DWIN_E3V2 1
480
   #define HAS_DWIN_E3V2 1
481
 #endif
481
 #endif
482
+#if ENABLED(DWIN_LCD_PROUI)
483
+  #define DO_LIST_BIN_FILES 1
484
+#endif
482
 
485
 
483
 // E3V2 extras
486
 // E3V2 extras
484
 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
487
 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
513
   #endif
516
   #endif
514
 #endif
517
 #endif
515
 
518
 
516
-#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI)
519
+#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
517
   #define HAS_DISPLAY 1
520
   #define HAS_DISPLAY 1
518
 #endif
521
 #endif
519
 
522
 

+ 20
- 0
Marlin/src/lcd/e3v2/common/encoder.h 파일 보기

45
   ENCODER_DIFF_ENTER = 3   // click
45
   ENCODER_DIFF_ENTER = 3   // click
46
 } EncoderState;
46
 } EncoderState;
47
 
47
 
48
+#define ENCODER_WAIT_MS 20
49
+
48
 // Encoder initialization
50
 // Encoder initialization
49
 void Encoder_Configuration();
51
 void Encoder_Configuration();
50
 
52
 
51
 // Analyze encoder value and return state
53
 // Analyze encoder value and return state
52
 EncoderState Encoder_ReceiveAnalyze();
54
 EncoderState Encoder_ReceiveAnalyze();
53
 
55
 
56
+inline EncoderState get_encoder_state() {
57
+  static millis_t Encoder_ms = 0;
58
+  const millis_t ms = millis();
59
+  if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
60
+  const EncoderState state = Encoder_ReceiveAnalyze();
61
+  if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS;
62
+  return state;
63
+}
64
+
65
+template<typename T>
66
+inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) {
67
+  if (encoder_diffState == ENCODER_DIFF_CW)
68
+    valref += EncoderRate.encoderMoveValue;
69
+  else if (encoder_diffState == ENCODER_DIFF_CCW)
70
+    valref -= EncoderRate.encoderMoveValue;
71
+  return encoder_diffState == ENCODER_DIFF_ENTER;
72
+}
73
+
54
 /*********************** Encoder LED ***********************/
74
 /*********************** Encoder LED ***********************/
55
 
75
 
56
 #if PIN_EXISTS(LCD_LED)
76
 #if PIN_EXISTS(LCD_LED)

+ 7
- 18
Marlin/src/lcd/e3v2/creality/dwin.cpp 파일 보기

471
   if (is_sel) Draw_Menu_Cursor(0);
471
   if (is_sel) Draw_Menu_Cursor(0);
472
 }
472
 }
473
 
473
 
474
-template <typename T>
475
-inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) {
476
-  if (encoder_diffState == ENCODER_DIFF_CW)
477
-    valref += EncoderRate.encoderMoveValue;
478
-  else if (encoder_diffState == ENCODER_DIFF_CCW)
479
-    valref -= EncoderRate.encoderMoveValue;
480
-  return encoder_diffState == ENCODER_DIFF_ENTER;
481
-}
482
-
483
 //
474
 //
484
 // Draw Menus
475
 // Draw Menus
485
 //
476
 //
1296
   TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)();
1287
   TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)();
1297
 }
1288
 }
1298
 
1289
 
1299
-inline EncoderState get_encoder_state() {
1300
-  static millis_t Encoder_ms = 0;
1301
-  const millis_t ms = millis();
1302
-  if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
1303
-  const EncoderState state = Encoder_ReceiveAnalyze();
1304
-  if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS;
1305
-  return state;
1306
-}
1307
-
1308
 void HMI_Plan_Move(const feedRate_t fr_mm_s) {
1290
 void HMI_Plan_Move(const feedRate_t fr_mm_s) {
1309
   if (!planner.is_full()) {
1291
   if (!planner.is_full()) {
1310
     planner.synchronize();
1292
     planner.synchronize();
4086
   HMI_SetLanguage();
4068
   HMI_SetLanguage();
4087
 }
4069
 }
4088
 
4070
 
4071
+void DWIN_InitScreen() {
4072
+  Encoder_Configuration();
4073
+  HMI_Init();
4074
+  HMI_SetLanguageCache();
4075
+  HMI_StartFrame(true);
4076
+}
4077
+
4089
 void DWIN_Update() {
4078
 void DWIN_Update() {
4090
   EachMomentUpdate();   // Status update
4079
   EachMomentUpdate();   // Status update
4091
   HMI_SDCardUpdate();   // SD card update
4080
   HMI_SDCardUpdate();   // SD card update

+ 1
- 0
Marlin/src/lcd/e3v2/creality/dwin.h 파일 보기

236
 void HMI_Step();            // Transmission ratio
236
 void HMI_Step();            // Transmission ratio
237
 
237
 
238
 void HMI_Init();
238
 void HMI_Init();
239
+void DWIN_InitScreen();
239
 void DWIN_Update();
240
 void DWIN_Update();
240
 void EachMomentUpdate();
241
 void EachMomentUpdate();
241
 void DWIN_HandleScreen();
242
 void DWIN_HandleScreen();

+ 542
- 898
Marlin/src/lcd/e3v2/proui/dwin.cpp
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 37
- 61
Marlin/src/lcd/e3v2/proui/dwin.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * Enhanced DWIN implementation
25
+ * DWIN Enhanced implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.9.2
28
- * date: 2021/11/21
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 3.15.2
28
+ * Date: 2022/03/01
31
  */
29
  */
32
 
30
 
33
-#include "../../../inc/MarlinConfigPre.h"
31
+#include "dwin_defines.h"
34
 #include "dwinui.h"
32
 #include "dwinui.h"
35
 #include "../common/encoder.h"
33
 #include "../common/encoder.h"
36
 #include "../../../libs/BL24CXX.h"
34
 #include "../../../libs/BL24CXX.h"
37
 
35
 
38
-#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY)
39
-  #define HAS_ONESTEP_LEVELING 1
40
-#endif
41
-
42
-#if !HAS_BED_PROBE && ENABLED(BABYSTEPPING)
43
-  #define JUST_BABYSTEP 1
44
-#endif
45
-
46
-#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET)
47
-  #define HAS_ZOFFSET_ITEM 1
48
-#endif
49
-
50
-#include "dwin_defines.h"
36
+#include "../../../inc/MarlinConfig.h"
51
 
37
 
52
 enum processID : uint8_t {
38
 enum processID : uint8_t {
53
   // Process ID
39
   // Process ID
60
   SetPFloat,
46
   SetPFloat,
61
   SelectFile,
47
   SelectFile,
62
   PrintProcess,
48
   PrintProcess,
63
-  PrintDone,
64
-  PwrlossRec,
65
-  Reboot,
66
-  Info,
67
-  ConfirmToPrint,
68
-
69
-  // Popup Windows
70
-  Homing,
49
+  Popup,
71
   Leveling,
50
   Leveling,
72
-  PidProcess,
51
+  Locked,
52
+  Reboot,
53
+  PrintDone,
73
   ESDiagProcess,
54
   ESDiagProcess,
74
-  PrintStatsProcess,
75
-  PauseOrStop,
76
-  FilamentPurge,
77
   WaitResponse,
55
   WaitResponse,
78
-  Locked,
79
-  NothingToDo,
56
+  Homing,
57
+  PidProcess,
58
+  NothingToDo
80
 };
59
 };
81
 
60
 
82
 enum pidresult_t : uint8_t {
61
 enum pidresult_t : uint8_t {
93
 
72
 
94
 typedef struct {
73
 typedef struct {
95
   int8_t Color[3];                    // Color components
74
   int8_t Color[3];                    // Color components
96
-  uint16_t pidgrphpoints  = 0;
97
   pidresult_t pidresult   = PID_DONE;
75
   pidresult_t pidresult   = PID_DONE;
98
   int8_t Preheat          = 0;        // Material Select 0: PLA, 1: ABS, 2: Custom
76
   int8_t Preheat          = 0;        // Material Select 0: PLA, 1: ABS, 2: Custom
99
   AxisEnum axis           = X_AXIS;   // Axis Select
77
   AxisEnum axis           = X_AXIS;   // Axis Select
100
-  int32_t MaxValue        = 0;        // Auxiliar max integer/scaled float value
101
-  int32_t MinValue        = 0;        // Auxiliar min integer/scaled float value
102
-  int8_t dp               = 0;        // Auxiliar decimal places
103
-  int32_t Value           = 0;        // Auxiliar integer / scaled float value
104
-  int16_t *P_Int          = nullptr;  // Auxiliar pointer to 16 bit integer variable
105
-  float *P_Float          = nullptr;  // Auxiliar pointer to float variable
106
-  void (*Apply)()         = nullptr;  // Auxiliar apply function
107
-  void (*LiveUpdate)()    = nullptr;  // Auxiliar live update function
108
 } HMI_value_t;
78
 } HMI_value_t;
109
 
79
 
110
 typedef struct {
80
 typedef struct {
111
   uint8_t language;
81
   uint8_t language;
82
+  bool remain_flag:1;   // remain was override by M73
112
   bool pause_flag:1;    // printing is paused
83
   bool pause_flag:1;    // printing is paused
113
   bool pause_action:1;  // flag a pause action
84
   bool pause_action:1;  // flag a pause action
85
+  bool abort_flag:1;    // printing is aborting
86
+  bool abort_action:1;  // flag a aborting action
114
   bool print_finish:1;  // print was finished
87
   bool print_finish:1;  // print was finished
115
   bool select_flag:1;   // Popup button selected
88
   bool select_flag:1;   // Popup button selected
116
   bool home_flag:1;     // homing in course
89
   bool home_flag:1;     // homing in course
126
 #if HAS_HOTEND || HAS_HEATED_BED
99
 #if HAS_HOTEND || HAS_HEATED_BED
127
   void DWIN_Popup_Temperature(const bool toohigh);
100
   void DWIN_Popup_Temperature(const bool toohigh);
128
 #endif
101
 #endif
129
-#if HAS_HOTEND
130
-  void Popup_Window_ETempTooLow();
131
-#endif
132
 #if ENABLED(POWER_LOSS_RECOVERY)
102
 #if ENABLED(POWER_LOSS_RECOVERY)
133
   void Popup_PowerLossRecovery();
103
   void Popup_PowerLossRecovery();
134
 #endif
104
 #endif
143
 void Goto_Info_Menu();
113
 void Goto_Info_Menu();
144
 void Goto_PowerLossRecovery();
114
 void Goto_PowerLossRecovery();
145
 void Goto_ConfirmToPrint();
115
 void Goto_ConfirmToPrint();
146
-void Draw_Status_Area(const bool with_update); // Status Area
116
+void DWIN_Draw_Dashboard(const bool with_update); // Status Area
147
 void Draw_Main_Area();      // Redraw main area;
117
 void Draw_Main_Area();      // Redraw main area;
148
 void DWIN_Redraw_screen();  // Redraw all screen elements
118
 void DWIN_Redraw_screen();  // Redraw all screen elements
149
-void HMI_StartFrame(const bool with_update);   // Prepare the menu view
150
 void HMI_MainMenu();        // Main process screen
119
 void HMI_MainMenu();        // Main process screen
151
 void HMI_SelectFile();      // File page
120
 void HMI_SelectFile();      // File page
152
 void HMI_Printing();        // Print page
121
 void HMI_Printing();        // Print page
153
 void HMI_ReturnScreen();    // Return to previous screen before popups
122
 void HMI_ReturnScreen();    // Return to previous screen before popups
154
 void ApplyExtMinT();
123
 void ApplyExtMinT();
155
 void HMI_SetLanguageCache(); // Set the languaje image cache
124
 void HMI_SetLanguageCache(); // Set the languaje image cache
125
+void RebootPrinter();
126
+#if ENABLED(BAUD_RATE_GCODE)
127
+  void HMI_SetBaudRate();
128
+  void SetBaud115K();
129
+  void SetBaud250K();
130
+#endif
131
+#if ENABLED(EEPROM_SETTINGS)
132
+  void WriteEeprom();
133
+  void ReadEeprom();
134
+  void ResetEeprom();
135
+#endif
156
 
136
 
157
-void HMI_Init();
158
-void HMI_Popup();
137
+void HMI_WaitForUser();
159
 void HMI_SaveProcessID(const uint8_t id);
138
 void HMI_SaveProcessID(const uint8_t id);
160
 void HMI_AudioFeedback(const bool success=true);
139
 void HMI_AudioFeedback(const bool success=true);
161
 void EachMomentUpdate();
140
 void EachMomentUpdate();
162
 void update_variable();
141
 void update_variable();
142
+void DWIN_InitScreen();
163
 void DWIN_HandleScreen();
143
 void DWIN_HandleScreen();
164
-void DWIN_Update();
165
 void DWIN_CheckStatusMessage();
144
 void DWIN_CheckStatusMessage();
166
 void DWIN_StartHoming();
145
 void DWIN_StartHoming();
167
 void DWIN_CompletedHoming();
146
 void DWIN_CompletedHoming();
168
 #if HAS_MESH
147
 #if HAS_MESH
169
-  void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
148
+  void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
170
 #endif
149
 #endif
171
 void DWIN_MeshLevelingStart();
150
 void DWIN_MeshLevelingStart();
172
 void DWIN_CompletedLeveling();
151
 void DWIN_CompletedLeveling();
173
 void DWIN_PidTuning(pidresult_t result);
152
 void DWIN_PidTuning(pidresult_t result);
174
-void DWIN_Print_Started(const bool sd = false);
153
+void DWIN_Print_Started(const bool sd=false);
154
+void DWIN_Print_Pause();
155
+void DWIN_Print_Resume();
175
 void DWIN_Print_Finished();
156
 void DWIN_Print_Finished();
157
+void DWIN_Print_Aborted();
176
 #if HAS_FILAMENT_SENSOR
158
 #if HAS_FILAMENT_SENSOR
177
   void DWIN_FilamentRunout(const uint8_t extruder);
159
   void DWIN_FilamentRunout(const uint8_t extruder);
178
 #endif
160
 #endif
179
 void DWIN_Progress_Update();
161
 void DWIN_Progress_Update();
180
 void DWIN_Print_Header(const char *text);
162
 void DWIN_Print_Header(const char *text);
181
 void DWIN_SetColorDefaults();
163
 void DWIN_SetColorDefaults();
164
+void DWIN_ApplyColor();
182
 void DWIN_StoreSettings(char *buff);
165
 void DWIN_StoreSettings(char *buff);
183
 void DWIN_LoadSettings(const char *buff);
166
 void DWIN_LoadSettings(const char *buff);
184
 void DWIN_SetDataDefaults();
167
 void DWIN_SetDataDefaults();
185
 void DWIN_RebootScreen();
168
 void DWIN_RebootScreen();
186
 
169
 
187
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
170
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
171
+  void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0);
188
   void Draw_Popup_FilamentPurge();
172
   void Draw_Popup_FilamentPurge();
189
-  void DWIN_Popup_FilamentPurge();
173
+  void Goto_FilamentPurge();
190
   void HMI_FilamentPurge();
174
   void HMI_FilamentPurge();
191
 #endif
175
 #endif
192
 
176
 
207
   void Draw_PrintStats();
191
   void Draw_PrintStats();
208
 #endif
192
 #endif
209
 
193
 
210
-// HMI user control functions
211
-void HMI_Menu();
212
-void HMI_SetInt();
213
-void HMI_SetPInt();
214
-void HMI_SetIntNoDraw();
215
-void HMI_SetFloat();
216
-void HMI_SetPFloat();
217
-
218
 // Menu drawing functions
194
 // Menu drawing functions
219
 void Draw_Control_Menu();
195
 void Draw_Control_Menu();
220
 void Draw_AdvancedSettings_Menu();
196
 void Draw_AdvancedSettings_Menu();

+ 35
- 8
Marlin/src/lcd/e3v2/proui/dwin_defines.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN general defines and data structs
25
+ * DWIN general defines and data structs for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.9.2
28
- * Date: 2021/11/21
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 3.11.2
28
+ * Date: 2022/02/28
31
  */
29
  */
32
 
30
 
33
-//#define NEED_HEX_PRINT 1
34
 //#define DEBUG_DWIN 1
31
 //#define DEBUG_DWIN 1
32
+//#define NEED_HEX_PRINT 1
33
+
34
+#include "../../../inc/MarlinConfigPre.h"
35
+#include <stddef.h>
36
+
37
+#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
38
+  #error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI."
39
+#endif
40
+#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
41
+  #error "LCD_SET_PROGRESS_MANUALLY is required with ProUI."
42
+#endif
43
+#if DISABLED(STATUS_MESSAGE_SCROLLING)
44
+  #error "STATUS_MESSAGE_SCROLLING is required with ProUI."
45
+#endif
46
+#if DISABLED(BAUD_RATE_GCODE)
47
+  #error "BAUD_RATE_GCODE is required with ProUI."
48
+#endif
49
+#if DISABLED(SOUND_MENU_ITEM)
50
+  #error "SOUND_MENU_ITEM is required with ProUI."
51
+#endif
52
+#if DISABLED(PRINTCOUNTER)
53
+  #error "PRINTCOUNTER is required with ProUI."
54
+#endif
35
 
55
 
36
-#include "../../../core/types.h"
37
 #include "../common/dwin_color.h"
56
 #include "../common/dwin_color.h"
38
 #if ENABLED(LED_CONTROL_MENU)
57
 #if ENABLED(LED_CONTROL_MENU)
39
   #include "../../../feature/leds/leds.h"
58
   #include "../../../feature/leds/leds.h"
57
 #define Def_Barfill_Color     BarFill_Color
76
 #define Def_Barfill_Color     BarFill_Color
58
 #define Def_Indicator_Color   Color_White
77
 #define Def_Indicator_Color   Color_White
59
 #define Def_Coordinate_Color  Color_White
78
 #define Def_Coordinate_Color  Color_White
79
+#define Def_Button_Color      RGB( 0, 23, 16)
60
 
80
 
61
-//#define HAS_GCODE_PREVIEW 1
62
 #define HAS_ESDIAG 1
81
 #define HAS_ESDIAG 1
63
 
82
 
64
 #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
83
 #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
101
   #if ENABLED(PREVENT_COLD_EXTRUSION)
120
   #if ENABLED(PREVENT_COLD_EXTRUSION)
102
     int16_t ExtMinT = EXTRUDE_MINTEMP;
121
     int16_t ExtMinT = EXTRUDE_MINTEMP;
103
   #endif
122
   #endif
123
+  int16_t BedLevT = PREHEAT_1_TEMP_BED;
124
+  TERN_(BAUD_RATE_GCODE, bool Baud115K = false);
125
+  bool FullManualTramming = false;
104
   // Led
126
   // Led
105
   #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
127
   #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
106
     LEDColor Led_Color = Def_Leds_Color;
128
     LEDColor Led_Color = Def_Leds_Color;
113
 
135
 
114
 static constexpr size_t eeprom_data_size = 64;
136
 static constexpr size_t eeprom_data_size = 64;
115
 extern HMI_data_t HMI_data;
137
 extern HMI_data_t HMI_data;
138
+
139
+#if PREHEAT_1_TEMP_BED
140
+  #undef LEVELING_BED_TEMP
141
+  #define LEVELING_BED_TEMP HMI_data.BedLevT
142
+#endif

+ 51
- 5
Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN UI Enhanced implementation
24
+ * DWIN Enhanced implementation for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 3.8.1
27
- * Date: 2021/11/09
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * Version: 3.9.1
27
+ * Date: 2022/02/08
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
37
 
35
 
38
 #include "dwin_lcd.h"
36
 #include "dwin_lcd.h"
39
 
37
 
38
+/*---------------------------------------- Numeric related functions ----------------------------------------*/
39
+
40
+// Draw a numeric value
41
+//  bShow: true=display background color; false=don't display background color
42
+//  zeroFill: true=zero fill; false=no zero fill
43
+//  signedMode: 1=signed; 0=unsigned
44
+//  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
45
+//  size: Font size
46
+//  color: Character color
47
+//  bColor: Background color
48
+//  iNum: Number of digits
49
+//  fNum: Number of decimal digits
50
+//  x/y: Upper-left coordinate
51
+//  value: Integer value
52
+void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
53
+                          uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) {
54
+  size_t i = 0;
55
+  DWIN_Byte(i, 0x14);
56
+  // Bit 7: bshow
57
+  // Bit 6: 1 = signed; 0 = unsigned number;
58
+  // Bit 5: zeroFill
59
+  // Bit 4: zeroMode
60
+  // Bit 3-0: size
61
+  DWIN_Byte(i, (bShow * 0x80) | (signedMode * 0x40) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
62
+  DWIN_Word(i, color);
63
+  DWIN_Word(i, bColor);
64
+  DWIN_Byte(i, signedMode && (value >= 0) ? iNum + 1 : iNum);
65
+  DWIN_Byte(i, fNum);
66
+  DWIN_Word(i, x);
67
+  DWIN_Word(i, y);
68
+  // Write a big-endian 64 bit integer
69
+  const size_t p = i + 1;
70
+  for (size_t count = 8; count--;) { // 7..0
71
+    ++i;
72
+    DWIN_SendBuf[p + count] = value;
73
+    value >>= 8;
74
+  }
75
+  DWIN_Send(i);
76
+}
77
+
78
+// Draw a numeric value
79
+//  value: positive unscaled float value
80
+void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
81
+                          uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
82
+  const int32_t val = round(value * POW(10, fNum));
83
+  DWIN_Draw_Value(bShow, signedMode, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val);
84
+}
85
+
40
 /*---------------------------------------- Picture related functions ----------------------------------------*/
86
 /*---------------------------------------- Picture related functions ----------------------------------------*/
41
 
87
 
42
 // Display QR code
88
 // Display QR code

+ 21
- 5
Marlin/src/lcd/e3v2/proui/dwin_lcd.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN UI Enhanced implementation
25
+ * DWIN Enhanced implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.8.1
28
- * Date: 2021/11/09
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 3.9.1
28
+ * Date: 2022/02/08
31
  */
29
  */
32
 
30
 
33
 #include "../common/dwin_api.h"
31
 #include "../common/dwin_api.h"
34
 
32
 
33
+// Draw a numeric value
34
+//  bShow: true=display background color; false=don't display background color
35
+//  zeroFill: true=zero fill; false=no zero fill
36
+//  signedMode: 1=signed; 0=unsigned
37
+//  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
38
+//  size: Font size
39
+//  color: Character color
40
+//  bColor: Background color
41
+//  iNum: Number of digits
42
+//  fNum: Number of decimal digits
43
+//  x/y: Upper-left coordinate
44
+//  value: Integer value
45
+void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
46
+                          uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value);
47
+//  value: positive unscaled float value
48
+void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
49
+                          uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
50
+
35
 // Display QR code
51
 // Display QR code
36
 //  The size of the QR code is (46*QR_Pixel)*(46*QR_Pixel) dot matrix
52
 //  The size of the QR code is (46*QR_Pixel)*(46*QR_Pixel) dot matrix
37
 //  QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
53
 //  QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)

+ 46
- 14
Marlin/src/lcd/e3v2/proui/dwin_popup.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN UI Enhanced implementation
24
+ * DWIN Enhanced implementation for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 3.10.1
27
- * Date: 2022/01/21
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * Version: 3.11.1
27
+ * Date: 2022/02/28
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
34
 #if ENABLED(DWIN_LCD_PROUI)
32
 #if ENABLED(DWIN_LCD_PROUI)
35
 
33
 
36
 #include "dwin.h"
34
 #include "dwin.h"
35
+#include "dwinui.h"
37
 #include "dwin_popup.h"
36
 #include "dwin_popup.h"
38
 
37
 
39
-void Draw_Select_Highlight(const bool sel) {
38
+#include "../../../MarlinCore.h" // for wait_for_user
39
+
40
+popupDrawFunc_t popupDraw = nullptr;
41
+popupClickFunc_t popupClick = nullptr;
42
+popupChangeFunc_t popupChange = nullptr;
43
+
44
+uint16_t HighlightYPos = 280;
45
+
46
+void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
47
+  HighlightYPos = ypos;
40
   HMI_flag.select_flag = sel;
48
   HMI_flag.select_flag = sel;
41
   const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_color,
49
   const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_color,
42
                  c2 = sel ? HMI_data.PopupBg_color : HMI_data.Highlight_Color;
50
                  c2 = sel ? HMI_data.PopupBg_color : HMI_data.Highlight_Color;
43
-  DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318);
44
-  DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319);
45
-  DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318);
46
-  DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319);
51
+  DWIN_Draw_Rectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
52
+  DWIN_Draw_Rectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
53
+  DWIN_Draw_Rectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
54
+  DWIN_Draw_Rectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
47
 }
55
 }
48
 
56
 
49
 void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
57
 void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
50
   HMI_SaveProcessID(WaitResponse);
58
   HMI_SaveProcessID(WaitResponse);
51
-  DWIN_Draw_Popup(icon, fmsg1, fmsg2, ICON_Continue_E);  // Button Continue
59
+  DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue);  // Button Continue
52
   DWIN_UpdateLCD();
60
   DWIN_UpdateLCD();
53
 }
61
 }
54
 
62
 
55
 void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
63
 void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
56
   DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
64
   DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
57
-  DWINUI::Draw_IconWB(ICON_Confirm_E, 26, 280);
58
-  DWINUI::Draw_IconWB(ICON_Cancel_E, 146, 280);
59
-  Draw_Select_Highlight(true);
65
+  DWINUI::Draw_Button(BTN_Confirm, 26, 280);
66
+  DWINUI::Draw_Button(BTN_Cancel, 146, 280);
67
+  Draw_Select_Highlight(HMI_flag.select_flag);
60
   DWIN_UpdateLCD();
68
   DWIN_UpdateLCD();
61
 }
69
 }
62
 
70
 
71
+void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) {
72
+  popupDraw = fnDraw;
73
+  popupClick = fnClick;
74
+  popupChange = fnChange;
75
+  HMI_SaveProcessID(Popup);
76
+  HMI_flag.select_flag = false;
77
+  popupDraw();
78
+}
79
+
80
+void HMI_Popup() {
81
+  if (!wait_for_user) {
82
+    if (popupClick) popupClick();
83
+    return;
84
+  }
85
+  else {
86
+    EncoderState encoder_diffState = get_encoder_state();
87
+    if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
88
+      const bool change = encoder_diffState != ENCODER_DIFF_CW;
89
+      if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos);
90
+      DWIN_UpdateLCD();
91
+    }
92
+  }
93
+}
94
+
63
 #endif // DWIN_LCD_PROUI
95
 #endif // DWIN_LCD_PROUI

+ 15
- 12
Marlin/src/lcd/e3v2/proui/dwin_popup.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN UI Enhanced implementation
25
+ * DWIN Enhanced implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.10.1
28
- * Date: 2022/01/21
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 3.11.1
28
+ * Date: 2022/02/28
31
  */
29
  */
32
 
30
 
33
 #include "dwinui.h"
31
 #include "dwinui.h"
34
 #include "dwin.h"
32
 #include "dwin.h"
35
 
33
 
36
-// Popup windows
34
+typedef void (*popupDrawFunc_t)();
35
+typedef void (*popupClickFunc_t)();
36
+typedef void (*popupChangeFunc_t)(const bool state);
37
+extern popupDrawFunc_t popupDraw;
37
 
38
 
38
-void Draw_Select_Highlight(const bool sel);
39
+void Draw_Select_Highlight(const bool sel, const uint16_t ypos);
40
+inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); };
41
+void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
42
+void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
43
+void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr);
44
+void HMI_Popup();
39
 
45
 
40
 inline void Draw_Popup_Bkgd() {
46
 inline void Draw_Popup_Bkgd() {
41
   DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, 14, 60, 258, 330);
47
   DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, 14, 60, 258, 330);
49
   if (icon) DWINUI::Draw_Icon(icon, 101, 105);
55
   if (icon) DWINUI::Draw_Icon(icon, 101, 105);
50
   if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
56
   if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
51
   if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
57
   if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
52
-  if (button) DWINUI::Draw_IconWB(button, 86, 280);
58
+  if (button) DWINUI::Draw_Button(button, 86, 280);
53
 }
59
 }
54
 
60
 
55
 template<typename T, typename U>
61
 template<typename T, typename U>
61
 template<typename T, typename U>
67
 template<typename T, typename U>
62
 void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
68
 void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
63
   HMI_SaveProcessID(WaitResponse);
69
   HMI_SaveProcessID(WaitResponse);
64
-  DWIN_Draw_Popup(icon, amsg1, amsg2, ICON_Confirm_E);  // Button Confirm
70
+  DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm);  // Button Confirm
65
   DWIN_UpdateLCD();
71
   DWIN_UpdateLCD();
66
 }
72
 }
67
 
73
 
68
-void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
69
-
70
-void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);

+ 61
- 58
Marlin/src/lcd/e3v2/proui/dwinui.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN UI Enhanced implementation
24
+ * DWIN Enhanced implementation for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 3.8.2
27
- * Date: 2021/11/09
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * Version: 3.15.1
27
+ * Date: 2022/02/25
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
51
 uint16_t DWINUI::pencolor = Color_White;
49
 uint16_t DWINUI::pencolor = Color_White;
52
 uint16_t DWINUI::textcolor = Def_Text_Color;
50
 uint16_t DWINUI::textcolor = Def_Text_Color;
53
 uint16_t DWINUI::backcolor = Def_Background_Color;
51
 uint16_t DWINUI::backcolor = Def_Background_Color;
52
+uint16_t DWINUI::buttoncolor = Def_Button_Color;
54
 uint8_t  DWINUI::font = font8x16;
53
 uint8_t  DWINUI::font = font8x16;
54
+FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
55
 
55
 
56
 void (*DWINUI::onCursorErase)(const int8_t line)=nullptr;
56
 void (*DWINUI::onCursorErase)(const int8_t line)=nullptr;
57
 void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr;
57
 void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr;
59
 void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr;
59
 void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr;
60
 
60
 
61
 void DWINUI::init() {
61
 void DWINUI::init() {
62
-  DEBUG_ECHOPGM("\r\nDWIN handshake ");
63
-  delay(750);   // Delay here or init later in the boot process
64
-  const bool success = DWIN_Handshake();
65
-  if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
62
+  TERN_(DEBUG_DWIN, SERIAL_ECHOPGM("\r\nDWIN handshake "));
63
+  delay(750);   // Delay for wait to wakeup screen
64
+  const bool hs = DWIN_Handshake();
65
+  TERN(DEBUG_DWIN, SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")), UNUSED(hs));
66
   DWIN_Frame_SetDir(1);
66
   DWIN_Frame_SetDir(1);
67
-  TERN(SHOW_BOOTSCREEN,,DWIN_Frame_Clear(Color_Bg_Black));
68
-  DWIN_UpdateLCD();
69
-  cursor.x = 0;
70
-  cursor.y = 0;
67
+  cursor.reset();
71
   pencolor = Color_White;
68
   pencolor = Color_White;
72
   textcolor = Def_Text_Color;
69
   textcolor = Def_Text_Color;
73
   backcolor = Def_Background_Color;
70
   backcolor = Def_Background_Color;
71
+  buttoncolor = Def_Button_Color;
74
   font = font8x16;
72
   font = font8x16;
75
 }
73
 }
76
 
74
 
124
 }
122
 }
125
 
123
 
126
 // Set text/number color
124
 // Set text/number color
127
-void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor) {
125
+void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
128
   textcolor = fgcolor;
126
   textcolor = fgcolor;
129
   backcolor = bgcolor;
127
   backcolor = bgcolor;
128
+  buttoncolor = alcolor;
130
 }
129
 }
131
 void DWINUI::SetTextColor(uint16_t fgcolor) {
130
 void DWINUI::SetTextColor(uint16_t fgcolor) {
132
   textcolor = fgcolor;
131
   textcolor = fgcolor;
159
   cursor += point;
158
   cursor += point;
160
 }
159
 }
161
 
160
 
162
-// Draw a Centered string using DWIN_WIDTH
163
-void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
164
-  const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(string) * fontWidth(size)) / 2 - 1;
161
+// Draw a Centered string using arbitrary x1 and x2 margins
162
+void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
163
+  const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1;
165
   DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
164
   DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
166
 }
165
 }
167
 
166
 
167
+// // Draw a Centered string using DWIN_WIDTH
168
+// void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
169
+//   const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(string) * fontWidth(size)) / 2 - 1;
170
+//   DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
171
+// }
172
+
168
 // Draw a char at cursor position
173
 // Draw a char at cursor position
169
-void DWINUI::Draw_Char(const char c) {
174
+void DWINUI::Draw_Char(uint16_t color, const char c) {
170
   const char string[2] = { c, 0};
175
   const char string[2] = { c, 0};
171
-  DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, 1);
176
+  DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, 1);
172
   MoveBy(fontWidth(font), 0);
177
   MoveBy(fontWidth(font), 0);
173
 }
178
 }
174
 
179
 
185
   MoveBy(strlen(string) * fontWidth(font), 0);
190
   MoveBy(strlen(string) * fontWidth(font), 0);
186
 }
191
 }
187
 
192
 
188
-// Draw a signed floating point number
189
-//  bShow: true=display background color; false=don't display background color
190
-//  zeroFill: true=zero fill; false=no zero fill
191
-//  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
192
-//  size: Font size
193
-//  bColor: Background color
194
-//  iNum: Number of whole digits
195
-//  fNum: Number of decimal digits
196
-//  x/y: Upper-left point
197
-//  value: Float value
198
-void DWINUI::Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
199
-  DWIN_Draw_FloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value < 0 ? -value : value);
200
-  DWIN_Draw_String(bShow, size, color, bColor, x - 6, y, value < 0 ? F("-") : F(" "));
193
+// ------------------------- Buttons ------------------------------//
194
+
195
+void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) {
196
+  DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2);
197
+  Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
198
+}
199
+
200
+void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
201
+  switch (id) {
202
+    case BTN_Cancel  : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break;
203
+    case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break;
204
+    case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break;
205
+    case BTN_Print   : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break;
206
+    case BTN_Save    : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break;
207
+    default: break;
208
+  }
201
 }
209
 }
202
 
210
 
211
+// -------------------------- Extra -------------------------------//
212
+
203
 // Draw a circle
213
 // Draw a circle
204
 //  color: circle color
214
 //  color: circle color
205
 //  x: the abscissa of the center of the circle
215
 //  x: the abscissa of the center of the circle
247
 //  color1 : Start color
257
 //  color1 : Start color
248
 //  color2 : End color
258
 //  color2 : End color
249
 uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
259
 uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
250
-  uint8_t B,G,R;
251
-  float n;
252
-  n = (float)(val-minv)/(maxv-minv);
253
-  R = (1-n)*GetRColor(color1) + n*GetRColor(color2);
254
-  G = (1-n)*GetGColor(color1) + n*GetGColor(color2);
255
-  B = (1-n)*GetBColor(color1) + n*GetBColor(color2);
256
-  return RGB(R,G,B);
260
+  uint8_t B, G, R;
261
+  const float n = (float)(val - minv) / (maxv - minv);
262
+  R = (1 - n) * GetRColor(color1) + n * GetRColor(color2);
263
+  G = (1 - n) * GetGColor(color1) + n * GetGColor(color2);
264
+  B = (1 - n) * GetBColor(color1) + n * GetBColor(color2);
265
+  return RGB(R, G, B);
257
 }
266
 }
258
 
267
 
259
 // Color Interpolator through Red->Yellow->Green->Blue
268
 // Color Interpolator through Red->Yellow->Green->Blue
261
 //  minv : Minimum value
270
 //  minv : Minimum value
262
 //  maxv : Maximum value
271
 //  maxv : Maximum value
263
 uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
272
 uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
264
-  uint8_t B,G,R;
265
-  const uint8_t maxB = 28;
266
-  const uint8_t maxR = 28;
267
-  const uint8_t maxG = 38;
273
+  uint8_t B, G, R;
274
+  const uint8_t maxB = 28, maxR = 28, maxG = 38;
268
   const int16_t limv = _MAX(abs(minv), abs(maxv));
275
   const int16_t limv = _MAX(abs(minv), abs(maxv));
269
-  float n;
270
-  if (minv>=0) {
271
-    n = (float)(val-minv)/(maxv-minv);
272
-  } else {
273
-    n = (float)val/limv;
274
-  }
275
-  n = _MIN(1, n);
276
-  n = _MAX(-1, n);
276
+  float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv;
277
+  LIMIT(n, -1, 1);
277
   if (n < 0) {
278
   if (n < 0) {
278
     R = 0;
279
     R = 0;
279
-    G = (1+n)*maxG;
280
-    B = (-n)*maxB;
281
-  } else if (n < 0.5) {
282
-    R = maxR*n*2;
280
+    G = (1 + n) * maxG;
281
+    B = (-n) * maxB;
282
+  }
283
+  else if (n < 0.5) {
284
+    R = maxR * n * 2;
283
     G = maxG;
285
     G = maxG;
284
     B = 0;
286
     B = 0;
285
-  } else {
287
+  }
288
+  else {
286
     R = maxR;
289
     R = maxR;
287
-    G = maxG*(1-n);
290
+    G = maxG * (1 - n);
288
     B = 0;
291
     B = 0;
289
   }
292
   }
290
-  return RGB(R,G,B);
293
+  return RGB(R, G, B);
291
 }
294
 }
292
 
295
 
293
 // Draw a checkbox
296
 // Draw a checkbox

+ 98
- 28
Marlin/src/lcd/e3v2/proui/dwinui.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN UI Enhanced implementation
25
+ * DWIN Enhanced implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.11.1
28
- * Date: 2022/01/19
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 3.15.1
28
+ * Date: 2022/02/25
31
  */
29
  */
32
 
30
 
33
 #include "dwin_lcd.h"
31
 #include "dwin_lcd.h"
107
 #define ICON_CaseLight            ICON_Motion
105
 #define ICON_CaseLight            ICON_Motion
108
 #define ICON_LedControl           ICON_Motion
106
 #define ICON_LedControl           ICON_Motion
109
 
107
 
108
+// Buttons
109
+#define BTN_Continue          85
110
+#define BTN_Cancel            87
111
+#define BTN_Confirm           89
112
+#define BTN_Print             90
113
+#define BTN_Save              91
114
+
110
 // Extended and default UI Colors
115
 // Extended and default UI Colors
111
 #define Color_Black           0
116
 #define Color_Black           0
112
 #define Color_Green           RGB(0,63,0)
117
 #define Color_Green           RGB(0,63,0)
119
 #define DWIN_FONT_HEAD font10x20
124
 #define DWIN_FONT_HEAD font10x20
120
 #define DWIN_FONT_ALERT font10x20
125
 #define DWIN_FONT_ALERT font10x20
121
 #define STATUS_Y 354
126
 #define STATUS_Y 354
122
-#define LCD_WIDTH (DWIN_WIDTH / 8)
127
+#define LCD_WIDTH (DWIN_WIDTH / 8)  // only if the default font is font8x16
128
+
129
+// Minimum unit (0.1) : multiple (10)
130
+#define UNITFDIGITS 1
131
+#define MINUNITMULT POW(10, UNITFDIGITS)
123
 
132
 
124
 constexpr uint16_t TITLE_HEIGHT = 30,                          // Title bar height
133
 constexpr uint16_t TITLE_HEIGHT = 30,                          // Title bar height
125
                    MLINE = 53,                                 // Menu line height
134
                    MLINE = 53,                                 // Menu line height
212
   extern uint16_t pencolor;
221
   extern uint16_t pencolor;
213
   extern uint16_t textcolor;
222
   extern uint16_t textcolor;
214
   extern uint16_t backcolor;
223
   extern uint16_t backcolor;
224
+  extern uint16_t buttoncolor;
215
   extern uint8_t  font;
225
   extern uint8_t  font;
226
+  extern FSTR_P const Author;
216
 
227
 
217
   extern void (*onCursorErase)(const int8_t line);
228
   extern void (*onCursorErase)(const int8_t line);
218
   extern void (*onCursorDraw)(const int8_t line);
229
   extern void (*onCursorDraw)(const int8_t line);
240
   uint16_t RowToY(uint8_t row);
251
   uint16_t RowToY(uint8_t row);
241
 
252
 
242
   // Set text/number color
253
   // Set text/number color
243
-  void SetColors(uint16_t fgcolor, uint16_t bgcolor);
254
+  void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor);
244
   void SetTextColor(uint16_t fgcolor);
255
   void SetTextColor(uint16_t fgcolor);
245
   void SetBackgroundColor(uint16_t bgcolor);
256
   void SetBackgroundColor(uint16_t bgcolor);
246
 
257
 
268
     DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y);
279
     DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y);
269
   }
280
   }
270
 
281
 
282
+  // Extend a frame box
283
+  //  v: value to extend
284
+  inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) {
285
+    frame_rect_t t;
286
+    t.x = frame.x - v;
287
+    t.y = frame.y - v;
288
+    t.w = frame.w + 2 * v;
289
+    t.h = frame.h + 2 * v;
290
+    return t;
291
+  }
292
+
271
   // Draw an Icon with transparent background from the library ICON
293
   // Draw an Icon with transparent background from the library ICON
272
   //  icon: Icon ID
294
   //  icon: Icon ID
273
   //  x/y: Upper-left point
295
   //  x/y: Upper-left point
293
   //  x/y: Upper-left coordinate
315
   //  x/y: Upper-left coordinate
294
   //  value: Integer value
316
   //  value: Integer value
295
   inline void Draw_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
317
   inline void Draw_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
296
-    DWIN_Draw_IntValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, x, y, value);
318
+    DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value);
297
   }
319
   }
298
   inline void Draw_Int(uint8_t iNum, long value) {
320
   inline void Draw_Int(uint8_t iNum, long value) {
299
-    DWIN_Draw_IntValue(false, true, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
321
+    DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value);
300
     MoveBy(iNum * fontWidth(font), 0);
322
     MoveBy(iNum * fontWidth(font), 0);
301
   }
323
   }
302
   inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
324
   inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
303
-    DWIN_Draw_IntValue(false, true, 0, font, textcolor, backcolor, iNum, x, y, value);
325
+    DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value);
304
   }
326
   }
305
   inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
327
   inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
306
-    DWIN_Draw_IntValue(false, true, 0, font, color, backcolor, iNum, x, y, value);
328
+    DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, 0, x, y, value);
307
   }
329
   }
308
   inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
330
   inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
309
-    DWIN_Draw_IntValue(true, true, 0, font, color, bColor, iNum, x, y, value);
331
+    DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, 0, x, y, value);
310
   }
332
   }
311
   inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
333
   inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
312
-    DWIN_Draw_IntValue(true, true, 0, size, color, bColor, iNum, x, y, value);
334
+    DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, 0, x, y, value);
313
   }
335
   }
314
 
336
 
315
-  // Draw a floating point number
337
+  // Draw a signed integer
338
+  //  bShow: true=display background color; false=don't display background color
339
+  //  zeroFill: true=zero fill; false=no zero fill
340
+  //  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
341
+  //  size: Font size
342
+  //  color: Character color
343
+  //  bColor: Background color
344
+  //  iNum: Number of digits
345
+  //  x/y: Upper-left coordinate
346
+  //  value: Integer value
347
+  inline void Draw_Signed_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
348
+    DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value);
349
+  }
350
+  inline void Draw_Signed_Int(uint8_t iNum, long value) {
351
+    DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value);
352
+    MoveBy(iNum * fontWidth(font), 0);
353
+  }
354
+  inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
355
+    DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value);
356
+  }
357
+  inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
358
+    DWIN_Draw_Value(false, 1, true, 0, font, color, backcolor, iNum, 0, x, y, value);
359
+  }
360
+  inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
361
+    DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, 0, x, y, value);
362
+  }
363
+  inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
364
+    DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, 0, x, y, value);
365
+  }
366
+
367
+  // Draw a positive floating point number
316
   //  bShow: true=display background color; false=don't display background color
368
   //  bShow: true=display background color; false=don't display background color
317
   //  zeroFill: true=zero fill; false=no zero fill
369
   //  zeroFill: true=zero fill; false=no zero fill
318
   //  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
370
   //  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
324
   //  x/y: Upper-left point
376
   //  x/y: Upper-left point
325
   //  value: Float value
377
   //  value: Float value
326
   inline void Draw_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
378
   inline void Draw_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
327
-    DWIN_Draw_FloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
379
+    DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
328
   }
380
   }
329
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
381
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
330
-    DWIN_Draw_FloatValue(false, true, 0, font, textcolor, backcolor, iNum, fNum,  cursor.x, cursor.y, value);
382
+    DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
331
     MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
383
     MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
332
   }
384
   }
333
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
385
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
334
-    DWIN_Draw_FloatValue(false, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
386
+    DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
335
   }
387
   }
336
   inline void Draw_Float(uint16_t color, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
388
   inline void Draw_Float(uint16_t color, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
337
-    DWIN_Draw_FloatValue(false, true, 0, font, color, backcolor, iNum, fNum, x, y, value);
389
+    DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, fNum, x, y, value);
338
   }
390
   }
339
   inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
391
   inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
340
-    DWIN_Draw_FloatValue(true, true, 0, font, color, bColor, iNum, fNum, x, y, value);
392
+    DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, fNum, x, y, value);
341
   }
393
   }
342
   inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
394
   inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
343
-    DWIN_Draw_FloatValue(true, true, 0, size, color, bColor, iNum, fNum, x, y, value);
395
+    DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, fNum, x, y, value);
344
   }
396
   }
345
 
397
 
346
   // Draw a signed floating point number
398
   // Draw a signed floating point number
348
   //  zeroFill: true=zero fill; false=no zero fill
400
   //  zeroFill: true=zero fill; false=no zero fill
349
   //  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
401
   //  zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
350
   //  size: Font size
402
   //  size: Font size
403
+  //  color: Character color
351
   //  bColor: Background color
404
   //  bColor: Background color
352
   //  iNum: Number of whole digits
405
   //  iNum: Number of whole digits
353
   //  fNum: Number of decimal digits
406
   //  fNum: Number of decimal digits
354
   //  x/y: Upper-left point
407
   //  x/y: Upper-left point
355
   //  value: Float value
408
   //  value: Float value
356
-  void Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
409
+  inline void Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
410
+    DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
411
+  }
357
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
412
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
358
-    Draw_Signed_Float(false, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
413
+    DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
359
     MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
414
     MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
360
   }
415
   }
361
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
416
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
362
-    Draw_Signed_Float(false, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
417
+    DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
363
   }
418
   }
364
   inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
419
   inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
365
-    Draw_Signed_Float(false, true, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
420
+    DWIN_Draw_Value(false, 1, true, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
366
   }
421
   }
367
   inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
422
   inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
368
-    Draw_Signed_Float(true, true, 0, font, color, bColor, iNum, fNum, x, y, value);
423
+    DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, fNum, x, y, value);
369
   }
424
   }
370
   inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
425
   inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
371
-    Draw_Signed_Float(true, true, 0, size, color, bColor, iNum, fNum, x, y, value);
426
+    DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, fNum, x, y, value);
372
   }
427
   }
373
 
428
 
374
   // Draw a char at cursor position
429
   // Draw a char at cursor position
375
-  void Draw_Char(const char c);
430
+  void Draw_Char(uint16_t color, const char c);
431
+  inline void Draw_Char(const char c) { Draw_Char(textcolor, c); }
376
 
432
 
377
   // Draw a string at cursor position
433
   // Draw a string at cursor position
378
   //  color: Character color
434
   //  color: Character color
425
   //  bColor: Background color
481
   //  bColor: Background color
426
   //  y: Upper coordinate of the string
482
   //  y: Upper coordinate of the string
427
   //  *string: The string
483
   //  *string: The string
428
-  void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string);
484
+  void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
485
+  inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
486
+    Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string);
487
+  }
429
   inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
488
   inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
430
     Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
489
     Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
431
   }
490
   }
487
   //  color2 : End color
546
   //  color2 : End color
488
   uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
547
   uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
489
 
548
 
549
+  // ------------------------- Buttons ------------------------------//
550
+
551
+  void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption);
552
+  inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) {
553
+    Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption));
554
+  }
555
+  inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) {
556
+    Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption);
557
+  }
558
+  void Draw_Button(uint8_t id, uint16_t x, uint16_t y);
559
+
490
   // -------------------------- Extra -------------------------------//
560
   // -------------------------- Extra -------------------------------//
491
 
561
 
492
   // Draw a circle filled with color
562
   // Draw a circle filled with color

+ 4
- 7
Marlin/src/lcd/e3v2/proui/endstop_diag.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN End Stops diagnostic page
24
+ * DWIN End Stops diagnostic page for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 1.0.2
27
- * Date: 2021/11/06
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * Version: 1.2.2
27
+ * Date: 2022/02/24
30
  */
28
  */
31
 
29
 
32
-#include "../../../inc/MarlinConfigPre.h"
33
 #include "dwin_defines.h"
30
 #include "dwin_defines.h"
34
 
31
 
35
 #if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG)
32
 #if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG)
72
   Title.ShowCaption(F("End-stops Diagnostic"));
69
   Title.ShowCaption(F("End-stops Diagnostic"));
73
   DWINUI::ClearMenuArea();
70
   DWINUI::ClearMenuArea();
74
   Draw_Popup_Bkgd();
71
   Draw_Popup_Bkgd();
75
-  DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
72
+  DWINUI::Draw_Button(BTN_Continue, 86, 250);
76
   DWINUI::cursor.y = 80;
73
   DWINUI::cursor.y = 80;
77
   #define ES_LABEL(S) draw_es_label(F(STR_##S))
74
   #define ES_LABEL(S) draw_es_label(F(STR_##S))
78
   #if HAS_X_MIN
75
   #if HAS_X_MIN

+ 3
- 5
Marlin/src/lcd/e3v2/proui/endstop_diag.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN End Stops diagnostic page
25
+ * DWIN End Stops diagnostic page for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 1.0
28
- * Date: 2021/11/06
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 1.2.3
28
+ * Date: 2022/02/24
31
  */
29
  */
32
 
30
 
33
 class ESDiagClass {
31
 class ESDiagClass {

+ 1
- 3
Marlin/src/lcd/e3v2/proui/lockscreen.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * Lock screen implementation for DWIN UI Enhanced implementation
24
+ * Lock screen implementation for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Version: 2.1
26
  * Version: 2.1
27
  * Date: 2021/11/09
27
  * Date: 2021/11/09
28
- *
29
- * Based on the original code provided by Creality under GPL
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"

+ 1
- 3
Marlin/src/lcd/e3v2/proui/lockscreen.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * Lock screen implementation for DWIN UI Enhanced implementation
25
+ * Lock screen implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
  * Version: 2.1
27
  * Version: 2.1
28
  * Date: 2021/11/09
28
  * Date: 2021/11/09
29
- *
30
- * Based on the original code provided by Creality under GPL
31
  */
29
  */
32
 
30
 
33
 #include "../common/encoder.h"
31
 #include "../common/encoder.h"

+ 370
- 0
Marlin/src/lcd/e3v2/proui/menus.cpp 파일 보기

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Menu functions for ProUI
25
+ * Author: Miguel A. Risco-Castillo
26
+ * Version: 1.2.1
27
+ * Date: 2022/02/25
28
+ *
29
+ * This program is free software: you can redistribute it and/or modify
30
+ * it under the terms of the GNU Lesser General Public License as
31
+ * published by the Free Software Foundation, either version 3 of the License, or
32
+ * (at your option) any later version.
33
+ *
34
+ * This program is distributed in the hope that it will be useful,
35
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
+ * GNU General Public License for more details.
38
+ *
39
+ * You should have received a copy of the GNU Lesser General Public License
40
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
41
+ *
42
+ */
43
+
44
+#include "../../../inc/MarlinConfigPre.h"
45
+
46
+#if ENABLED(DWIN_LCD_PROUI)
47
+
48
+#include "../common/encoder.h"
49
+#include "dwin_lcd.h"
50
+#include "dwinui.h"
51
+#include "dwin.h"
52
+#include "menus.h"
53
+
54
+MenuData_t MenuData;
55
+
56
+// Menuitem Drawing functions =================================================
57
+
58
+void Draw_Title(TitleClass* title) {
59
+  DWIN_Draw_Rectangle(1, HMI_data.TitleBg_color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
60
+  if (title->frameid)
61
+    DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1);
62
+  else
63
+    DWIN_Draw_String(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_color, HMI_data.TitleBg_color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
64
+}
65
+
66
+void Draw_Menu(MenuClass* menu) {
67
+  DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
68
+  DWIN_Draw_Rectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
69
+}
70
+
71
+void Draw_Menu_Cursor(const int8_t line) {
72
+  DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
73
+}
74
+
75
+void Erase_Menu_Cursor(const int8_t line) {
76
+  DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
77
+}
78
+
79
+void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * const label /*=nullptr*/, bool more /*=false*/) {
80
+  if (icon)  DWINUI::Draw_Icon(icon, ICOX, MBASE(line) - 3);
81
+  if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label);
82
+  if (more)  DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
83
+  DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
84
+}
85
+
86
+void Draw_Chkb_Line(const uint8_t line, const bool checked) {
87
+  DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 16, MBASE(line) - 1, checked);
88
+}
89
+
90
+void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value /*=0*/) {
91
+  DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value);
92
+}
93
+
94
+void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) {
95
+  if (menuitem->icon) DWINUI::Draw_Icon(menuitem->icon, ICOX, MBASE(line) - 3);
96
+  if (menuitem->frameid)
97
+    DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line));
98
+  else if (menuitem->caption)
99
+    DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption);
100
+  DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
101
+}
102
+
103
+void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) {
104
+  onDrawMenuItem(menuitem, line);
105
+  DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
106
+}
107
+
108
+void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value) {
109
+  onDrawMenuItem(menuitem, line);
110
+  Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, value);
111
+}
112
+
113
+void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line) {
114
+  const int16_t value = *(int16_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
115
+  onDrawIntMenu(menuitem, line, value);
116
+}
117
+
118
+void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line) {
119
+  const uint8_t value = *(uint8_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
120
+  onDrawIntMenu(menuitem, line, value);
121
+}
122
+
123
+void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line) {
124
+  const uint32_t value = *(uint32_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
125
+  onDrawIntMenu(menuitem, line, value);
126
+}
127
+
128
+void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value) {
129
+  onDrawMenuItem(menuitem, line);
130
+  DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value);
131
+}
132
+
133
+void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) {
134
+  const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
135
+  const int8_t dp = UNITFDIGITS;
136
+  onDrawFloatMenu(menuitem, line, dp, value);
137
+}
138
+
139
+void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) {
140
+  const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
141
+  onDrawFloatMenu(menuitem, line, 2, value);
142
+}
143
+
144
+void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) {
145
+  onDrawMenuItem(menuitem, line);
146
+  Draw_Chkb_Line(line, checked);
147
+}
148
+
149
+//-----------------------------------------------------------------------------
150
+// On click functions
151
+//-----------------------------------------------------------------------------
152
+
153
+// Generic onclick event without draw
154
+//  process: process id HMI destiny
155
+//  lo: low limit
156
+//  hi: high limit
157
+//  dp: decimal places, 0 for integers
158
+//  val: value / scaled value
159
+//  LiveUpdate: live update function when the encoder changes
160
+//  Apply: update function when the encoder is pressed
161
+void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
162
+  checkkey = process;
163
+  MenuData.MinValue = lo;
164
+  MenuData.MaxValue = hi;
165
+  MenuData.dp = dp;
166
+  MenuData.Apply = Apply;
167
+  MenuData.LiveUpdate = LiveUpdate;
168
+  MenuData.Value = val;
169
+  EncoderRate.enabled = true;
170
+}
171
+
172
+// Generic onclick event for integer values
173
+//  process: process id HMI destiny
174
+//  lo: scaled low limit
175
+//  hi: scaled high limit
176
+//  val: value
177
+//  LiveUpdate: live update function when the encoder changes
178
+//  Apply: update function when the encoder is pressed
179
+void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
180
+  SetOnClick(process, lo, hi, 0, val, Apply, LiveUpdate);
181
+  Draw_Menu_IntValue(HMI_data.Selected_Color, CurrentMenu->line(), 4, MenuData.Value);
182
+}
183
+
184
+// Generic onclick event for float values
185
+//  process: process id HMI destiny
186
+//  lo: scaled low limit
187
+//  hi: scaled high limit
188
+//  val: value
189
+//  LiveUpdate: live update function when the encoder changes
190
+//  Apply: update function when the encoder is pressed
191
+void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
192
+  const int32_t value =  round(val * POW(10, dp));
193
+  SetOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, Apply, LiveUpdate);
194
+  DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), val);
195
+}
196
+
197
+// Generic onclick event for integer values
198
+//  lo: scaled low limit
199
+//  hi: scaled high limit
200
+//  val: value
201
+//  LiveUpdate: live update function when the encoder changes
202
+//  Apply: update function when the encoder is pressed
203
+void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
204
+  SetValueOnClick(SetInt, lo, hi, val, Apply, LiveUpdate);
205
+}
206
+
207
+// Generic onclick event for set pointer to 16 bit uinteger values
208
+//  lo: low limit
209
+//  hi: high limit
210
+//  LiveUpdate: live update function when the encoder changes
211
+//  Apply: update function when the encoder is pressed
212
+void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
213
+  MenuData.P_Int = (int16_t*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
214
+  const int32_t value = *MenuData.P_Int;
215
+  SetValueOnClick(SetPInt, lo, hi, value, Apply, LiveUpdate);
216
+}
217
+
218
+// Generic onclick event for float values
219
+//  process: process id HMI destiny
220
+//  lo: low limit
221
+//  hi: high limit
222
+//  dp: decimal places
223
+//  val: value
224
+void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
225
+  SetValueOnClick(SetFloat, lo, hi, dp, val, Apply, LiveUpdate);
226
+}
227
+
228
+// Generic onclick event for set pointer to float values
229
+//  lo: low limit
230
+//  hi: high limit
231
+//  LiveUpdate: live update function when the encoder changes
232
+//  Apply: update function when the encoder is pressed
233
+void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
234
+  MenuData.P_Float = (float*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
235
+  SetValueOnClick(SetPFloat, lo, hi, dp, *MenuData.P_Float, Apply, LiveUpdate);
236
+}
237
+
238
+// HMI Control functions ======================================================
239
+
240
+// Generic menu control using the encoder
241
+void HMI_Menu() {
242
+  EncoderState encoder_diffState = get_encoder_state();
243
+  if (encoder_diffState == ENCODER_DIFF_NO) return;
244
+  if (CurrentMenu) {
245
+    if (encoder_diffState == ENCODER_DIFF_ENTER)
246
+      CurrentMenu->onClick();
247
+    else
248
+      CurrentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW);
249
+  }
250
+}
251
+
252
+// Get an integer value using the encoder without draw anything
253
+//  lo: low limit
254
+//  hi: high limit
255
+// Return value:
256
+//  0 : no change
257
+//  1 : live change
258
+//  2 : apply change
259
+int8_t HMI_GetIntNoDraw(const int32_t lo, const int32_t hi) {
260
+  EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
261
+  if (encoder_diffState != ENCODER_DIFF_NO) {
262
+    if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
263
+      EncoderRate.enabled = false;
264
+      checkkey = Menu;
265
+      return 2;
266
+    }
267
+    LIMIT(MenuData.Value, lo, hi);
268
+    return 1;
269
+  }
270
+  return 0;
271
+}
272
+
273
+// Get an integer value using the encoder
274
+//  lo: low limit
275
+//  hi: high limit
276
+// Return value:
277
+//  0 : no change
278
+//  1 : live change
279
+//  2 : apply change
280
+int8_t HMI_GetInt(const int32_t lo, const int32_t hi) {
281
+  EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
282
+  if (encoder_diffState != ENCODER_DIFF_NO) {
283
+    if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
284
+      EncoderRate.enabled = false;
285
+      DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Background_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value);
286
+      checkkey = Menu;
287
+      return 2;
288
+    }
289
+    LIMIT(MenuData.Value, lo, hi);
290
+    DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value);
291
+    return 1;
292
+  }
293
+  return 0;
294
+}
295
+
296
+// Set an integer using the encoder
297
+void HMI_SetInt() {
298
+  int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
299
+  switch (val) {
300
+    case 0: return; break;
301
+    case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
302
+    case 2: if (MenuData.Apply) MenuData.Apply(); break;
303
+  }
304
+}
305
+
306
+// Set an integer without drawing
307
+void HMI_SetIntNoDraw() {
308
+  int8_t val = HMI_GetIntNoDraw(MenuData.MinValue, MenuData.MaxValue);
309
+  switch (val) {
310
+    case 0: return; break;
311
+    case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
312
+    case 2: if (MenuData.Apply) MenuData.Apply(); break;
313
+  }
314
+}
315
+
316
+// Set an integer pointer variable using the encoder
317
+void HMI_SetPInt() {
318
+  int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
319
+  switch (val) {
320
+    case 0: return;
321
+    case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
322
+    case 2: *MenuData.P_Int = MenuData.Value; if (MenuData.Apply) MenuData.Apply(); break;
323
+  }
324
+}
325
+
326
+// Get a scaled float value using the encoder
327
+//  dp: decimal places
328
+//  lo: scaled low limit
329
+//  hi: scaled high limit
330
+// Return value:
331
+//  0 : no change
332
+//  1 : live change
333
+//  2 : apply change
334
+int8_t HMI_GetFloat(uint8_t dp, int32_t lo, int32_t hi) {
335
+  EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
336
+  if (encoder_diffState != ENCODER_DIFF_NO) {
337
+    if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
338
+      EncoderRate.enabled = false;
339
+      DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, dp));
340
+      checkkey = Menu;
341
+      return 2;
342
+    }
343
+    LIMIT(MenuData.Value, lo, hi);
344
+    DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, dp));
345
+    return 1;
346
+  }
347
+  return 0;
348
+}
349
+
350
+// Set a scaled float using the encoder
351
+void HMI_SetFloat() {
352
+  const int8_t val = HMI_GetFloat(MenuData.dp, MenuData.MinValue, MenuData.MaxValue);
353
+  switch (val) {
354
+    case 0: return;
355
+    case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
356
+    case 2: if (MenuData.Apply) MenuData.Apply(); break;
357
+  }
358
+}
359
+
360
+// Set a scaled float pointer variable using the encoder
361
+void HMI_SetPFloat() {
362
+  const int8_t val = HMI_GetFloat(MenuData.dp, MenuData.MinValue, MenuData.MaxValue);
363
+  switch (val) {
364
+    case 0: return;
365
+    case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
366
+    case 2: *MenuData.P_Float = MenuData.Value / POW(10, MenuData.dp); if (MenuData.Apply) MenuData.Apply(); break;
367
+  }
368
+}
369
+
370
+#endif // DWIN_LCD_PROUI

+ 94
- 0
Marlin/src/lcd/e3v2/proui/menus.h 파일 보기

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Menu functions for ProUI
25
+ * Author: Miguel A. Risco-Castillo
26
+ * Version: 1.2.1
27
+ * Date: 2022/02/25
28
+ *
29
+ * This program is free software: you can redistribute it and/or modify
30
+ * it under the terms of the GNU Lesser General Public License as
31
+ * published by the Free Software Foundation, either version 3 of the License, or
32
+ * (at your option) any later version.
33
+ *
34
+ * This program is distributed in the hope that it will be useful,
35
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
+ * GNU General Public License for more details.
38
+ *
39
+ * You should have received a copy of the GNU Lesser General Public License
40
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
41
+ *
42
+ */
43
+#pragma once
44
+
45
+#include "dwinui.h"
46
+
47
+typedef struct {
48
+  int32_t MaxValue     = 0;        // Auxiliar max integer/scaled float value
49
+  int32_t MinValue     = 0;        // Auxiliar min integer/scaled float value
50
+  int8_t dp            = 0;        // Auxiliar decimal places
51
+  int32_t Value        = 0;        // Auxiliar integer / scaled float value
52
+  int16_t *P_Int       = nullptr;  // Auxiliar pointer to 16 bit integer variable
53
+  float *P_Float       = nullptr;  // Auxiliar pointer to float variable
54
+  void (*Apply)()      = nullptr;  // Auxiliar apply function
55
+  void (*LiveUpdate)() = nullptr;  // Auxiliar live update function
56
+} MenuData_t;
57
+
58
+extern MenuData_t MenuData;
59
+
60
+// Menuitem Drawing functions =================================================
61
+void Draw_Title(TitleClass* title);
62
+void Draw_Menu(MenuClass* menu);
63
+void Draw_Menu_Cursor(const int8_t line);
64
+void Erase_Menu_Cursor(const int8_t line);
65
+void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false);
66
+void Draw_Chkb_Line(const uint8_t line, const bool checked);
67
+void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0);
68
+void onDrawMenuItem(MenuItemClass* menuitem, int8_t line);
69
+void onDrawSubMenu(MenuItemClass* menuitem, int8_t line);
70
+void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value);
71
+void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line);
72
+void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line);
73
+void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line);
74
+void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value);
75
+void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line);
76
+void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line);
77
+void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked);
78
+
79
+// On click functions =========================================================
80
+void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
81
+void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
82
+void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
83
+void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
84
+void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
85
+void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
86
+void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
87
+
88
+// HMI user control functions =================================================
89
+void HMI_Menu();
90
+void HMI_SetInt();
91
+void HMI_SetPInt();
92
+void HMI_SetIntNoDraw();
93
+void HMI_SetFloat();
94
+void HMI_SetPFloat();

+ 42
- 26
Marlin/src/lcd/e3v2/proui/meshviewer.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN Mesh Viewer
24
+ * Mesh Viewer for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 3.9.1
27
- * Date: 2021/11/09
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * version: 3.12.1
27
+ * Date: 2022/02/24
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
40
 #include "dwin_lcd.h"
38
 #include "dwin_lcd.h"
41
 #include "dwinui.h"
39
 #include "dwinui.h"
42
 #include "dwin.h"
40
 #include "dwin.h"
41
+#include "dwin_popup.h"
43
 #include "../../../feature/bedlevel/bedlevel.h"
42
 #include "../../../feature/bedlevel/bedlevel.h"
44
 
43
 
45
 MeshViewerClass MeshViewer;
44
 MeshViewerClass MeshViewer;
46
 
45
 
47
-void MeshViewerClass::Draw() {
46
+void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey) {
48
   const int8_t mx = 25, my = 25;  // Margins
47
   const int8_t mx = 25, my = 25;  // Margins
49
-  const int16_t stx = (DWIN_WIDTH - 2 * mx) / (GRID_MAX_POINTS_X - 1),  // Steps
50
-                sty = (DWIN_WIDTH - 2 * my) / (GRID_MAX_POINTS_Y - 1);
48
+  const int16_t stx = (DWIN_WIDTH - 2 * mx) / (sizex - 1),  // Steps
49
+                sty = (DWIN_WIDTH - 2 * my) / (sizey - 1);
51
   const int8_t rmax = _MIN(mx - 2, stx / 2);
50
   const int8_t rmax = _MIN(mx - 2, stx / 2);
52
   const int8_t rmin = 7;
51
   const int8_t rmin = 7;
53
-  int16_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-32000, minz = 32000;
52
+  int16_t zmesh[sizex][sizey];
54
   #define px(xp) (mx + (xp) * stx)
53
   #define px(xp) (mx + (xp) * stx)
55
   #define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
54
   #define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
56
   #define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
55
   #define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
57
-  #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 12, py(yp) - 6, zv)
56
+  #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 18, py(yp) - 6, zv)
58
   #define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
57
   #define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
59
-  #define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(GRID_MAX_POINTS_Y - 1), DWIN_WIDTH - 2 * my)
60
-  GRID_LOOP(x, y) {
61
-    const float v = isnan(Z_VALUES(x,y)) ? 0 : round(Z_VALUES(x,y) * 100);
58
+  #define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(sizey - 1), DWIN_WIDTH - 2 * my)
59
+  int16_t maxz =-32000; int16_t minz = 32000; avg = 0;
60
+  LOOP_L_N(y, sizey) LOOP_L_N(x, sizex) {
61
+    const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100);
62
     zmesh[x][y] = v;
62
     zmesh[x][y] = v;
63
+    avg += v;
63
     NOLESS(maxz, v);
64
     NOLESS(maxz, v);
64
     NOMORE(minz, v);
65
     NOMORE(minz, v);
65
   }
66
   }
66
-  Title.ShowCaption(F("Mesh Viewer"));
67
+  max = (float)maxz / 100;
68
+  min = (float)minz / 100;
69
+  avg = avg / (100 * sizex * sizey);
67
   DWINUI::ClearMenuArea();
70
   DWINUI::ClearMenuArea();
68
-  DWINUI::Draw_Icon(ICON_Continue_E, 86, 305);
69
-  DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(GRID_MAX_POINTS_X - 1), py(GRID_MAX_POINTS_Y - 1));
70
-  LOOP_S_L_N(x, 1, GRID_MAX_POINTS_X - 1) DrawMeshVLine(x);
71
-  LOOP_S_L_N(y, 1, GRID_MAX_POINTS_Y - 1) DrawMeshHLine(y);
72
-  LOOP_L_N(y, GRID_MAX_POINTS_Y) {
71
+  DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1));
72
+  LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x);
73
+  LOOP_S_L_N(y, 1, sizey - 1) DrawMeshHLine(y);
74
+  LOOP_L_N(y, sizey) {
73
     watchdog_refresh();
75
     watchdog_refresh();
74
-    LOOP_L_N(x, GRID_MAX_POINTS_X) {
76
+    LOOP_L_N(x, sizex) {
75
       uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz));
77
       uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz));
76
       uint8_t radius = rm(zmesh[x][y]);
78
       uint8_t radius = rm(zmesh[x][y]);
77
       DWINUI::Draw_FillCircle(color, px(x), py(y), radius);
79
       DWINUI::Draw_FillCircle(color, px(x), py(y), radius);
78
-      if (GRID_MAX_POINTS_X < 9)
79
-        DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
80
+      if (sizex < 9)
81
+        DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 18, py(y) - 6, zval[x][y]);
80
       else {
82
       else {
81
         char str_1[9];
83
         char str_1[9];
82
         str_1[0] = 0;
84
         str_1[0] = 0;
83
         switch (zmesh[x][y]) {
85
         switch (zmesh[x][y]) {
84
           case -999 ... -100:
86
           case -999 ... -100:
85
-            DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
87
+            DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, zval[x][y]);
86
             break;
88
             break;
87
           case -99 ... -1:
89
           case -99 ... -1:
88
             sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
90
             sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
94
             sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
96
             sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
95
             break;
97
             break;
96
           case 100 ... 999:
98
           case 100 ... 999:
97
-            DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
99
+            DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, zval[x][y]);
98
             break;
100
             break;
99
         }
101
         }
100
         if (str_1[0])
102
         if (str_1[0])
102
       }
104
       }
103
     }
105
     }
104
   }
106
   }
107
+}
108
+
109
+void MeshViewerClass::Draw(bool withsave /*= false*/) {
110
+  Title.ShowCaption(F("Mesh Viewer"));
111
+  DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
112
+  if (withsave) {
113
+    DWINUI::Draw_Button(BTN_Save, 26, 305);
114
+    DWINUI::Draw_Button(BTN_Continue, 146, 305);
115
+    Draw_Select_Highlight(HMI_flag.select_flag, 305);
116
+  } else DWINUI::Draw_Button(BTN_Continue, 86, 305);
105
   char str_1[6], str_2[6] = "";
117
   char str_1[6], str_2[6] = "";
106
   ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
118
   ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
107
-    dtostrf((float)minz / 100, 1, 2, str_1),
108
-    dtostrf((float)maxz / 100, 1, 2, str_2)
119
+    dtostrf(min, 1, 2, str_1),
120
+    dtostrf(max, 1, 2, str_2)
109
   );
121
   );
110
 }
122
 }
111
 
123
 
124
+void Draw_MeshViewer() { MeshViewer.Draw(true); }
125
+void onClick_MeshViewer() { if (HMI_flag.select_flag) WriteEeprom(); HMI_ReturnScreen(); }
126
+void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer);  else HMI_ReturnScreen(); }
127
+
112
 #endif // DWIN_LCD_PROUI && HAS_MESH
128
 #endif // DWIN_LCD_PROUI && HAS_MESH

+ 11
- 6
Marlin/src/lcd/e3v2/proui/meshviewer.h 파일 보기

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
+#include "../../../core/types.h"
25
+#include "../../../feature/bedlevel/bedlevel.h"
26
+
24
 /**
27
 /**
25
- * DWIN Mesh Viewer
28
+ * Mesh Viewer for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
29
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.9.1
28
- * Date: 2021/11/09
29
- *
30
- * Based on the original code provided by Creality under GPL
30
+ * version: 3.12.1
31
+ * Date: 2022/02/24
31
  */
32
  */
32
 
33
 
33
 class MeshViewerClass {
34
 class MeshViewerClass {
34
 public:
35
 public:
35
-  void Draw();
36
+  float avg, max, min;
37
+  void Draw(bool withsave = false);
38
+  void DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey);
36
 };
39
 };
37
 
40
 
38
 extern MeshViewerClass MeshViewer;
41
 extern MeshViewerClass MeshViewer;
42
+
43
+void Goto_MeshViewer();

+ 10
- 6
Marlin/src/lcd/e3v2/proui/printstats.cpp 파일 보기

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * DWIN Print Stats page
24
+ * Print Stats page for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 1.1
27
- * Date: 2022/01/09
28
- *
29
- * Based on the original code provided by Creality under GPL
26
+ * Version: 1.3.0
27
+ * Date: 2022/02/24
30
  */
28
  */
31
 
29
 
32
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
36
 #include "printstats.h"
34
 #include "printstats.h"
37
 
35
 
38
 #include "../../../core/types.h"
36
 #include "../../../core/types.h"
37
+#include "../../../MarlinCore.h"
39
 #include "../../marlinui.h"
38
 #include "../../marlinui.h"
40
 #include "../../../module/printcounter.h"
39
 #include "../../../module/printcounter.h"
41
 #include "dwin_lcd.h"
40
 #include "dwin_lcd.h"
53
   Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
52
   Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
54
   DWINUI::ClearMenuArea();
53
   DWINUI::ClearMenuArea();
55
   Draw_Popup_Bkgd();
54
   Draw_Popup_Bkgd();
56
-  DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
55
+  DWINUI::Draw_Button(BTN_Continue, 86, 250);
57
   printStatistics ps = print_job_timer.getStats();
56
   printStatistics ps = print_job_timer.getStats();
58
 
57
 
59
   sprintf_P(buf, PSTR(S_FMT ": %i"), GET_TEXT(MSG_INFO_PRINT_COUNT), ps.totalPrints);
58
   sprintf_P(buf, PSTR(S_FMT ": %i"), GET_TEXT(MSG_INFO_PRINT_COUNT), ps.totalPrints);
75
   HMI_AudioFeedback();
74
   HMI_AudioFeedback();
76
 }
75
 }
77
 
76
 
77
+void Goto_PrintStats() {
78
+  PrintStats.Draw();
79
+  HMI_SaveProcessID(WaitResponse);
80
+}
81
+
78
 #endif // DWIN_LCD_PROUI && PRINTCOUNTER
82
 #endif // DWIN_LCD_PROUI && PRINTCOUNTER

+ 6
- 6
Marlin/src/lcd/e3v2/proui/printstats.h 파일 보기

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 /**
24
 /**
25
- * DWIN Print Stats page
25
+ * Print Stats page for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 1.1
28
- * Date: 2022/01/09
29
- *
30
- * Based on the original code provided by Creality under GPL
27
+ * Version: 1.3.0
28
+ * Date: 2022/02/24
31
  */
29
  */
32
 
30
 
33
 class PrintStatsClass {
31
 class PrintStatsClass {
34
 public:
32
 public:
35
-  void Draw();
33
+  static void Draw();
36
   static void Reset();
34
   static void Reset();
37
 };
35
 };
38
 
36
 
39
 extern PrintStatsClass PrintStats;
37
 extern PrintStatsClass PrintStats;
38
+
39
+void Goto_PrintStats();

+ 5
- 1
Marlin/src/lcd/language/language_en.h 파일 보기

151
   LSTR MSG_BED_LEVELING                   = _UxGT("Bed Leveling");
151
   LSTR MSG_BED_LEVELING                   = _UxGT("Bed Leveling");
152
   LSTR MSG_LEVEL_BED                      = _UxGT("Level Bed");
152
   LSTR MSG_LEVEL_BED                      = _UxGT("Level Bed");
153
   LSTR MSG_BED_TRAMMING                   = _UxGT("Bed Tramming");
153
   LSTR MSG_BED_TRAMMING                   = _UxGT("Bed Tramming");
154
+  LSTR MSG_BED_TRAMMING_MANUAL            = _UxGT("Manual Tramming");
154
   LSTR MSG_BED_TRAMMING_RAISE             = _UxGT("Adjust bed until the probe triggers.");
155
   LSTR MSG_BED_TRAMMING_RAISE             = _UxGT("Adjust bed until the probe triggers.");
155
   LSTR MSG_BED_TRAMMING_IN_RANGE          = _UxGT("Corners within tolerance. Bed trammed.");
156
   LSTR MSG_BED_TRAMMING_IN_RANGE          = _UxGT("Corners within tolerance. Bed trammed.");
156
   LSTR MSG_BED_TRAMMING_GOOD_POINTS       = _UxGT("Good Points: ");
157
   LSTR MSG_BED_TRAMMING_GOOD_POINTS       = _UxGT("Good Points: ");
402
   LSTR MSG_ADVANCE_K_E                    = _UxGT("Advance K *");
403
   LSTR MSG_ADVANCE_K_E                    = _UxGT("Advance K *");
403
   LSTR MSG_CONTRAST                       = _UxGT("LCD Contrast");
404
   LSTR MSG_CONTRAST                       = _UxGT("LCD Contrast");
404
   LSTR MSG_BRIGHTNESS                     = _UxGT("LCD Brightness");
405
   LSTR MSG_BRIGHTNESS                     = _UxGT("LCD Brightness");
405
-  LSTR MSG_LCD_BKL_TIMEOUT                = _UxGT("LCD Sleep (s)");
406
+  LSTR MSG_BRIGHTNESS_OFF                 = _UxGT("Turn Off LCD");
406
   LSTR MSG_STORE_EEPROM                   = _UxGT("Store Settings");
407
   LSTR MSG_STORE_EEPROM                   = _UxGT("Store Settings");
407
   LSTR MSG_LOAD_EEPROM                    = _UxGT("Load Settings");
408
   LSTR MSG_LOAD_EEPROM                    = _UxGT("Load Settings");
408
   LSTR MSG_RESTORE_DEFAULTS               = _UxGT("Restore Defaults");
409
   LSTR MSG_RESTORE_DEFAULTS               = _UxGT("Restore Defaults");
429
   LSTR MSG_BUTTON_RESET                   = _UxGT("Reset");
430
   LSTR MSG_BUTTON_RESET                   = _UxGT("Reset");
430
   LSTR MSG_BUTTON_IGNORE                  = _UxGT("Ignore");
431
   LSTR MSG_BUTTON_IGNORE                  = _UxGT("Ignore");
431
   LSTR MSG_BUTTON_CANCEL                  = _UxGT("Cancel");
432
   LSTR MSG_BUTTON_CANCEL                  = _UxGT("Cancel");
433
+  LSTR MSG_BUTTON_CONFIRM                 = _UxGT("Confirm");
434
+  LSTR MSG_BUTTON_CONTINUE                = _UxGT("Continue");
432
   LSTR MSG_BUTTON_DONE                    = _UxGT("Done");
435
   LSTR MSG_BUTTON_DONE                    = _UxGT("Done");
433
   LSTR MSG_BUTTON_BACK                    = _UxGT("Back");
436
   LSTR MSG_BUTTON_BACK                    = _UxGT("Back");
434
   LSTR MSG_BUTTON_PROCEED                 = _UxGT("Proceed");
437
   LSTR MSG_BUTTON_PROCEED                 = _UxGT("Proceed");
438
   LSTR MSG_BUTTON_PAUSE                   = _UxGT("Pause");
441
   LSTR MSG_BUTTON_PAUSE                   = _UxGT("Pause");
439
   LSTR MSG_BUTTON_RESUME                  = _UxGT("Resume");
442
   LSTR MSG_BUTTON_RESUME                  = _UxGT("Resume");
440
   LSTR MSG_BUTTON_ADVANCED                = _UxGT("Advanced");
443
   LSTR MSG_BUTTON_ADVANCED                = _UxGT("Advanced");
444
+  LSTR MSG_BUTTON_SAVE                    = _UxGT("Save");
441
   LSTR MSG_PAUSING                        = _UxGT("Pausing...");
445
   LSTR MSG_PAUSING                        = _UxGT("Pausing...");
442
   LSTR MSG_PAUSE_PRINT                    = _UxGT("Pause Print");
446
   LSTR MSG_PAUSE_PRINT                    = _UxGT("Pause Print");
443
   LSTR MSG_ADVANCED_PAUSE                 = _UxGT("Advanced Pause");
447
   LSTR MSG_ADVANCED_PAUSE                 = _UxGT("Advanced Pause");

+ 4
- 3
Marlin/src/lcd/marlinui.cpp 파일 보기

48
 #if ENABLED(DWIN_CREALITY_LCD)
48
 #if ENABLED(DWIN_CREALITY_LCD)
49
   #include "e3v2/creality/dwin.h"
49
   #include "e3v2/creality/dwin.h"
50
 #elif ENABLED(DWIN_LCD_PROUI)
50
 #elif ENABLED(DWIN_LCD_PROUI)
51
-  #include "fontutils.h"
52
   #include "e3v2/proui/dwin.h"
51
   #include "e3v2/proui/dwin.h"
53
 #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
52
 #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
54
   #include "e3v2/jyersui/dwin.h"
53
   #include "e3v2/jyersui/dwin.h"
1441
       else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
1440
       else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
1442
     #endif
1441
     #endif
1443
 
1442
 
1444
-    else if (!no_welcome)
1445
-      msg = GET_TEXT_F(WELCOME_MSG);
1443
+    else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG);
1444
+
1445
+    else if (ENABLED(DWIN_LCD_PROUI))
1446
+        msg = F("");
1446
     else
1447
     else
1447
       return;
1448
       return;
1448
 
1449
 

+ 5
- 9
Marlin/src/lcd/marlinui.h 파일 보기

367
   static void set_status(FSTR_P const fstr, const int8_t level=0);
367
   static void set_status(FSTR_P const fstr, const int8_t level=0);
368
   static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
368
   static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
369
 
369
 
370
-  #if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
371
-    static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component);
372
-    #if DISABLED(LIGHTWEIGHT_UI)
373
-      static void draw_status_message(const bool blink);
374
-    #endif
375
-  #else
376
-    static void kill_screen(FSTR_P const, FSTR_P const) {}
377
-  #endif
378
-
379
   #if HAS_DISPLAY
370
   #if HAS_DISPLAY
380
 
371
 
381
     static void update();
372
     static void update();
489
     #endif
480
     #endif
490
 
481
 
491
     static void draw_kill_screen();
482
     static void draw_kill_screen();
483
+    static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component);
484
+    #if DISABLED(LIGHTWEIGHT_UI)
485
+      static void draw_status_message(const bool blink);
486
+    #endif
492
 
487
 
493
   #else // No LCD
488
   #else // No LCD
494
 
489
 
495
     static void update() {}
490
     static void update() {}
496
     static void return_to_status() {}
491
     static void return_to_status() {}
492
+    static void kill_screen(FSTR_P const, FSTR_P const) {}
497
 
493
 
498
   #endif
494
   #endif
499
 
495
 

+ 5
- 3
Marlin/src/module/settings.cpp 파일 보기

1467
     //
1467
     //
1468
     #if ENABLED(DWIN_LCD_PROUI)
1468
     #if ENABLED(DWIN_LCD_PROUI)
1469
     {
1469
     {
1470
+      _FIELD_TEST(dwin_data);
1470
       char dwin_data[eeprom_data_size] = { 0 };
1471
       char dwin_data[eeprom_data_size] = { 0 };
1471
       DWIN_StoreSettings(dwin_data);
1472
       DWIN_StoreSettings(dwin_data);
1472
-      _FIELD_TEST(dwin_data);
1473
       EEPROM_WRITE(dwin_data);
1473
       EEPROM_WRITE(dwin_data);
1474
     }
1474
     }
1475
-    #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
1475
+    #endif
1476
+
1477
+    #if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
1476
     {
1478
     {
1479
+      _FIELD_TEST(dwin_settings);
1477
       char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
1480
       char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
1478
       CrealityDWIN.Save_Settings(dwin_settings);
1481
       CrealityDWIN.Save_Settings(dwin_settings);
1479
-      _FIELD_TEST(dwin_settings);
1480
       EEPROM_WRITE(dwin_settings);
1482
       EEPROM_WRITE(dwin_settings);
1481
     }
1483
     }
1482
     #endif
1484
     #endif

+ 3
- 0
Marlin/src/module/stepper.cpp 파일 보기

497
 
497
 
498
 bool Stepper::disable_axis(const AxisEnum axis) {
498
 bool Stepper::disable_axis(const AxisEnum axis) {
499
   mark_axis_disabled(axis);
499
   mark_axis_disabled(axis);
500
+
501
+  TERN_(DWIN_LCD_PROUI, set_axis_untrusted(axis)); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095
502
+
500
   // If all the axes that share the enabled bit are disabled
503
   // If all the axes that share the enabled bit are disabled
501
   const bool can_disable = can_axis_disable(axis);
504
   const bool can_disable = can_axis_disable(axis);
502
   if (can_disable) {
505
   if (can_disable) {

+ 1
- 1
Marlin/src/module/temperature.cpp 파일 보기

821
       hal.idletask();
821
       hal.idletask();
822
 
822
 
823
       // Run UI update
823
       // Run UI update
824
-      TERN(HAS_DWIN_E3V2_BASIC, DWIN_Update(), ui.update());
824
+      TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
825
     }
825
     }
826
     wait_for_heatup = false;
826
     wait_for_heatup = false;
827
 
827
 

+ 1
- 1
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h 파일 보기

235
       #define TFTGLCD_CS                    PA9
235
       #define TFTGLCD_CS                    PA9
236
 
236
 
237
     #endif
237
     #endif
238
-  
238
+
239
   #elif ENABLED(FYSETC_MINI_12864_2_1)
239
   #elif ENABLED(FYSETC_MINI_12864_2_1)
240
 
240
 
241
     #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue."
241
     #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue."

+ 24
- 2
Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h 파일 보기

28
 #include "env_validate.h"
28
 #include "env_validate.h"
29
 
29
 
30
 #if HAS_MULTI_HOTEND || E_STEPPERS > 1
30
 #if HAS_MULTI_HOTEND || E_STEPPERS > 1
31
-  #error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue."
31
+  #error "Creality V24S1 only supports one hotend / E-stepper. Comment out this line to continue."
32
+#endif
33
+
34
+#if BOTH(BLTOUCH, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
35
+  #error "Disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN when using BLTOUCH with Creality V24S1-301."
32
 #endif
36
 #endif
33
 
37
 
34
 #define BOARD_INFO_NAME      "Creality V24S1-301"
38
 #define BOARD_INFO_NAME      "Creality V24S1-301"
44
 //
48
 //
45
 // Limit Switches
49
 // Limit Switches
46
 //
50
 //
47
-#define Z_STOP_PIN                          PC14
51
+#define Z_STOP_PIN                          PA15
48
 
52
 
49
 #ifndef Z_MIN_PROBE_PIN
53
 #ifndef Z_MIN_PROBE_PIN
50
   #define Z_MIN_PROBE_PIN                   PC14  // BLTouch IN
54
   #define Z_MIN_PROBE_PIN                   PC14  // BLTouch IN
63
 #define HEATER_BED_PIN                      PA7   // HOT BED
67
 #define HEATER_BED_PIN                      PA7   // HOT BED
64
 #define FAN1_PIN                            PC0   // extruder fan
68
 #define FAN1_PIN                            PC0   // extruder fan
65
 
69
 
70
+//
71
+// SD Card
72
+//
73
+#define ONBOARD_SPI_DEVICE                  1
74
+#define ONBOARD_SD_CS_PIN                   PA4  // SDSS
75
+
76
+//
77
+// M3/M4/M5 - Spindle/Laser Control
78
+//
79
+#if HAS_CUTTER
80
+  //#define HEATER_0_PIN                    -1
81
+  //#define HEATER_BED_PIN                  -1
82
+  #define FAN_PIN                           -1
83
+  #define SPINDLE_LASER_ENA_PIN             PA0  // FET 1
84
+  #define SPINDLE_LASER_PWM_PIN             PA0  // Bed FET
85
+  #define SPINDLE_DIR_PIN                   PA0  // FET 4
86
+#endif
87
+
66
 #include "pins_CREALITY_V4.h"
88
 #include "pins_CREALITY_V4.h"

+ 7
- 4
Marlin/src/sd/cardreader.cpp 파일 보기

195
 }
195
 }
196
 
196
 
197
 //
197
 //
198
-// Return 'true' if the item is something Marlin can read
198
+// Return 'true' if the item is a folder, G-code file or Binary file
199
 //
199
 //
200
 bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, bool onlyBin/*=false*/)) {
200
 bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, bool onlyBin/*=false*/)) {
201
   //uint8_t pn0 = p.name[0];
201
   //uint8_t pn0 = p.name[0];
212
   ) return false;
212
   ) return false;
213
 
213
 
214
   flag.filenameIsDir = DIR_IS_SUBDIR(&p);               // We know it's a File or Folder
214
   flag.filenameIsDir = DIR_IS_SUBDIR(&p);               // We know it's a File or Folder
215
+  setBinFlag(p.name[8] == 'B' &&                        // List .bin files (a firmware file for flashing)
216
+             p.name[9] == 'I' &&
217
+             p.name[10]== 'N');
215
 
218
 
216
   return (
219
   return (
217
     flag.filenameIsDir                                  // All Directories are ok
220
     flag.filenameIsDir                                  // All Directories are ok
221
+    || fileIsBinary()                                   // BIN files are accepted
218
     || (!onlyBin && p.name[8] == 'G'
222
     || (!onlyBin && p.name[8] == 'G'
219
                  && p.name[9] != '~')                   // Non-backup *.G* files are accepted
223
                  && p.name[9] != '~')                   // Non-backup *.G* files are accepted
220
-    || ( onlyBin && p.name[8]  == 'B'
221
-                 && p.name[9]  == 'I'
222
-                 && p.name[10] == 'N')                  // BIN files are accepted
223
   );
224
   );
224
 }
225
 }
225
 
226
 
867
       strcpy(filename, sortshort[nr]);
868
       strcpy(filename, sortshort[nr]);
868
       strcpy(longFilename, sortnames[nr]);
869
       strcpy(longFilename, sortnames[nr]);
869
       flag.filenameIsDir = IS_DIR(nr);
870
       flag.filenameIsDir = IS_DIR(nr);
871
+      setBinFlag(strcmp_P(strrchr(filename, '.'), PSTR(".BIN")) == 0);
870
       return;
872
       return;
871
     }
873
     }
872
   #endif
874
   #endif
884
         strcpy(filename, sortshort[nr]);
886
         strcpy(filename, sortshort[nr]);
885
         strcpy(longFilename, sortnames[nr]);
887
         strcpy(longFilename, sortnames[nr]);
886
         flag.filenameIsDir = IS_DIR(nr);
888
         flag.filenameIsDir = IS_DIR(nr);
889
+        setBinFlag(strcmp_P(strrchr(filename, '.'), PSTR(".BIN")) == 0);
887
         return;
890
         return;
888
       }
891
       }
889
   #endif
892
   #endif

+ 7
- 0
Marlin/src/sd/cardreader.h 파일 보기

80
        filenameIsDir:1,
80
        filenameIsDir:1,
81
        workDirIsRoot:1,
81
        workDirIsRoot:1,
82
        abort_sd_printing:1
82
        abort_sd_printing:1
83
+       #if DO_LIST_BIN_FILES
84
+         , filenameIsBin:1
85
+       #endif
83
        #if ENABLED(BINARY_FILE_TRANSFER)
86
        #if ENABLED(BINARY_FILE_TRANSFER)
84
          , binary_mode:1
87
          , binary_mode:1
85
        #endif
88
        #endif
218
     static void removeJobRecoveryFile();
221
     static void removeJobRecoveryFile();
219
   #endif
222
   #endif
220
 
223
 
224
+  // Binary flag for the current file
225
+  static bool fileIsBinary() { return TERN0(DO_LIST_BIN_FILES, flag.filenameIsBin); }
226
+  static void setBinFlag(const bool bin) { TERN(DO_LIST_BIN_FILES, flag.filenameIsBin = bin, UNUSED(bin)); }
227
+
221
   // Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
228
   // Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
222
   static char* getWorkDirName()  { workDir.getDosName(filename); return filename; }
229
   static char* getWorkDirName()  { workDir.getDosName(filename); return filename; }
223
   static SdFile& getWorkDir()    { return workDir.isOpen() ? workDir : root; }
230
   static SdFile& getWorkDir()    { return workDir.isOpen() ? workDir : root; }

+ 3
- 2
buildroot/tests/STM32F103RE_creality 파일 보기

15
 
15
 
16
 use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
16
 use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
17
 opt_disable DWIN_CREALITY_LCD
17
 opt_disable DWIN_CREALITY_LCD
18
-opt_enable DWIN_LCD_PROUI BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE
19
-exec_test $1 $2 "Ender 3 v2 with Pro UI" "$3"
18
+opt_enable BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE \
19
+           DWIN_LCD_PROUI SOUND_MENU_ITEM PRINTCOUNTER
20
+exec_test $1 $2 "Ender 3 v2 with ProUI" "$3"
20
 
21
 
21
 use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
22
 use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
22
 opt_disable DWIN_CREALITY_LCD
23
 opt_disable DWIN_CREALITY_LCD

Loading…
취소
저장