Browse Source

🚸 Fix and update ProUI (#24477)

Miguel Risco-Castillo 1 year ago
parent
commit
8fb54d4621
No account linked to committer's email address

+ 2
- 0
Marlin/src/lcd/e3v2/common/dwin_font.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
+typedef uint8_t fontid_t;
25
+
24
 /**
26
 /**
25
  * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
27
  * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
26
  * 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28
28
  * 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28

Marlin/src/lcd/e3v2/proui/ubl_tools.cpp → Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp View File

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * UBL Tools and Mesh Viewer for Pro UI
25
- * Version: 1.0.0
26
- * Date: 2022/04/13
24
+ * Bed Level Tools for Pro UI
25
+ * Extended by: Miguel A. Risco-Castillo (MRISCOC)
26
+ * Version: 2.0.0
27
+ * Date: 2022/05/23
27
  *
28
  *
28
- * Original Author: Henri-J-Norden
29
- * Original Source: https://github.com/Jyers/Marlin/pull/126
29
+ * Based on the original work of: Henri-J-Norden
30
+ * https://github.com/Jyers/Marlin/pull/126
30
  */
31
  */
31
 
32
 
32
 #include "../../../inc/MarlinConfigPre.h"
33
 #include "../../../inc/MarlinConfigPre.h"
34
+#include "bedlevel_tools.h"
33
 
35
 
34
-#if BOTH(DWIN_LCD_PROUI, AUTO_BED_LEVELING_UBL)
36
+#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING)
35
 
37
 
36
-#include "ubl_tools.h"
37
 #include "../../marlinui.h"
38
 #include "../../marlinui.h"
38
 #include "../../../core/types.h"
39
 #include "../../../core/types.h"
39
 #include "dwin.h"
40
 #include "dwin.h"
47
 #include "../../../libs/least_squares_fit.h"
48
 #include "../../../libs/least_squares_fit.h"
48
 #include "../../../libs/vector_3.h"
49
 #include "../../../libs/vector_3.h"
49
 
50
 
50
-UBLMeshToolsClass ubl_tools;
51
+BedLevelToolsClass BedLevelTools;
51
 
52
 
52
-#if ENABLED(USE_UBL_VIEWER)
53
-  bool UBLMeshToolsClass::viewer_asymmetric_range = false;
54
-  bool UBLMeshToolsClass::viewer_print_value = false;
53
+#if USE_UBL_VIEWER
54
+  bool BedLevelToolsClass::viewer_asymmetric_range = false;
55
+  bool BedLevelToolsClass::viewer_print_value = false;
55
 #endif
56
 #endif
56
-bool UBLMeshToolsClass::goto_mesh_value = false;
57
-uint8_t UBLMeshToolsClass::tilt_grid = 1;
57
+bool BedLevelToolsClass::goto_mesh_value = false;
58
+uint8_t BedLevelToolsClass::mesh_x = 0;
59
+uint8_t BedLevelToolsClass::mesh_y = 0;
60
+uint8_t BedLevelToolsClass::tilt_grid = 1;
58
 
61
 
59
 bool drawing_mesh = false;
62
 bool drawing_mesh = false;
60
 char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16];
63
 char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16];
61
 
64
 
62
 #if ENABLED(AUTO_BED_LEVELING_UBL)
65
 #if ENABLED(AUTO_BED_LEVELING_UBL)
63
 
66
 
64
-  void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) {
67
+  void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) {
65
     sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : "");
68
     sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : "");
66
     gcode.process_subcommands_now(cmd);
69
     gcode.process_subcommands_now(cmd);
67
     planner.synchronize();
70
     planner.synchronize();
68
   }
71
   }
69
 
72
 
70
-  bool UBLMeshToolsClass::create_plane_from_mesh() {
73
+  bool BedLevelToolsClass::create_plane_from_mesh() {
71
     struct linear_fit_data lsf_results;
74
     struct linear_fit_data lsf_results;
72
     incremental_LSF_reset(&lsf_results);
75
     incremental_LSF_reset(&lsf_results);
73
     GRID_LOOP(x, y) {
76
     GRID_LOOP(x, y) {
119
 
122
 
120
 #else
123
 #else
121
 
124
 
122
-  void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) {
125
+  void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) {
123
     sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1));
126
     sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1));
124
     gcode.process_subcommands_now(cmd);
127
     gcode.process_subcommands_now(cmd);
125
     planner.synchronize();
128
     planner.synchronize();
127
 
130
 
128
 #endif
131
 #endif
129
 
132
 
130
-void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) {
133
+void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) {
134
+  gcode.process_subcommands_now(F("G28O"));
131
   if (zmove) {
135
   if (zmove) {
132
     planner.synchronize();
136
     planner.synchronize();
133
     current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES;
137
     current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES;
149
   }
153
   }
150
 }
154
 }
151
 
155
 
152
-float UBLMeshToolsClass::get_max_value() {
153
-  float max = __FLT_MIN__;
156
+void BedLevelToolsClass::MoveToXYZ() {
157
+  BedLevelTools.goto_mesh_value = true;
158
+  BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
159
+}
160
+void BedLevelToolsClass::MoveToXY() {
161
+  BedLevelTools.goto_mesh_value = false;
162
+  BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
163
+}
164
+void BedLevelToolsClass::MoveToZ() {
165
+  BedLevelTools.goto_mesh_value = true;
166
+  BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, true);
167
+}
168
+void BedLevelToolsClass::ProbeXY() {
169
+  sprintf_P(cmd, PSTR("G30X%sY%s"),
170
+    dtostrf(bedlevel.get_mesh_x(BedLevelTools.mesh_x), 1, 2, str_1),
171
+    dtostrf(bedlevel.get_mesh_y(BedLevelTools.mesh_y), 1, 2, str_2)
172
+  );
173
+  gcode.process_subcommands_now(cmd);
174
+}
175
+
176
+float BedLevelToolsClass::get_max_value() {
177
+  float max = __FLT_MAX__ * -1;
154
   GRID_LOOP(x, y) {
178
   GRID_LOOP(x, y) {
155
     if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
179
     if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max)
156
       max = bedlevel.z_values[x][y];
180
       max = bedlevel.z_values[x][y];
158
   return max;
182
   return max;
159
 }
183
 }
160
 
184
 
161
-float UBLMeshToolsClass::get_min_value() {
185
+float BedLevelToolsClass::get_min_value() {
162
   float min = __FLT_MAX__;
186
   float min = __FLT_MAX__;
163
   GRID_LOOP(x, y) {
187
   GRID_LOOP(x, y) {
164
     if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
188
     if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min)
167
   return min;
191
   return min;
168
 }
192
 }
169
 
193
 
170
-bool UBLMeshToolsClass::validate() {
171
-  float min = __FLT_MAX__, max = __FLT_MIN__;
194
+bool BedLevelToolsClass::meshvalidate() {
195
+  float min = __FLT_MAX__, max = __FLT_MAX__ * -1;
172
 
196
 
173
   GRID_LOOP(x, y) {
197
   GRID_LOOP(x, y) {
174
     if (isnan(bedlevel.z_values[x][y])) return false;
198
     if (isnan(bedlevel.z_values[x][y])) return false;
175
     if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y];
199
     if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y];
176
     if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y];
200
     if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y];
177
   }
201
   }
178
-  return max <= UBL_Z_OFFSET_MAX && min >= UBL_Z_OFFSET_MIN;
202
+  return WITHIN(max, MESH_Z_OFFSET_MIN, MESH_Z_OFFSET_MAX);
179
 }
203
 }
180
 
204
 
181
-#if ENABLED(USE_UBL_VIEWER)
182
-  void UBLMeshToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) {
205
+#if USE_UBL_VIEWER
206
+
207
+  void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) {
183
     drawing_mesh = true;
208
     drawing_mesh = true;
184
     const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
209
     const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
185
     const uint16_t cell_width_px  = total_width_px / (GRID_MAX_POINTS_X);
210
     const uint16_t cell_width_px  = total_width_px / (GRID_MAX_POINTS_X);
237
     }
262
     }
238
   }
263
   }
239
 
264
 
240
-  void UBLMeshToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead
265
+  void BedLevelToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead
241
     float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max);
266
     float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max);
242
     if (v_min > 3e+10F) v_min = 0.0000001;
267
     if (v_min > 3e+10F) v_min = 0.0000001;
243
     if (v_max > 3e+10F) v_max = 0.0000001;
268
     if (v_max > 3e+10F) v_max = 0.0000001;
255
     ui.set_status(msg);
280
     ui.set_status(msg);
256
     drawing_mesh = false;
281
     drawing_mesh = false;
257
   }
282
   }
258
-#endif
259
 
283
 
260
-#endif // DWIN_LCD_PROUI && AUTO_BED_LEVELING_UBL
284
+#endif // USE_UBL_VIEWER
285
+
286
+#endif // DWIN_LCD_PROUI && HAS_LEVELING

Marlin/src/lcd/e3v2/proui/ubl_tools.h → Marlin/src/lcd/e3v2/proui/bedlevel_tools.h View File

1
-/**
2
- * UBL Tools and Mesh Viewer for Pro UI
3
- * Version: 1.0.0
4
- * Date: 2022/04/13
1
+/*
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
  *
4
  *
6
- * Original Author: Henri-J-Norden (https://github.com/Henri-J-Norden)
7
- * Original Source: https://github.com/Jyers/Marlin/pull/135
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
8
  *
7
  *
9
  * This program is free software: you can redistribute it and/or modify
8
  * This program is free software: you can redistribute it and/or modify
10
  * it under the terms of the GNU General Public License as published by
9
  * it under the terms of the GNU General Public License as published by
20
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
21
  *
20
  *
22
  */
21
  */
22
+
23
+/**
24
+ * Bed Level Tools for Pro UI
25
+ * Extended by: Miguel A. Risco-Castillo (MRISCOC)
26
+ * Version: 2.0.0
27
+ * Date: 2022/05/23
28
+ *
29
+ * Based on the original work of: Henri-J-Norden
30
+ * https://github.com/Jyers/Marlin/pull/126
31
+ */
32
+
23
 #pragma once
33
 #pragma once
24
 
34
 
25
 #include "../../../inc/MarlinConfigPre.h"
35
 #include "../../../inc/MarlinConfigPre.h"
26
 
36
 
27
-//#define USE_UBL_VIEWER 1
37
+#if ENABLED(AUTO_BED_LEVELING_UBL)
38
+  //#define USE_UBL_VIEWER 1
39
+#endif
28
 
40
 
29
-#define UBL_Z_OFFSET_MIN -3.0
30
-#define UBL_Z_OFFSET_MAX  3.0
41
+#define MESH_Z_OFFSET_MIN -3.0
42
+#define MESH_Z_OFFSET_MAX  3.0
31
 
43
 
32
-class UBLMeshToolsClass {
44
+class BedLevelToolsClass {
33
 public:
45
 public:
34
-  #if ENABLED(USE_UBL_VIEWER)
46
+  #if USE_UBL_VIEWER
35
     static bool viewer_asymmetric_range;
47
     static bool viewer_asymmetric_range;
36
     static bool viewer_print_value;
48
     static bool viewer_print_value;
37
   #endif
49
   #endif
38
   static bool goto_mesh_value;
50
   static bool goto_mesh_value;
51
+  static uint8_t mesh_x;
52
+  static uint8_t mesh_y;
39
   static uint8_t tilt_grid;
53
   static uint8_t tilt_grid;
40
 
54
 
41
   #if ENABLED(AUTO_BED_LEVELING_UBL)
55
   #if ENABLED(AUTO_BED_LEVELING_UBL)
45
     static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y);
59
     static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y);
46
   #endif
60
   #endif
47
   static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false);
61
   static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false);
62
+  static void MoveToXYZ();
63
+  static void MoveToXY();
64
+  static void MoveToZ();
65
+  static void ProbeXY();
48
   static float get_max_value();
66
   static float get_max_value();
49
   static float get_min_value();
67
   static float get_min_value();
50
-  static bool validate();
51
-  #if ENABLED(USE_UBL_VIEWER)
68
+  static bool meshvalidate();
69
+  #if USE_UBL_VIEWER
52
     static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
70
     static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
53
     static void Set_Mesh_Viewer_Status();
71
     static void Set_Mesh_Viewer_Status();
54
   #endif
72
   #endif
55
 };
73
 };
56
 
74
 
57
-extern UBLMeshToolsClass ubl_tools;
75
+extern BedLevelToolsClass BedLevelTools;
58
 
76
 
59
 void Goto_MeshViewer();
77
 void Goto_MeshViewer();

+ 114
- 109
Marlin/src/lcd/e3v2/proui/dwin.cpp View File

101
 
101
 
102
 #if HAS_MESH || HAS_ONESTEP_LEVELING
102
 #if HAS_MESH || HAS_ONESTEP_LEVELING
103
   #include "../../../feature/bedlevel/bedlevel.h"
103
   #include "../../../feature/bedlevel/bedlevel.h"
104
+  #include "bedlevel_tools.h"
104
 #endif
105
 #endif
105
 
106
 
106
 #if HAS_BED_PROBE
107
 #if HAS_BED_PROBE
107
   #include "../../../module/probe.h"
108
   #include "../../../module/probe.h"
108
 #endif
109
 #endif
109
 
110
 
110
-#ifdef BLTOUCH_HS_MODE
111
+#if ENABLED(BLTOUCH)
111
   #include "../../../feature/bltouch.h"
112
   #include "../../../feature/bltouch.h"
112
 #endif
113
 #endif
113
 
114
 
114
-#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET)
115
+#if EITHER(BABYSTEPPING, HAS_BED_PROBE)
115
   #define HAS_ZOFFSET_ITEM 1
116
   #define HAS_ZOFFSET_ITEM 1
116
   #if ENABLED(BABYSTEPPING)
117
   #if ENABLED(BABYSTEPPING)
117
     #include "../../../feature/babystep.h"
118
     #include "../../../feature/babystep.h"
141
   #include "meshviewer.h"
142
   #include "meshviewer.h"
142
 #endif
143
 #endif
143
 
144
 
144
-#if ENABLED(AUTO_BED_LEVELING_UBL)
145
-  #include "ubl_tools.h"
146
-#endif
147
-
148
 #if ENABLED(PRINTCOUNTER)
145
 #if ENABLED(PRINTCOUNTER)
149
   #include "printstats.h"
146
   #include "printstats.h"
150
 #endif
147
 #endif
157
   #include "../../../feature/leds/leds.h"
154
   #include "../../../feature/leds/leds.h"
158
 #endif
155
 #endif
159
 
156
 
160
-#include <WString.h>
161
-#include <stdio.h>
162
-#include <string.h>
157
+#if HAS_LOCKSCREEN
158
+  #include "lockscreen.h"
159
+#endif
163
 
160
 
164
 #ifndef MACHINE_SIZE
161
 #ifndef MACHINE_SIZE
165
   #define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
162
   #define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
166
 #endif
163
 #endif
167
 
164
 
168
-#include "lockscreen.h"
169
-
170
 #define PAUSE_HEAT
165
 #define PAUSE_HEAT
171
 
166
 
172
 #define MENU_CHAR_LIMIT  24
167
 #define MENU_CHAR_LIMIT  24
251
     { 1000, 1000, 10, 50 }
246
     { 1000, 1000, 10, 50 }
252
   #endif
247
   #endif
253
 ;
248
 ;
249
+
254
 constexpr float max_acceleration_edit_values[] =
250
 constexpr float max_acceleration_edit_values[] =
255
   #ifdef MAX_ACCEL_EDIT_VALUES
251
   #ifdef MAX_ACCEL_EDIT_VALUES
256
     MAX_ACCEL_EDIT_VALUES
252
     MAX_ACCEL_EDIT_VALUES
258
     { 1000, 1000, 200, 2000 }
254
     { 1000, 1000, 200, 2000 }
259
   #endif
255
   #endif
260
 ;
256
 ;
257
+
261
 #if HAS_CLASSIC_JERK
258
 #if HAS_CLASSIC_JERK
262
   constexpr float max_jerk_edit_values[] =
259
   constexpr float max_jerk_edit_values[] =
263
     #ifdef MAX_JERK_EDIT_VALUES
260
     #ifdef MAX_JERK_EDIT_VALUES
305
 MenuClass *TemperatureMenu = nullptr;
302
 MenuClass *TemperatureMenu = nullptr;
306
 MenuClass *MaxSpeedMenu = nullptr;
303
 MenuClass *MaxSpeedMenu = nullptr;
307
 MenuClass *MaxAccelMenu = nullptr;
304
 MenuClass *MaxAccelMenu = nullptr;
308
-MenuClass *MaxJerkMenu = nullptr;
305
+#if HAS_CLASSIC_JERK
306
+  MenuClass *MaxJerkMenu = nullptr;
307
+#endif
309
 MenuClass *StepsMenu = nullptr;
308
 MenuClass *StepsMenu = nullptr;
310
 MenuClass *HotendPIDMenu = nullptr;
309
 MenuClass *HotendPIDMenu = nullptr;
311
 MenuClass *BedPIDMenu = nullptr;
310
 MenuClass *BedPIDMenu = nullptr;
552
 #endif
551
 #endif
553
 
552
 
554
 // Draw status line
553
 // Draw status line
555
-void DWIN_DrawStatusLine(const char *text) {
556
-  DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
557
-  if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text);
558
-}
559
-
560
-void DWIN_DrawStatusLine(FSTR_P fstr) {
554
+void DWIN_DrawStatusLine() {
561
   DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
555
   DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
562
-  if (fstr) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, fstr);
556
+  DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, ui.status_message);
563
 }
557
 }
564
 
558
 
565
 // Clear & reset status line
559
 // Clear & reset status line
588
     // If the string fits the status line do not scroll it
582
     // If the string fits the status line do not scroll it
589
     if (slen <= LCD_WIDTH) {
583
     if (slen <= LCD_WIDTH) {
590
        if (hash_changed) {
584
        if (hash_changed) {
591
-         DWIN_DrawStatusLine(ui.status_message);
585
+         DWIN_DrawStatusLine();
592
          hash_changed = false;
586
          hash_changed = false;
593
        }
587
        }
594
     }
588
     }
620
 
614
 
621
     if (hash_changed) {
615
     if (hash_changed) {
622
       ui.status_message[LCD_WIDTH] = 0;
616
       ui.status_message[LCD_WIDTH] = 0;
623
-      DWIN_DrawStatusLine(ui.status_message);
617
+      DWIN_DrawStatusLine();
624
       hash_changed = false;
618
       hash_changed = false;
625
     }
619
     }
626
 
620
 
663
 }
657
 }
664
 
658
 
665
 // Update filename on print
659
 // Update filename on print
666
-void DWIN_Print_Header(const char *text = nullptr) {
660
+void DWIN_Print_Header(const char *text=nullptr) {
667
   static char headertxt[31] = "";  // Print header text
661
   static char headertxt[31] = "";  // Print header text
668
   if (text) {
662
   if (text) {
669
     const int8_t size = _MIN(30U, strlen_P(text));
663
     const int8_t size = _MIN(30U, strlen_P(text));
1099
     DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]);
1093
     DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]);
1100
   #endif
1094
   #endif
1101
 
1095
 
1102
-  #if BOTH(BABYSTEPPING, HAS_BED_PROBE)
1096
+  #if HAS_ZOFFSET_ITEM
1103
     DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416);
1097
     DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416);
1104
   #endif
1098
   #endif
1105
 
1099
 
1370
       case ESDiagProcess:        Draw_EndStopDiag(); break;
1364
       case ESDiagProcess:        Draw_EndStopDiag(); break;
1371
     #endif
1365
     #endif
1372
     case Popup:                  popupDraw(); break;
1366
     case Popup:                  popupDraw(); break;
1373
-    case Locked:                 lockScreen.draw(); break;
1367
+    #if HAS_LOCKSCREEN
1368
+      case Locked:               lockScreen.draw(); break;
1369
+    #endif
1374
     case Menu:
1370
     case Menu:
1375
     case SetInt:
1371
     case SetInt:
1376
     case SetPInt:
1372
     case SetPInt:
1377
     case SetIntNoDraw:
1373
     case SetIntNoDraw:
1378
     case SetFloat:
1374
     case SetFloat:
1379
-    case SetPFloat:              ReDrawMenu(); break;
1375
+    case SetPFloat:              ReDrawMenu(true); break;
1380
     default: break;
1376
     default: break;
1381
   }
1377
   }
1382
 }
1378
 }
1567
     case PrintProcess:    HMI_Printing(); break;
1563
     case PrintProcess:    HMI_Printing(); break;
1568
     case Popup:           HMI_Popup(); break;
1564
     case Popup:           HMI_Popup(); break;
1569
     case Leveling:        break;
1565
     case Leveling:        break;
1570
-    case Locked:          HMI_LockScreen(); break;
1566
+    #if HAS_LOCKSCREEN
1567
+      case Locked:        HMI_LockScreen(); break;
1568
+    #endif
1571
     case PrintDone:
1569
     case PrintDone:
1572
     TERN_(HAS_ESDIAG, case ESDiagProcess:)
1570
     TERN_(HAS_ESDIAG, case ESDiagProcess:)
1573
     case WaitResponse:    HMI_WaitForUser(); break;
1571
     case WaitResponse:    HMI_WaitForUser(); break;
1769
   Goto_PrintDone();
1767
   Goto_PrintDone();
1770
 }
1768
 }
1771
 
1769
 
1772
-// Progress Bar update
1770
+// Progress and remaining time update
1773
 void DWIN_M73() {
1771
 void DWIN_M73() {
1774
   if (parser.seenval('P')) {
1772
   if (parser.seenval('P')) {
1775
     _percent_done = parser.value_byte();
1773
     _percent_done = parser.value_byte();
1843
   TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT());
1841
   TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT());
1844
   feedrate_percentage = 100;
1842
   feedrate_percentage = 100;
1845
   TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate());
1843
   TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate());
1846
-  #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
1847
-    // Apply Case light brightness
1848
-    caselight.brightness = HMI_data.CaseLight_Brightness;
1849
-    caselight.update_brightness();
1850
-  #endif
1851
   #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
1844
   #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
1852
     leds.set_color(
1845
     leds.set_color(
1853
       (HMI_data.LED_Color >> 16) & 0xFF,
1846
       (HMI_data.LED_Color >> 16) & 0xFF,
1880
   index_file = MROWS;
1873
   index_file = MROWS;
1881
   hash_changed = true;
1874
   hash_changed = true;
1882
   last_E = 0;
1875
   last_E = 0;
1883
-  DWIN_DrawStatusLine(FSTR_P(nullptr));
1876
+  DWIN_DrawStatusLine();
1884
   DWIN_Draw_Dashboard();
1877
   DWIN_Draw_Dashboard();
1885
   Goto_Main_Menu();
1878
   Goto_Main_Menu();
1886
 }
1879
 }
1935
       case PAUSE_MESSAGE_PARKING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING));    break;                                     // M125
1928
       case PAUSE_MESSAGE_PARKING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING));    break;                                     // M125
1936
       case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT));   break;                                     // pause_print (M125, M600)
1929
       case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT));   break;                                     // pause_print (M125, M600)
1937
       case PAUSE_MESSAGE_WAITING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break;
1930
       case PAUSE_MESSAGE_WAITING:  DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break;
1938
-      case PAUSE_MESSAGE_INSERT:   DWIN_Popup_Continue(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break;
1931
+      case PAUSE_MESSAGE_INSERT:   DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break;
1939
       case PAUSE_MESSAGE_LOAD:     DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD));   break;
1932
       case PAUSE_MESSAGE_LOAD:     DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD));   break;
1940
       case PAUSE_MESSAGE_UNLOAD:   DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break;                                     // Unload of pause and Unload of M702
1933
       case PAUSE_MESSAGE_UNLOAD:   DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break;                                     // Unload of pause and Unload of M702
1941
       case PAUSE_MESSAGE_PURGE:
1934
       case PAUSE_MESSAGE_PURGE:
1988
   }
1981
   }
1989
 #endif // HAS_MESH
1982
 #endif // HAS_MESH
1990
 
1983
 
1991
-void DWIN_LockScreen() {
1992
-  if (checkkey != Locked) {
1993
-    lockScreen.rprocess = checkkey;
1994
-    checkkey = Locked;
1995
-    lockScreen.init();
1984
+
1985
+#if HAS_LOCKSCREEN
1986
+
1987
+  void DWIN_LockScreen() {
1988
+    if (checkkey != Locked) {
1989
+      lockScreen.rprocess = checkkey;
1990
+      checkkey = Locked;
1991
+      lockScreen.init();
1992
+    }
1996
   }
1993
   }
1997
-}
1998
 
1994
 
1999
-void DWIN_UnLockScreen() {
2000
-  if (checkkey == Locked) {
2001
-    checkkey = lockScreen.rprocess;
2002
-    Draw_Main_Area();
1995
+  void DWIN_UnLockScreen() {
1996
+    if (checkkey == Locked) {
1997
+      checkkey = lockScreen.rprocess;
1998
+      Draw_Main_Area();
1999
+    }
2003
   }
2000
   }
2004
-}
2005
 
2001
 
2006
-void HMI_LockScreen() {
2007
-  EncoderState encoder_diffState = get_encoder_state();
2008
-  if (encoder_diffState == ENCODER_DIFF_NO) return;
2009
-  lockScreen.onEncoder(encoder_diffState);
2010
-  if (lockScreen.isUnlocked()) DWIN_UnLockScreen();
2011
-}
2002
+  void HMI_LockScreen() {
2003
+    EncoderState encoder_diffState = get_encoder_state();
2004
+    if (encoder_diffState == ENCODER_DIFF_NO) return;
2005
+    lockScreen.onEncoder(encoder_diffState);
2006
+    if (lockScreen.isUnlocked()) DWIN_UnLockScreen();
2007
+  }
2012
 
2008
 
2009
+#endif //  HAS_LOCKSCREEN
2013
 
2010
 
2014
 #if HAS_GCODE_PREVIEW
2011
 #if HAS_GCODE_PREVIEW
2015
 
2012
 
2051
 
2048
 
2052
 #if ENABLED(EEPROM_SETTINGS)
2049
 #if ENABLED(EEPROM_SETTINGS)
2053
   void WriteEeprom() {
2050
   void WriteEeprom() {
2054
-    DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM));
2051
+    ui.set_status(GET_TEXT_F(MSG_STORE_EEPROM));
2052
+    DWIN_DrawStatusLine();
2055
     DWIN_UpdateLCD();
2053
     DWIN_UpdateLCD();
2056
     DONE_BUZZ(settings.save());
2054
     DONE_BUZZ(settings.save());
2057
   }
2055
   }
2106
 void HomeY() { queue.inject(F("G28Y")); }
2104
 void HomeY() { queue.inject(F("G28Y")); }
2107
 void HomeZ() { queue.inject(F("G28Z")); }
2105
 void HomeZ() { queue.inject(F("G28Z")); }
2108
 
2106
 
2109
-void SetHome() {
2107
+#if HAS_HOME_OFFSET
2110
   // Apply workspace offset, making the current position 0,0,0
2108
   // Apply workspace offset, making the current position 0,0,0
2109
+  void SetHome() {
2111
   queue.inject(F("G92X0Y0Z0"));
2110
   queue.inject(F("G92X0Y0Z0"));
2112
   DONE_BUZZ(true);
2111
   DONE_BUZZ(true);
2113
-}
2112
+  }
2113
+#endif
2114
 
2114
 
2115
 #if HAS_ZOFFSET_ITEM
2115
 #if HAS_ZOFFSET_ITEM
2116
 
2116
 
2132
   void SetMoveZto0() {
2132
   void SetMoveZto0() {
2133
     #if ENABLED(Z_SAFE_HOMING)
2133
     #if ENABLED(Z_SAFE_HOMING)
2134
       char cmd[54], str_1[5], str_2[5];
2134
       char cmd[54], str_1[5], str_2[5];
2135
-      sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300\nM400"),
2135
+      sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nG0Z0F300\nM400"),
2136
         dtostrf(Z_SAFE_HOMING_X_POINT, 1, 1, str_1),
2136
         dtostrf(Z_SAFE_HOMING_X_POINT, 1, 1, str_1),
2137
         dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 1, str_2)
2137
         dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 1, str_2)
2138
       );
2138
       );
2139
       gcode.process_subcommands_now(cmd);
2139
       gcode.process_subcommands_now(cmd);
2140
     #else
2140
     #else
2141
-      gcode.process_subcommands_now(F("G28O\nM420S0\nG0Z0F300\nM400"));
2141
+      set_bed_leveling_enabled(false);
2142
+      gcode.process_subcommands_now(F("G28O\nG0Z0F300\nM400"));
2142
     #endif
2143
     #endif
2143
     ui.reset_status();
2144
     ui.reset_status();
2144
     DONE_BUZZ(true);
2145
     DONE_BUZZ(true);
2145
   }
2146
   }
2146
 
2147
 
2147
-  void HomeZandDisable() {
2148
-    SetMoveZto0();
2149
-    DisableMotors();
2150
-  }
2148
+  #if !HAS_BED_PROBE
2149
+    void HomeZandDisable() {
2150
+      SetMoveZto0();
2151
+      DisableMotors();
2152
+    }
2153
+  #endif
2151
 
2154
 
2152
 #endif // HAS_ZOFFSET_ITEM
2155
 #endif // HAS_ZOFFSET_ITEM
2153
 
2156
 
2840
   DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
2843
   DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
2841
 }
2844
 }
2842
 
2845
 
2843
-#if HAS_FILAMENT_SENSOR
2844
-  void onDrawRunoutEnable(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, runout.enabled); }
2845
-#endif
2846
 
2846
 
2847
 void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
2847
 void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
2848
 void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
2848
 void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast<MenuItemPtrClass*>(menuitem)->value)); }
3249
       MENU_ITEM_F(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats);
3249
       MENU_ITEM_F(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats);
3250
       MENU_ITEM_F(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStats.Reset);
3250
       MENU_ITEM_F(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStats.Reset);
3251
     #endif
3251
     #endif
3252
-    MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen);
3252
+    #if HAS_LOCKSCREEN
3253
+      MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen);
3254
+    #endif
3253
   }
3255
   }
3254
   ui.reset_status(true);
3256
   ui.reset_status(true);
3255
   UpdateMenu(AdvancedSettings);
3257
   UpdateMenu(AdvancedSettings);
3295
       EDIT_ITEM_F(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x);
3297
       EDIT_ITEM_F(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x);
3296
       EDIT_ITEM_F(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y);
3298
       EDIT_ITEM_F(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y);
3297
       EDIT_ITEM_F(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z);
3299
       EDIT_ITEM_F(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z);
3298
-      #ifdef BLTOUCH_HS_MODE
3299
-        EDIT_ITEM_F(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode);
3300
+      #if ENABLED(BLTOUCH)
3301
+        MENU_ITEM_F(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow);
3302
+        MENU_ITEM_F(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy);
3303
+        MENU_ITEM_F(ICON_BltouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset);
3304
+        #ifdef BLTOUCH_HS_MODE
3305
+          EDIT_ITEM_F(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode);
3306
+        #endif
3300
       #endif
3307
       #endif
3301
       MENU_ITEM_F(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest);
3308
       MENU_ITEM_F(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest);
3302
-      MENU_ITEM_F(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow);
3303
-      MENU_ITEM_F(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy);
3304
     }
3309
     }
3305
     UpdateMenu(ProbeSetMenu);
3310
     UpdateMenu(ProbeSetMenu);
3306
   }
3311
   }
3384
 #endif
3389
 #endif
3385
 
3390
 
3386
 #if ENABLED(LED_CONTROL_MENU)
3391
 #if ENABLED(LED_CONTROL_MENU)
3387
-    void Draw_LedControl_Menu() {
3388
-      checkkey = Menu;
3389
-      if (SetMenu(LedControlMenu, GET_TEXT_F(MSG_LED_CONTROL), 6)) {
3390
-        BACK_ITEM(Draw_Control_Menu);
3391
-        #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL)
3392
-          EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on);
3393
-        #endif
3394
-        #if HAS_COLOR_LEDS
3392
+  void Draw_LedControl_Menu() {
3393
+    checkkey = Menu;
3394
+    if (SetMenu(LedControlMenu, GET_TEXT_F(MSG_LED_CONTROL), 6)) {
3395
+      BACK_ITEM(Draw_Control_Menu);
3396
+      #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL)
3397
+        EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on);
3398
+      #endif
3399
+      #if HAS_COLOR_LEDS
3400
+        #if ENABLED(LED_COLOR_PRESETS)
3401
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_WHITE, onDrawMenuItem,  leds.set_white);
3402
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_RED, onDrawMenuItem,    leds.set_red);
3403
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_ORANGE, onDrawMenuItem, leds.set_orange);
3404
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_YELLOW, onDrawMenuItem, leds.set_yellow);
3405
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_GREEN, onDrawMenuItem,  leds.set_green);
3406
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_BLUE, onDrawMenuItem,   leds.set_blue);
3407
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_INDIGO, onDrawMenuItem, leds.set_indigo);
3408
+          MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_VIOLET, onDrawMenuItem, leds.set_violet);
3409
+        #else
3395
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r);
3410
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r);
3396
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g);
3411
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g);
3397
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b);
3412
           EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b);
3399
             EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLedColorW, &leds.color.w);
3414
             EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLedColorW, &leds.color.w);
3400
           #endif
3415
           #endif
3401
         #endif
3416
         #endif
3402
-      }
3403
-      UpdateMenu(LedControlMenu);
3417
+      #endif
3404
     }
3418
     }
3419
+    UpdateMenu(LedControlMenu);
3420
+  }
3405
 #endif
3421
 #endif
3406
 
3422
 
3407
 void Draw_Tune_Menu() {
3423
 void Draw_Tune_Menu() {
3432
     #if ENABLED(FWRETRACT)
3448
     #if ENABLED(FWRETRACT)
3433
       MENU_ITEM_F(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
3449
       MENU_ITEM_F(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu);
3434
     #endif
3450
     #endif
3435
-    MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen);
3451
+    #if HAS_LOCKSCREEN
3452
+      MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen);
3453
+    #endif
3436
     #if HAS_LCD_BRIGHTNESS
3454
     #if HAS_LCD_BRIGHTNESS
3437
       EDIT_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness);
3455
       EDIT_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness);
3438
       MENU_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight);
3456
       MENU_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight);
3750
   #endif
3768
   #endif
3751
 
3769
 
3752
   #if ENABLED(MESH_EDIT_MENU)
3770
   #if ENABLED(MESH_EDIT_MENU)
3753
-    uint8_t mesh_x = 0, mesh_y = 0;
3754
     #define Z_OFFSET_MIN -3
3771
     #define Z_OFFSET_MIN -3
3755
     #define Z_OFFSET_MAX  3
3772
     #define Z_OFFSET_MAX  3
3756
 
3773
 
3757
-    void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); }
3758
-    void ApplyEditMeshX() { mesh_x = MenuData.Value; }
3759
-    void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); }
3760
-    void ApplyEditMeshY() { mesh_y = MenuData.Value; }
3761
-    void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); }
3774
+    void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? BedLevelTools.mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : BedLevelTools.mesh_y]; EditZValueItem->redraw(); }
3775
+    void ApplyEditMeshX() { BedLevelTools.mesh_x = MenuData.Value; }
3776
+    void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, BedLevelTools.mesh_x, ApplyEditMeshX, LiveEditMesh); }
3777
+    void ApplyEditMeshY() { BedLevelTools.mesh_y = MenuData.Value; }
3778
+    void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, BedLevelTools.mesh_y, ApplyEditMeshY, LiveEditMesh); }
3762
     void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); }
3779
     void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); }
3763
   #endif
3780
   #endif
3764
 #endif
3781
 #endif
3772
     onDrawIntMenu(menuitem, line, bedlevel.storage_slot);
3789
     onDrawIntMenu(menuitem, line, bedlevel.storage_slot);
3773
   }
3790
   }
3774
 
3791
 
3775
-  void ApplyUBLTiltGrid() { ubl_tools.tilt_grid = MenuData.Value; }
3776
-  void SetUBLTiltGrid() { SetIntOnClick(1, 3, ubl_tools.tilt_grid, ApplyUBLTiltGrid); }
3792
+  void ApplyUBLTiltGrid() { BedLevelTools.tilt_grid = MenuData.Value; }
3793
+  void SetUBLTiltGrid() { SetIntOnClick(1, 3, BedLevelTools.tilt_grid, ApplyUBLTiltGrid); }
3777
 
3794
 
3778
   void UBLTiltMesh() {
3795
   void UBLTiltMesh() {
3779
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3796
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3780
     char buf[15];
3797
     char buf[15];
3781
-    if (ubl_tools.tilt_grid > 1) {
3782
-      sprintf_P(buf, PSTR("G28O\nG29 J%i"), ubl_tools.tilt_grid);
3798
+    if (BedLevelTools.tilt_grid > 1) {
3799
+      sprintf_P(buf, PSTR("G28O\nG29 J%i"), BedLevelTools.tilt_grid);
3783
       gcode.process_subcommands_now(buf);
3800
       gcode.process_subcommands_now(buf);
3784
     }
3801
     }
3785
     else
3802
     else
3788
   }
3805
   }
3789
 
3806
 
3790
   void UBLSmartFillMesh() {
3807
   void UBLSmartFillMesh() {
3791
-    bedlevel.smart_fill_mesh();
3808
+    LOOP_L_N(x, GRID_MAX_POINTS_Y) bedlevel.smart_fill_mesh();
3792
     LCD_MESSAGE(MSG_UBL_MESH_FILLED);
3809
     LCD_MESSAGE(MSG_UBL_MESH_FILLED);
3793
   }
3810
   }
3794
 
3811
 
3795
-  bool UBLValidMesh() {
3796
-    const bool valid = ubl_tools.validate();
3797
-    if (!valid) bedlevel.invalidate();
3798
-    return valid;
3799
-  }
3800
-
3801
   void UBLSaveMesh() {
3812
   void UBLSaveMesh() {
3802
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3813
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3803
     settings.store_mesh(bedlevel.storage_slot);
3814
     settings.store_mesh(bedlevel.storage_slot);
3808
   void UBLLoadMesh() {
3819
   void UBLLoadMesh() {
3809
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3820
     if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0;
3810
     settings.load_mesh(bedlevel.storage_slot);
3821
     settings.load_mesh(bedlevel.storage_slot);
3811
-    if (UBLValidMesh()) {
3812
-      ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot);
3813
-      DONE_BUZZ(true);
3814
-    }
3815
-    else {
3816
-      LCD_MESSAGE_F("Invalid Mesh Loaded");
3817
-      DONE_BUZZ(false);
3818
-    }
3819
   }
3822
   }
3820
 
3823
 
3821
 #endif // AUTO_BED_LEVELING_UBL
3824
 #endif // AUTO_BED_LEVELING_UBL
3837
         EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot);
3840
         EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot);
3838
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh);
3841
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh);
3839
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh);
3842
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh);
3840
-        EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &ubl_tools.tilt_grid);
3843
+        EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &BedLevelTools.tilt_grid);
3841
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLTiltMesh);
3844
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLTiltMesh);
3842
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh);
3845
         MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh);
3843
       #endif
3846
       #endif
3851
 
3854
 
3852
   #if ENABLED(MESH_EDIT_MENU)
3855
   #if ENABLED(MESH_EDIT_MENU)
3853
     void Draw_EditMesh_Menu() {
3856
     void Draw_EditMesh_Menu() {
3857
+      if (!leveling_is_valid()) { LCD_MESSAGE(MSG_UBL_MESH_INVALID); return; }
3858
+      set_bed_leveling_enabled(false);
3854
       checkkey = Menu;
3859
       checkkey = Menu;
3855
       if (SetMenu(EditMeshMenu, GET_TEXT_F(MSG_EDIT_MESH), 4)) {
3860
       if (SetMenu(EditMeshMenu, GET_TEXT_F(MSG_EDIT_MESH), 4)) {
3856
-        mesh_x = mesh_y = 0;
3861
+        BedLevelTools.mesh_x = BedLevelTools.mesh_y = 0;
3857
         BACK_ITEM(Draw_MeshSet_Menu);
3862
         BACK_ITEM(Draw_MeshSet_Menu);
3858
-        EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &mesh_x);
3859
-        EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &mesh_y);
3860
-        EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &bedlevel.z_values[mesh_x][mesh_y]);
3863
+        EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX,&BedLevelTools.mesh_x);
3864
+        EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY,&BedLevelTools.mesh_y);
3865
+        EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &bedlevel.z_values[BedLevelTools.mesh_x][BedLevelTools.mesh_y]);
3861
       }
3866
       }
3862
       UpdateMenu(EditMeshMenu);
3867
       UpdateMenu(EditMeshMenu);
3863
     }
3868
     }

+ 6
- 5
Marlin/src/lcd/e3v2/proui/dwin.h View File

160
 void Goto_ConfirmToPrint();
160
 void Goto_ConfirmToPrint();
161
 void DWIN_Draw_Dashboard(const bool with_update); // Status Area
161
 void DWIN_Draw_Dashboard(const bool with_update); // Status Area
162
 void Draw_Main_Area();      // Redraw main area
162
 void Draw_Main_Area();      // Redraw main area
163
-void DWIN_DrawStatusLine(const char *text); // Draw simple status text
164
-void DWIN_DrawStatusLine(FSTR_P fstr);
163
+void DWIN_DrawStatusLine(); // Draw simple status text
165
 void DWIN_RedrawDash();     // Redraw Dash and Status line
164
 void DWIN_RedrawDash();     // Redraw Dash and Status line
166
 void DWIN_RedrawScreen();   // Redraw all screen elements
165
 void DWIN_RedrawScreen();   // Redraw all screen elements
167
 void HMI_MainMenu();        // Main process screen
166
 void HMI_MainMenu();        // Main process screen
210
 #endif
209
 #endif
211
 
210
 
212
 // Utility and extensions
211
 // Utility and extensions
213
-void DWIN_LockScreen();
214
-void DWIN_UnLockScreen();
215
-void HMI_LockScreen();
212
+#if HAS_LOCKSCREEN
213
+  void DWIN_LockScreen();
214
+  void DWIN_UnLockScreen();
215
+  void HMI_LockScreen();
216
+#endif
216
 #if HAS_MESH
217
 #if HAS_MESH
217
   void DWIN_MeshViewer();
218
   void DWIN_MeshViewer();
218
 #endif
219
 #endif

+ 5
- 10
Marlin/src/lcd/e3v2/proui/dwin_defines.h View File

28
  * Date: 2022/02/28
28
  * Date: 2022/02/28
29
  */
29
  */
30
 
30
 
31
+#define HAS_GCODE_PREVIEW 1
32
+#define HAS_PIDPLOT 1
33
+#define HAS_ESDIAG 1
34
+#define HAS_LOCKSCREEN 1
31
 //#define DEBUG_DWIN 1
35
 //#define DEBUG_DWIN 1
32
 //#define NEED_HEX_PRINT 1
36
 //#define NEED_HEX_PRINT 1
33
 
37
 
34
 #include "../../../inc/MarlinConfigPre.h"
38
 #include "../../../inc/MarlinConfigPre.h"
39
+#include "../common/dwin_color.h"
35
 #include <stddef.h>
40
 #include <stddef.h>
36
 
41
 
37
-#define HAS_ESDIAG 1
38
-#define HAS_PIDPLOT 1
39
-#define HAS_GCODE_PREVIEW 1
40
 #if defined(__STM32F1__) || defined(STM32F1)
42
 #if defined(__STM32F1__) || defined(STM32F1)
41
   #define DASH_REDRAW 1
43
   #define DASH_REDRAW 1
42
 #endif
44
 #endif
43
 
45
 
44
-#include "../common/dwin_color.h"
45
-#if ENABLED(LED_CONTROL_MENU)
46
-  #include "../../../feature/leds/leds.h"
47
-#endif
48
 
46
 
49
 #define Def_Background_Color  RGB( 1, 12,  8)
47
 #define Def_Background_Color  RGB( 1, 12,  8)
50
 #define Def_Cursor_color      RGB(20, 49, 31)
48
 #define Def_Cursor_color      RGB(20, 49, 31)
65
 #define Def_Indicator_Color   Color_White
63
 #define Def_Indicator_Color   Color_White
66
 #define Def_Coordinate_Color  Color_White
64
 #define Def_Coordinate_Color  Color_White
67
 #define Def_Button_Color      RGB( 0, 23, 16)
65
 #define Def_Button_Color      RGB( 0, 23, 16)
68
-
69
-#define HAS_ESDIAG 1
70
-
71
 #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
66
 #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
72
   #define Def_Leds_Color 0xFFFFFFFF
67
   #define Def_Leds_Color 0xFFFFFFFF
73
 #endif
68
 #endif

+ 27
- 33
Marlin/src/lcd/e3v2/proui/dwinui.cpp View File

23
 /**
23
 /**
24
  * DWIN Enhanced implementation for PRO UI
24
  * DWIN Enhanced implementation for PRO UI
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
25
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
- * Version: 3.17.1
27
- * Date: 2022/04/12
26
+ * Version: 3.18.1
27
+ * Date: 2022/07/05
28
  */
28
  */
29
 
29
 
30
 #include "../../../inc/MarlinConfigPre.h"
30
 #include "../../../inc/MarlinConfigPre.h"
44
 uint16_t DWINUI::textcolor = Def_Text_Color;
44
 uint16_t DWINUI::textcolor = Def_Text_Color;
45
 uint16_t DWINUI::backcolor = Def_Background_Color;
45
 uint16_t DWINUI::backcolor = Def_Background_Color;
46
 uint16_t DWINUI::buttoncolor = Def_Button_Color;
46
 uint16_t DWINUI::buttoncolor = Def_Button_Color;
47
-uint8_t  DWINUI::font = font8x16;
47
+uint8_t  DWINUI::fontid = font8x16;
48
 FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
48
 FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
49
 
49
 
50
 void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr;
50
 void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr;
62
   textcolor = Def_Text_Color;
62
   textcolor = Def_Text_Color;
63
   backcolor = Def_Background_Color;
63
   backcolor = Def_Background_Color;
64
   buttoncolor = Def_Button_Color;
64
   buttoncolor = Def_Button_Color;
65
-  font = font8x16;
65
+  fontid = font8x16;
66
 }
66
 }
67
 
67
 
68
 // Set text/number font
68
 // Set text/number font
69
-void DWINUI::setFont(uint8_t cfont) {
70
-  font = cfont;
71
-}
69
+void DWINUI::setFont(fontid_t fid) { fontid = fid; }
72
 
70
 
73
 // Get font character width
71
 // Get font character width
74
-uint8_t DWINUI::fontWidth(uint8_t cfont) {
75
-  switch (cfont) {
72
+uint8_t DWINUI::fontWidth(fontid_t fid) {
73
+  switch (fid) {
76
     case font6x12 : return 6;
74
     case font6x12 : return 6;
77
     case font8x16 : return 8;
75
     case font8x16 : return 8;
78
     case font10x20: return 10;
76
     case font10x20: return 10;
88
 }
86
 }
89
 
87
 
90
 // Get font character height
88
 // Get font character height
91
-uint8_t DWINUI::fontHeight(uint8_t cfont) {
92
-  switch (cfont) {
89
+uint8_t DWINUI::fontHeight(fontid_t fid) {
90
+  switch (fid) {
93
     case font6x12 : return 12;
91
     case font6x12 : return 12;
94
     case font8x16 : return 16;
92
     case font8x16 : return 16;
95
     case font10x20: return 20;
93
     case font10x20: return 20;
105
 }
103
 }
106
 
104
 
107
 // Get screen x coordinates from text column
105
 // Get screen x coordinates from text column
108
-uint16_t DWINUI::ColToX(uint8_t col) {
109
-  return col * fontWidth(font);
110
-}
106
+uint16_t DWINUI::ColToX(uint8_t col) { return col * fontWidth(fontid); }
111
 
107
 
112
 // Get screen y coordinates from text row
108
 // Get screen y coordinates from text row
113
-uint16_t DWINUI::RowToY(uint8_t row) {
114
-  return row * fontHeight(font);
115
-}
109
+uint16_t DWINUI::RowToY(uint8_t row) { return row * fontHeight(fontid); }
116
 
110
 
117
 // Set text/number color
111
 // Set text/number color
118
 void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
112
 void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
152
 }
146
 }
153
 
147
 
154
 // Draw a Centered string using arbitrary x1 and x2 margins
148
 // Draw a Centered string using arbitrary x1 and x2 margins
155
-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) {
156
-  const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1;
157
-  DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
149
+void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
150
+  const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1;
151
+  DWIN_Draw_String(bShow, fid, color, bColor, x, y, string);
158
 }
152
 }
159
 
153
 
160
 // Draw a char
154
 // Draw a char
164
 //  c: ASCII code of char
158
 //  c: ASCII code of char
165
 void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) {
159
 void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) {
166
   const char string[2] = { c, 0};
160
   const char string[2] = { c, 0};
167
-  DWIN_Draw_String(false, font, color, backcolor, x, y, string, 1);
161
+  DWIN_Draw_String(false, fontid, color, backcolor, x, y, string, 1);
168
 }
162
 }
169
 
163
 
170
 // Draw a char at cursor position and increment cursor
164
 // Draw a char at cursor position and increment cursor
171
 void DWINUI::Draw_Char(uint16_t color, const char c) {
165
 void DWINUI::Draw_Char(uint16_t color, const char c) {
172
   Draw_Char(color, cursor.x, cursor.y, c);
166
   Draw_Char(color, cursor.x, cursor.y, c);
173
-  MoveBy(fontWidth(font), 0);
167
+  MoveBy(fontWidth(fontid), 0);
174
 }
168
 }
175
 
169
 
176
 // Draw a string at cursor position
170
 // Draw a string at cursor position
178
 //  *string: The string
172
 //  *string: The string
179
 //  rlimit: For draw less chars than string length use rlimit
173
 //  rlimit: For draw less chars than string length use rlimit
180
 void DWINUI::Draw_String(const char * const string, uint16_t rlimit) {
174
 void DWINUI::Draw_String(const char * const string, uint16_t rlimit) {
181
-  DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, rlimit);
182
-  MoveBy(strlen(string) * fontWidth(font), 0);
175
+  DWIN_Draw_String(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit);
176
+  MoveBy(strlen(string) * fontWidth(fontid), 0);
183
 }
177
 }
184
 void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) {
178
 void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) {
185
-  DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, rlimit);
186
-  MoveBy(strlen(string) * fontWidth(font), 0);
179
+  DWIN_Draw_String(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit);
180
+  MoveBy(strlen(string) * fontWidth(fontid), 0);
187
 }
181
 }
188
 
182
 
189
 // Draw a numeric integer value
183
 // Draw a numeric integer value
190
 //  bShow: true=display background color; false=don't display background color
184
 //  bShow: true=display background color; false=don't display background color
191
 //  signedMode: 1=signed; 0=unsigned
185
 //  signedMode: 1=signed; 0=unsigned
192
-//  size: Font size
186
+//  fid: Font ID
193
 //  color: Character color
187
 //  color: Character color
194
 //  bColor: Background color
188
 //  bColor: Background color
195
 //  iNum: Number of digits
189
 //  iNum: Number of digits
196
 //  x/y: Upper-left coordinate
190
 //  x/y: Upper-left coordinate
197
 //  value: Integer value
191
 //  value: Integer value
198
-void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) {
192
+void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) {
199
   char nstr[10];
193
   char nstr[10];
200
   sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value);
194
   sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value);
201
-  DWIN_Draw_String(bShow, size, color, bColor, x, y, nstr);
195
+  DWIN_Draw_String(bShow, fid, color, bColor, x, y, nstr);
202
 }
196
 }
203
 
197
 
204
 // Draw a numeric float value
198
 // Draw a numeric float value
205
 //  bShow: true=display background color; false=don't display background color
199
 //  bShow: true=display background color; false=don't display background color
206
 //  signedMode: 1=signed; 0=unsigned
200
 //  signedMode: 1=signed; 0=unsigned
207
-//  size: Font size
201
+//  fid: Font ID
208
 //  color: Character color
202
 //  color: Character color
209
 //  bColor: Background color
203
 //  bColor: Background color
210
 //  iNum: Number of digits
204
 //  iNum: Number of digits
211
 //  fNum: Number of decimal digits
205
 //  fNum: Number of decimal digits
212
 //  x/y: Upper-left coordinate
206
 //  x/y: Upper-left coordinate
213
 //  value: float value
207
 //  value: float value
214
-void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
208
+void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
215
   char nstr[10];
209
   char nstr[10];
216
-  DWIN_Draw_String(bShow, size, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
210
+  DWIN_Draw_String(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
217
 }
211
 }
218
 
212
 
219
 // ------------------------- Buttons ------------------------------//
213
 // ------------------------- Buttons ------------------------------//
220
 
214
 
221
 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) {
215
 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) {
222
   DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2);
216
   DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2);
223
-  Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
217
+  Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
224
 }
218
 }
225
 
219
 
226
 void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
220
 void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {

+ 79
- 78
Marlin/src/lcd/e3v2/proui/dwinui.h View File

24
 /**
24
 /**
25
  * DWIN Enhanced implementation for PRO UI
25
  * DWIN Enhanced implementation for PRO UI
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)
27
- * Version: 3.17.1
28
- * Date: 2022/04/12
27
+ * Version: 3.18.1
28
+ * Date: 2022/07/05
29
  */
29
  */
30
 
30
 
31
 #include "dwin_lcd.h"
31
 #include "dwin_lcd.h"
39
 #define ICON_BedSizeY             ICON_PrintSize
39
 #define ICON_BedSizeY             ICON_PrintSize
40
 #define ICON_BedTramming          ICON_SetHome
40
 #define ICON_BedTramming          ICON_SetHome
41
 #define ICON_Binary               ICON_Contact
41
 #define ICON_Binary               ICON_Contact
42
+#define ICON_BltouchReset         ICON_StockConfiguration
42
 #define ICON_Brightness           ICON_Motion
43
 #define ICON_Brightness           ICON_Motion
43
 #define ICON_Cancel               ICON_StockConfiguration
44
 #define ICON_Cancel               ICON_StockConfiguration
44
 #define ICON_CustomPreheat        ICON_SetEndTemp
45
 #define ICON_CustomPreheat        ICON_SetEndTemp
145
 #define DWIN_FONT_HEAD font10x20
146
 #define DWIN_FONT_HEAD font10x20
146
 #define DWIN_FONT_ALERT font10x20
147
 #define DWIN_FONT_ALERT font10x20
147
 #define STATUS_Y 354
148
 #define STATUS_Y 354
148
-#define LCD_WIDTH (DWIN_WIDTH / 8)  // only if the default font is font8x16
149
+#define LCD_WIDTH (DWIN_WIDTH / 8)  // only if the default fontid is font8x16
149
 
150
 
150
 // Minimum unit (0.1) : multiple (10)
151
 // Minimum unit (0.1) : multiple (10)
151
 #define UNITFDIGITS 1
152
 #define UNITFDIGITS 1
156
                    TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE,  // Total rows
157
                    TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE,  // Total rows
157
                    MROWS = TROWS - 1,                          // Other-than-Back
158
                    MROWS = TROWS - 1,                          // Other-than-Back
158
                    ICOX = 26,                                  // Menu item icon X position
159
                    ICOX = 26,                                  // Menu item icon X position
159
-                   LBLX = 60,                                  // Menu item label X position
160
+                   LBLX = 55,                                  // Menu item label X position
160
                    VALX = 210,                                 // Menu item value X position
161
                    VALX = 210,                                 // Menu item value X position
161
                    MENU_CHR_W = 8, MENU_CHR_H = 16,            // Menu font 8x16
162
                    MENU_CHR_W = 8, MENU_CHR_H = 16,            // Menu font 8x16
162
                    STAT_CHR_W = 10;
163
                    STAT_CHR_W = 10;
196
   extern uint16_t textcolor;
197
   extern uint16_t textcolor;
197
   extern uint16_t backcolor;
198
   extern uint16_t backcolor;
198
   extern uint16_t buttoncolor;
199
   extern uint16_t buttoncolor;
199
-  extern uint8_t  font;
200
+  extern fontid_t fontid;
200
   extern FSTR_P const Author;
201
   extern FSTR_P const Author;
201
 
202
 
202
   extern void (*onTitleDraw)(TitleClass* title);
203
   extern void (*onTitleDraw)(TitleClass* title);
205
   void init();
206
   void init();
206
 
207
 
207
   // Set text/number font
208
   // Set text/number font
208
-  void setFont(uint8_t cfont);
209
+  void setFont(fontid_t cfont);
209
 
210
 
210
   // Get font character width
211
   // Get font character width
211
-  uint8_t fontWidth(uint8_t cfont);
212
-  inline uint8_t fontWidth() { return fontWidth(font); };
212
+  uint8_t fontWidth(fontid_t cfont);
213
+  inline uint8_t fontWidth() { return fontWidth(fontid); };
213
 
214
 
214
   // Get font character height
215
   // Get font character height
215
-  uint8_t fontHeight(uint8_t cfont);
216
-  inline uint8_t fontHeight() { return fontHeight(font); };
216
+  uint8_t fontHeight(fontid_t cfont);
217
+  inline uint8_t fontHeight() { return fontHeight(fontid); };
217
 
218
 
218
   // Get screen x coordinates from text column
219
   // Get screen x coordinates from text column
219
   uint16_t ColToX(uint8_t col);
220
   uint16_t ColToX(uint8_t col);
278
   // Draw a numeric integer value
279
   // Draw a numeric integer value
279
   //  bShow: true=display background color; false=don't display background color
280
   //  bShow: true=display background color; false=don't display background color
280
   //  signedMode: 1=signed; 0=unsigned
281
   //  signedMode: 1=signed; 0=unsigned
281
-  //  size: Font size
282
+  //  fid: Font ID
282
   //  color: Character color
283
   //  color: Character color
283
   //  bColor: Background color
284
   //  bColor: Background color
284
   //  iNum: Number of digits
285
   //  iNum: Number of digits
285
   //  x/y: Upper-left coordinate
286
   //  x/y: Upper-left coordinate
286
   //  value: Integer value
287
   //  value: Integer value
287
-  void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value);
288
+  void Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value);
288
 
289
 
289
   // Draw a positive integer
290
   // Draw a positive integer
290
-  inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
291
-    Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value);
291
+  inline void Draw_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
292
+    Draw_Int(bShow, 0, fid, color, bColor, iNum, x, y, value);
292
   }
293
   }
293
   inline void Draw_Int(uint8_t iNum, long value) {
294
   inline void Draw_Int(uint8_t iNum, long value) {
294
-    Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
295
-    MoveBy(iNum * fontWidth(font), 0);
295
+    Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
296
+    MoveBy(iNum * fontWidth(fontid), 0);
296
   }
297
   }
297
   inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
298
   inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
298
-    Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value);
299
+    Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, x, y, value);
299
   }
300
   }
300
   inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
301
   inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
301
-    Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value);
302
+    Draw_Int(false, 0, fontid, color, backcolor, iNum, x, y, value);
302
   }
303
   }
303
   inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
304
   inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
304
-    Draw_Int(true, 0, font, color, bColor, iNum, x, y, value);
305
+    Draw_Int(true, 0, fontid, color, bColor, iNum, x, y, value);
305
   }
306
   }
306
-  inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
307
-    Draw_Int(true, 0, size, color, bColor, iNum, x, y, value);
307
+  inline void Draw_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
308
+    Draw_Int(true, 0, fid, color, bColor, iNum, x, y, value);
308
   }
309
   }
309
 
310
 
310
   // Draw a signed integer
311
   // Draw a signed integer
311
-  inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
312
-    Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value);
312
+  inline void Draw_Signed_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
313
+    Draw_Int(bShow, 1, fid, color, bColor, iNum, x, y, value);
313
   }
314
   }
314
   inline void Draw_Signed_Int(uint8_t iNum, long value) {
315
   inline void Draw_Signed_Int(uint8_t iNum, long value) {
315
-    Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
316
-    MoveBy(iNum * fontWidth(font), 0);
316
+    Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
317
+    MoveBy(iNum * fontWidth(fontid), 0);
317
   }
318
   }
318
   inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
319
   inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
319
-    Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value);
320
+    Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, x, y, value);
320
   }
321
   }
321
   inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
322
   inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
322
-    Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value);
323
+    Draw_Int(false, 1, fontid, color, backcolor, iNum, x, y, value);
323
   }
324
   }
324
   inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
325
   inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
325
-    Draw_Int(true, 1, font, color, bColor, iNum, x, y, value);
326
+    Draw_Int(true, 1, fontid, color, bColor, iNum, x, y, value);
326
   }
327
   }
327
-  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) {
328
-    Draw_Int(true, 1, size, color, bColor, iNum, x, y, value);
328
+  inline void Draw_Signed_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
329
+    Draw_Int(true, 1, fid, color, bColor, iNum, x, y, value);
329
   }
330
   }
330
 
331
 
331
   // Draw a numeric float value
332
   // Draw a numeric float value
332
   //  bShow: true=display background color; false=don't display background color
333
   //  bShow: true=display background color; false=don't display background color
333
   //  signedMode: 1=signed; 0=unsigned
334
   //  signedMode: 1=signed; 0=unsigned
334
-  //  size: Font size
335
+  //  fid: Font ID
335
   //  color: Character color
336
   //  color: Character color
336
   //  bColor: Background color
337
   //  bColor: Background color
337
   //  iNum: Number of digits
338
   //  iNum: Number of digits
338
   //  fNum: Number of decimal digits
339
   //  fNum: Number of decimal digits
339
   //  x/y: Upper-left coordinate
340
   //  x/y: Upper-left coordinate
340
   //  value: float value
341
   //  value: float value
341
-  void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
342
+  void Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
342
 
343
 
343
   // Draw a positive floating point number
344
   // Draw a positive floating point number
344
-  inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
345
-    Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value);
345
+  inline void Draw_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
346
+    Draw_Float(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value);
346
   }
347
   }
347
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
348
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
348
-    Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
349
-    MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
349
+    Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
350
+    MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0);
350
   }
351
   }
351
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
352
   inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
352
-    Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
353
+    Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, x, y, value);
353
   }
354
   }
354
-  inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
355
-    Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
355
+  inline void Draw_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
356
+    Draw_Float(false, 0, fid, textcolor, backcolor, iNum, fNum, x, y, value);
356
   }
357
   }
357
   inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
358
   inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
358
-    Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value);
359
+    Draw_Float(true, 0, fontid, color, bColor, iNum, fNum, x, y, value);
359
   }
360
   }
360
-  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) {
361
-    Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value);
361
+  inline void Draw_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
362
+    Draw_Float(true, 0, fid, color, bColor, iNum, fNum, x, y, value);
362
   }
363
   }
363
 
364
 
364
   // Draw a signed floating point number
365
   // Draw a signed floating point number
365
-  inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
366
-    Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value);
366
+  inline void Draw_Signed_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
367
+    Draw_Float(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value);
367
   }
368
   }
368
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
369
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
369
-    Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
370
-    MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
370
+    Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
371
+    MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0);
371
   }
372
   }
372
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
373
   inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
373
-    Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value);
374
+    Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, x, y, value);
374
   }
375
   }
375
-  inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
376
-    Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value);
376
+  inline void Draw_Signed_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
377
+    Draw_Float(false, 1, fid, textcolor, backcolor, iNum, fNum, x, y, value);
377
   }
378
   }
378
   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) {
379
   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) {
379
-    Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value);
380
+    Draw_Float(true, 1, fontid, color, bColor, iNum, fNum, x, y, value);
380
   }
381
   }
381
-  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) {
382
-    Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value);
382
+  inline void Draw_Signed_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
383
+    Draw_Float(true, 1, fid, color, bColor, iNum, fNum, x, y, value);
383
   }
384
   }
384
 
385
 
385
   // Draw a char
386
   // Draw a char
407
   }
408
   }
408
 
409
 
409
   // Draw a string
410
   // Draw a string
410
-  //  size: Font size
411
+  //  fid: Font ID
411
   //  color: Character color
412
   //  color: Character color
412
   //  bColor: Background color
413
   //  bColor: Background color
413
   //  x/y: Upper-left coordinate of the string
414
   //  x/y: Upper-left coordinate of the string
414
   //  *string: The string
415
   //  *string: The string
415
   inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
416
   inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
416
-    DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string);
417
+    DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, string);
417
   }
418
   }
418
   inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
419
   inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
419
-    DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title));
420
+    DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, FTOP(title));
420
   }
421
   }
421
   inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
422
   inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
422
-    DWIN_Draw_String(false, font, color, backcolor, x, y, string);
423
+    DWIN_Draw_String(false, fontid, color, backcolor, x, y, string);
423
   }
424
   }
424
   inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
425
   inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
425
-    DWIN_Draw_String(false, font, color, backcolor, x, y, title);
426
+    DWIN_Draw_String(false, fontid, color, backcolor, x, y, title);
426
   }
427
   }
427
   inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
428
   inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
428
-    DWIN_Draw_String(true, font, color, bgcolor, x, y, string);
429
+    DWIN_Draw_String(true, fontid, color, bgcolor, x, y, string);
429
   }
430
   }
430
   inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
431
   inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
431
-    DWIN_Draw_String(true, font, color, bgcolor, x, y, title);
432
+    DWIN_Draw_String(true, fontid, color, bgcolor, x, y, title);
432
   }
433
   }
433
-  inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
434
-    DWIN_Draw_String(true, size, color, bgcolor, x, y, string);
434
+  inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
435
+    DWIN_Draw_String(true, fid, color, bgcolor, x, y, string);
435
   }
436
   }
436
-  inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
437
-    DWIN_Draw_String(true, size, color, bgcolor, x, y, title);
437
+  inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
438
+    DWIN_Draw_String(true, fid, color, bgcolor, x, y, title);
438
   }
439
   }
439
 
440
 
440
   // Draw a centered string using DWIN_WIDTH
441
   // Draw a centered string using DWIN_WIDTH
441
   //  bShow: true=display background color; false=don't display background color
442
   //  bShow: true=display background color; false=don't display background color
442
-  //  size: Font size
443
+  //  fid: Font ID
443
   //  color: Character color
444
   //  color: Character color
444
   //  bColor: Background color
445
   //  bColor: Background color
445
   //  y: Upper coordinate of the string
446
   //  y: Upper coordinate of the string
446
   //  *string: The string
447
   //  *string: The string
447
-  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);
448
-  inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
449
-    Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string);
448
+  void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
449
+  inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
450
+    Draw_CenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string);
450
   }
451
   }
451
-  inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
452
-    Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
452
+  inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
453
+    Draw_CenteredString(bShow, fid, color, bColor, y, FTOP(string));
453
   }
454
   }
454
   inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
455
   inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
455
-    Draw_CenteredString(true, font, color, bcolor, y, string);
456
+    Draw_CenteredString(true, fontid, color, bcolor, y, string);
456
   }
457
   }
457
-  inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) {
458
-    Draw_CenteredString(false, size, color, backcolor, y, string);
458
+  inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) {
459
+    Draw_CenteredString(false, fid, color, backcolor, y, string);
459
   }
460
   }
460
-  inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) {
461
-    Draw_CenteredString(false, size, color, backcolor, y, title);
461
+  inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P title) {
462
+    Draw_CenteredString(false, fid, color, backcolor, y, title);
462
   }
463
   }
463
   inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
464
   inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
464
-    Draw_CenteredString(false, font, color, backcolor, y, string);
465
+    Draw_CenteredString(false, fontid, color, backcolor, y, string);
465
   }
466
   }
466
   inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
467
   inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
467
-    Draw_CenteredString(false, font, color, backcolor, y, title);
468
+    Draw_CenteredString(false, fontid, color, backcolor, y, title);
468
   }
469
   }
469
   inline void Draw_CenteredString(uint16_t y, const char * const string) {
470
   inline void Draw_CenteredString(uint16_t y, const char * const string) {
470
-    Draw_CenteredString(false, font, textcolor, backcolor, y, string);
471
+    Draw_CenteredString(false, fontid, textcolor, backcolor, y, string);
471
   }
472
   }
472
   inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
473
   inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
473
-    Draw_CenteredString(false, font, textcolor, backcolor, y, title);
474
+    Draw_CenteredString(false, fontid, textcolor, backcolor, y, title);
474
   }
475
   }
475
 
476
 
476
   // Draw a box
477
   // Draw a box

+ 6
- 2
Marlin/src/lcd/e3v2/proui/lockscreen.cpp View File

31
 
31
 
32
 #if ENABLED(DWIN_LCD_PROUI)
32
 #if ENABLED(DWIN_LCD_PROUI)
33
 
33
 
34
-#include "../../../core/types.h"
35
-#include "dwin_lcd.h"
34
+#include "dwin_defines.h"
35
+
36
+#if HAS_LOCKSCREEN
37
+
36
 #include "dwinui.h"
38
 #include "dwinui.h"
37
 #include "dwin.h"
39
 #include "dwin.h"
38
 #include "lockscreen.h"
40
 #include "lockscreen.h"
73
   DWIN_UpdateLCD();
75
   DWIN_UpdateLCD();
74
 }
76
 }
75
 
77
 
78
+#endif // HAS_LOCKSCREEN
79
+
76
 #endif // DWIN_LCD_PROUI
80
 #endif // DWIN_LCD_PROUI

+ 20
- 6
Marlin/src/lcd/e3v2/proui/menus.cpp View File

23
 /**
23
 /**
24
  * Menu functions for ProUI
24
  * Menu functions for ProUI
25
  * Author: Miguel A. Risco-Castillo
25
  * Author: Miguel A. Risco-Castillo
26
- * Version: 1.4.1
27
- * Date: 2022/04/14
26
+ * Version: 1.5.1
27
+ * Date: 2022/05/23
28
  *
28
  *
29
  * This program is free software: you can redistribute it and/or modify
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
30
  * it under the terms of the GNU Lesser General Public License as
166
   onDrawChkbMenu(menuitem, line, val);
166
   onDrawChkbMenu(menuitem, line, val);
167
 }
167
 }
168
 
168
 
169
+void DrawItemEdit() {
170
+  switch (checkkey) {
171
+    case SetIntNoDraw:  if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
172
+    case SetInt:
173
+    case SetPInt:       DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break;
174
+    case SetFloat:
175
+    case SetPFloat:     DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, MenuData.dp, VALX - MenuData.dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break;
176
+    default: break;
177
+  }
178
+}
179
+
169
 //-----------------------------------------------------------------------------
180
 //-----------------------------------------------------------------------------
170
 // On click functions
181
 // On click functions
171
 //-----------------------------------------------------------------------------
182
 //-----------------------------------------------------------------------------
307
       return 2;
318
       return 2;
308
     }
319
     }
309
     LIMIT(MenuData.Value, lo, hi);
320
     LIMIT(MenuData.Value, lo, hi);
310
-    DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value);
321
+    DrawItemEdit();
311
     return 1;
322
     return 1;
312
   }
323
   }
313
   return 0;
324
   return 0;
361
       return 2;
372
       return 2;
362
     }
373
     }
363
     LIMIT(MenuData.Value, lo, hi);
374
     LIMIT(MenuData.Value, lo, hi);
364
-    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));
375
+    DrawItemEdit();
365
     return 1;
376
     return 1;
366
   }
377
   }
367
   return 0;
378
   return 0;
469
 }
480
 }
470
 
481
 
471
 void MenuItemClass::draw(int8_t line) {
482
 void MenuItemClass::draw(int8_t line) {
472
-  if (line < 0 || line >= TROWS) return;
483
+  if (!WITHIN(line, 0, TROWS - 1)) return;
473
   if (onDraw != nullptr) (*onDraw)(this, line);
484
   if (onDraw != nullptr) (*onDraw)(this, line);
474
 };
485
 };
475
 
486
 
547
   menu->draw();
558
   menu->draw();
548
 }
559
 }
549
 
560
 
550
-void ReDrawMenu() { if (CurrentMenu && checkkey==Menu) CurrentMenu->draw(); }
561
+void ReDrawMenu(const bool force/*=false*/) {
562
+  if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw();
563
+  if (force) DrawItemEdit();
564
+}
551
 
565
 
552
 #endif // DWIN_LCD_PROUI
566
 #endif // DWIN_LCD_PROUI

+ 3
- 3
Marlin/src/lcd/e3v2/proui/menus.h View File

23
 /**
23
 /**
24
  * Menu functions for ProUI
24
  * Menu functions for ProUI
25
  * Author: Miguel A. Risco-Castillo
25
  * Author: Miguel A. Risco-Castillo
26
- * Version: 1.4.1
27
- * Date: 2022/04/14
26
+ * Version: 1.5.1
27
+ * Date: 2022/05/23
28
  *
28
  *
29
  * This program is free software: you can redistribute it and/or modify
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
30
  * it under the terms of the GNU Lesser General Public License as
168
 void UpdateMenu(MenuClass* &menu);
168
 void UpdateMenu(MenuClass* &menu);
169
 
169
 
170
 //Redraw the current Menu if it is valid
170
 //Redraw the current Menu if it is valid
171
-void ReDrawMenu();
171
+void ReDrawMenu(const bool force=false);
172
 
172
 
173
 // Clear MenuItems array and free MenuItems elements
173
 // Clear MenuItems array and free MenuItems elements
174
 void MenuItemsClear();
174
 void MenuItemsClear();

+ 7
- 8
Marlin/src/lcd/e3v2/proui/meshviewer.cpp View File

31
 
31
 
32
 #if BOTH(DWIN_LCD_PROUI, HAS_MESH)
32
 #if BOTH(DWIN_LCD_PROUI, HAS_MESH)
33
 
33
 
34
-#include "meshviewer.h"
35
-
36
 #include "../../../core/types.h"
34
 #include "../../../core/types.h"
37
 #include "../../marlinui.h"
35
 #include "../../marlinui.h"
38
 #include "dwin_lcd.h"
36
 #include "dwin_lcd.h"
40
 #include "dwin.h"
38
 #include "dwin.h"
41
 #include "dwin_popup.h"
39
 #include "dwin_popup.h"
42
 #include "../../../feature/bedlevel/bedlevel.h"
40
 #include "../../../feature/bedlevel/bedlevel.h"
41
+#include "meshviewer.h"
43
 
42
 
44
 #if ENABLED(AUTO_BED_LEVELING_UBL)
43
 #if ENABLED(AUTO_BED_LEVELING_UBL)
45
-  #include "ubl_tools.h"
44
+  #include "bedlevel_tools.h"
46
 #endif
45
 #endif
47
 
46
 
48
 MeshViewerClass MeshViewer;
47
 MeshViewerClass MeshViewer;
112
 
111
 
113
 void MeshViewerClass::Draw(bool withsave /*= false*/) {
112
 void MeshViewerClass::Draw(bool withsave /*= false*/) {
114
   Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
113
   Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
115
-  #if ENABLED(USE_UBL_VIEWER)
114
+  #if USE_UBL_VIEWER
116
     DWINUI::ClearMainArea();
115
     DWINUI::ClearMainArea();
117
-    ubl_tools.viewer_print_value = true;
118
-    ubl_tools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
116
+    BedLevelTools.viewer_print_value = true;
117
+    BedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
119
   #else
118
   #else
120
     DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
119
     DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
121
   #endif
120
   #endif
127
   else
126
   else
128
     DWINUI::Draw_Button(BTN_Continue, 86, 305);
127
     DWINUI::Draw_Button(BTN_Continue, 86, 305);
129
 
128
 
130
-  #if ENABLED(USE_UBL_VIEWER)
131
-    ubl_tools.Set_Mesh_Viewer_Status();
129
+  #if USE_UBL_VIEWER
130
+    BedLevelTools.Set_Mesh_Viewer_Status();
132
   #else
131
   #else
133
     char str_1[6], str_2[6] = "";
132
     char str_1[6], str_2[6] = "";
134
     ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
133
     ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),

+ 0
- 3
Marlin/src/lcd/e3v2/proui/meshviewer.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#include "../../../core/types.h"
25
-#include "../../../feature/bedlevel/bedlevel.h"
26
-
27
 /**
24
 /**
28
  * Mesh Viewer for PRO UI
25
  * Mesh Viewer for PRO UI
29
  * Author: Miguel A. Risco-Castillo (MRISCOC)
26
  * Author: Miguel A. Risco-Castillo (MRISCOC)

+ 7
- 2
Marlin/src/lcd/e3v2/proui/plot.cpp View File

46
 
46
 
47
 #ifdef DWIN_LCD_PROUI
47
 #ifdef DWIN_LCD_PROUI
48
 
48
 
49
+#include "dwin_defines.h"
50
+
51
+#if HAS_PIDPLOT
52
+
49
 #include "plot.h"
53
 #include "plot.h"
50
 
54
 
51
 #include "../../../core/types.h"
55
 #include "../../../core/types.h"
52
 #include "../../marlinui.h"
56
 #include "../../marlinui.h"
53
 #include "dwin_lcd.h"
57
 #include "dwin_lcd.h"
54
 #include "dwinui.h"
58
 #include "dwinui.h"
55
-#include "dwin_popup.h"
56
 #include "dwin.h"
59
 #include "dwin.h"
57
 
60
 
58
 #define Plot_Bg_Color RGB( 1, 12,  8)
61
 #define Plot_Bg_Color RGB( 1, 12,  8)
71
   y2 = frame.y + frame.h - 1;
74
   y2 = frame.y + frame.h - 1;
72
   r = round((y2) - ref * scale);
75
   r = round((y2) - ref * scale);
73
   DWINUI::Draw_Box(1, Plot_Bg_Color, frame);
76
   DWINUI::Draw_Box(1, Plot_Bg_Color, frame);
74
-  for (uint8_t i = 1; i < 4; i++)  if (i*50 < frame.w) DWIN_Draw_VLine(Line_Color, i*50 + frame.x, frame.y, frame.h);
77
+  for (uint8_t i = 1; i < 4; i++)  if (i * 50 < frame.w) DWIN_Draw_VLine(Line_Color, i * 50 + frame.x, frame.y, frame.h);
75
   DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1));
78
   DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1));
76
   DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w);
79
   DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w);
77
 }
80
 }
91
   grphpoints++;
94
   grphpoints++;
92
 }
95
 }
93
 
96
 
97
+#endif // HAS_PIDPLOT
98
+
94
 #endif // DWIN_LCD_PROUI
99
 #endif // DWIN_LCD_PROUI

+ 1
- 0
Marlin/src/lcd/language/language_en.h View File

254
   LSTR MSG_UBL_SMART_FILLIN               = _UxGT("Smart Fill-in");
254
   LSTR MSG_UBL_SMART_FILLIN               = _UxGT("Smart Fill-in");
255
   LSTR MSG_UBL_FILLIN_MESH                = _UxGT("Fill-in Mesh");
255
   LSTR MSG_UBL_FILLIN_MESH                = _UxGT("Fill-in Mesh");
256
   LSTR MSG_UBL_MESH_FILLED                = _UxGT("Missing Points Filled");
256
   LSTR MSG_UBL_MESH_FILLED                = _UxGT("Missing Points Filled");
257
+  LSTR MSG_UBL_MESH_INVALID               = _UxGT("Invalid Mesh");
257
   LSTR MSG_UBL_INVALIDATE_ALL             = _UxGT("Invalidate All");
258
   LSTR MSG_UBL_INVALIDATE_ALL             = _UxGT("Invalidate All");
258
   LSTR MSG_UBL_INVALIDATE_CLOSEST         = _UxGT("Invalidate Closest");
259
   LSTR MSG_UBL_INVALIDATE_CLOSEST         = _UxGT("Invalidate Closest");
259
   LSTR MSG_UBL_FINE_TUNE_ALL              = _UxGT("Fine Tune All");
260
   LSTR MSG_UBL_FINE_TUNE_ALL              = _UxGT("Fine Tune All");

+ 1
- 1
Marlin/src/module/planner.h View File

188
  * The "nominal" values are as-specified by G-code, and
188
  * The "nominal" values are as-specified by G-code, and
189
  * may never actually be reached due to acceleration limits.
189
  * may never actually be reached due to acceleration limits.
190
  */
190
  */
191
-typedef struct block_t {
191
+typedef struct PlannerBlock {
192
 
192
 
193
   volatile block_flags_t flag;              // Block flags
193
   volatile block_flags_t flag;              // Block flags
194
 
194
 

+ 12
- 1
Marlin/src/module/settings.cpp View File

76
   #include "../lcd/extui/ui_api.h"
76
   #include "../lcd/extui/ui_api.h"
77
 #elif ENABLED(DWIN_LCD_PROUI)
77
 #elif ENABLED(DWIN_LCD_PROUI)
78
   #include "../lcd/e3v2/proui/dwin.h"
78
   #include "../lcd/e3v2/proui/dwin.h"
79
+  #include "../lcd/e3v2/proui/bedlevel_tools.h"
79
 #endif
80
 #endif
80
 
81
 
81
 #if ENABLED(HOST_PROMPT_SUPPORT)
82
 #if ENABLED(HOST_PROMPT_SUPPORT)
2756
         #endif
2757
         #endif
2757
 
2758
 
2758
         persistentStore.access_start();
2759
         persistentStore.access_start();
2759
-        const uint16_t status = persistentStore.read_data(pos, dest, MESH_STORE_SIZE, &crc);
2760
+        uint16_t status = persistentStore.read_data(pos, dest, MESH_STORE_SIZE, &crc);
2760
         persistentStore.access_finish();
2761
         persistentStore.access_finish();
2761
 
2762
 
2762
         #if ENABLED(OPTIMIZED_MESH_STORAGE)
2763
         #if ENABLED(OPTIMIZED_MESH_STORAGE)
2769
             bedlevel.set_mesh_from_store(z_mesh_store, bedlevel.z_values);
2770
             bedlevel.set_mesh_from_store(z_mesh_store, bedlevel.z_values);
2770
         #endif
2771
         #endif
2771
 
2772
 
2773
+        #if ENABLED(DWIN_LCD_PROUI)
2774
+          status = !BedLevelTools.meshvalidate();
2775
+          if (status) {
2776
+            bedlevel.invalidate();
2777
+            LCD_MESSAGE(MSG_UBL_MESH_INVALID);
2778
+          }
2779
+          else
2780
+            ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot);
2781
+        #endif
2782
+
2772
         if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data.");
2783
         if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data.");
2773
         else        DEBUG_ECHOLNPGM("Mesh loaded from slot ", slot);
2784
         else        DEBUG_ECHOLNPGM("Mesh loaded from slot ", slot);
2774
 
2785
 

Loading…
Cancel
Save