Переглянути джерело

🚸 Fix, improve, update ProUI (#24251)

Miguel Risco-Castillo 2 роки тому
джерело
коміт
eec9c800c9
Аккаунт користувача з таким Email не знайдено

+ 113
- 41
Marlin/src/lcd/e3v2/proui/dwin.cpp Переглянути файл

@@ -31,6 +31,37 @@
31 31
 
32 32
 #if ENABLED(DWIN_LCD_PROUI)
33 33
 
34
+#if DISABLED(LIMITED_MAX_FR_EDITING)
35
+  #warning "LIMITED_MAX_FR_EDITING is recommended with ProUI."
36
+#endif
37
+#if DISABLED(LIMITED_MAX_ACCEL_EDITING)
38
+  #warning "LIMITED_MAX_ACCEL_EDITING is recommended with ProUI."
39
+#endif
40
+#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING)
41
+  #warning "LIMITED_JERK_EDITING is recommended with ProUI."
42
+#endif
43
+#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
44
+  #warning "INDIVIDUAL_AXIS_HOMING_SUBMENU is recommended with ProUI."
45
+#endif
46
+#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
47
+  #warning "LCD_SET_PROGRESS_MANUALLY is recommended with ProUI."
48
+#endif
49
+#if DISABLED(STATUS_MESSAGE_SCROLLING)
50
+  #warning "STATUS_MESSAGE_SCROLLING is recommended with ProUI."
51
+#endif
52
+#if DISABLED(BAUD_RATE_GCODE)
53
+  #warning "BAUD_RATE_GCODE is recommended with ProUI."
54
+#endif
55
+#if DISABLED(SOUND_MENU_ITEM)
56
+  #warning "SOUND_MENU_ITEM is recommended with ProUI."
57
+#endif
58
+#if DISABLED(PRINTCOUNTER)
59
+  #warning "PRINTCOUNTER is recommended with ProUI."
60
+#endif
61
+#if HAS_MESH && DISABLED(MESH_EDIT_MENU)
62
+  #warning "MESH_EDIT_MENU is recommended with ProUI."
63
+#endif
64
+
34 65
 #include "dwin.h"
35 66
 #include "menus.h"
36 67
 #include "dwin_popup.h"
@@ -162,7 +193,12 @@
162 193
 #define DWIN_SCROLL_UPDATE_INTERVAL      SEC_TO_MS(2)
163 194
 #define DWIN_REMAIN_TIME_UPDATE_INTERVAL SEC_TO_MS(20)
164 195
 
165
-#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset)
196
+#if HAS_MESH
197
+  #define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset)
198
+#else
199
+  float z_offset = 0;
200
+  #define BABY_Z_VAR z_offset
201
+#endif
166 202
 
167 203
 // Structs
168 204
 HMI_value_t HMI_value;
@@ -200,11 +236,28 @@ uint8_t index_file     = MROWS;
200 236
 
201 237
 bool hash_changed = true; // Flag to know if message status was changed
202 238
 
203
-constexpr float max_feedrate_edit_values[] = MAX_FEEDRATE_EDIT_VALUES;
204
-constexpr float max_acceleration_edit_values[] = MAX_ACCEL_EDIT_VALUES;
205
-
239
+constexpr float max_feedrate_edit_values[] =
240
+  #ifdef MAX_FEEDRATE_EDIT_VALUES
241
+    MAX_FEEDRATE_EDIT_VALUES
242
+  #else
243
+    { 1000, 1000, 10, 50 }
244
+  #endif
245
+;
246
+constexpr float max_acceleration_edit_values[] =
247
+  #ifdef MAX_ACCEL_EDIT_VALUES
248
+    MAX_ACCEL_EDIT_VALUES
249
+  #else
250
+    { 1000, 1000, 200, 2000 }
251
+  #endif
252
+;
206 253
 #if HAS_CLASSIC_JERK
207
-  constexpr float max_jerk_edit_values[] = MAX_JERK_EDIT_VALUES;
254
+  constexpr float max_jerk_edit_values[] =
255
+    #ifdef MAX_JERK_EDIT_VALUES
256
+      MAX_JERK_EDIT_VALUES
257
+    #else
258
+      { DEFAULT_XJERK * 2, DEFAULT_YJERK * 2, DEFAULT_ZJERK * 2, DEFAULT_EJERK * 2 }
259
+    #endif
260
+  ;
208 261
 #endif
209 262
 
210 263
 static uint8_t _percent_done = 0;
@@ -815,6 +868,8 @@ void update_variable() {
815 868
       else
816 869
         DWINUI::Draw_Icon(ICON_Zoffset, 187, 416);
817 870
     }
871
+  #else
872
+    DWINUI::Draw_Icon(ICON_Zoffset, 187, 416);
818 873
   #endif
819 874
 
820 875
   _draw_xyz_position(false);
@@ -2292,48 +2347,45 @@ void ApplyFlow() { planner.refresh_e_factor(0); }
2292 2347
 void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, ApplyFlow); }
2293 2348
 
2294 2349
 // Bed Tramming
2295
-TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) {
2296
-  char cmd[100] = "";
2297
-  #if HAS_BED_PROBE
2298
-    static bool inLev = false;
2299
-    float xpos = 0, ypos = 0, zval = 0, margin = 0;
2300
-    char str_1[6] = "", str_2[6] = "", str_3[6] = "";
2301
-    if (inLev) return NAN;
2302
-    margin = HMI_data.FullManualTramming ? 30 : PROBING_MARGIN;
2303
-  #else
2304
-    int16_t xpos = 0, ypos = 0;
2305
-    int16_t margin = 30;
2306
-  #endif
2307 2350
 
2351
+void TramXY(const uint8_t point, const float &margin, float &x, float &y) {
2308 2352
   switch (point) {
2309 2353
     case 0:
2310 2354
       LCD_MESSAGE(MSG_LEVBED_FL);
2311
-      xpos = ypos = margin;
2355
+      x = y = margin;
2312 2356
       break;
2313 2357
     case 1:
2314 2358
       LCD_MESSAGE(MSG_LEVBED_FR);
2315
-      xpos = X_BED_SIZE - margin; ypos = margin;
2359
+      x = X_BED_SIZE - margin; y = margin;
2316 2360
       break;
2317 2361
     case 2:
2318 2362
       LCD_MESSAGE(MSG_LEVBED_BR);
2319
-      xpos = X_BED_SIZE - margin; ypos = Y_BED_SIZE - margin;
2363
+      x = X_BED_SIZE - margin; y = Y_BED_SIZE - margin;
2320 2364
       break;
2321 2365
     case 3:
2322 2366
       LCD_MESSAGE(MSG_LEVBED_BL);
2323
-      xpos = margin; ypos = Y_BED_SIZE - margin;
2367
+      x = margin; y = Y_BED_SIZE - margin;
2324 2368
       break;
2325 2369
     case 4:
2326 2370
       LCD_MESSAGE(MSG_LEVBED_C);
2327
-      xpos = X_BED_SIZE / 2; ypos = Y_BED_SIZE / 2;
2371
+      x = X_CENTER; y = Y_CENTER;
2328 2372
       break;
2329 2373
   }
2374
+}
2330 2375
 
2331
-  planner.synchronize();
2376
+#if HAS_BED_PROBE
2332 2377
 
2333
-  #if HAS_BED_PROBE
2378
+  float Tram(const uint8_t point) {
2379
+    char cmd[100] = "";
2380
+    static bool inLev = false;
2381
+    float xpos = 0, ypos = 0, zval = 0, margin = 0;
2382
+    char str_1[6] = "", str_2[6] = "", str_3[6] = "";
2383
+    if (inLev) return NAN;
2384
+    margin = HMI_data.FullManualTramming ? 30 : PROBING_MARGIN;
2385
+
2386
+    TramXY(point, margin, xpos, ypos);
2334 2387
 
2335 2388
     if (HMI_data.FullManualTramming) {
2336
-      planner.synchronize();
2337 2389
       sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%sY%sF5000\nG0Z0F300"),
2338 2390
         dtostrf(xpos, 1, 1, str_1),
2339 2391
         dtostrf(ypos, 1, 1, str_2)
@@ -2341,6 +2393,20 @@ TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) {
2341 2393
       queue.inject(cmd);
2342 2394
     }
2343 2395
     else {
2396
+      // AUTO_BED_LEVELING_BILINEAR does not define MESH_INSET
2397
+      #ifndef MESH_MIN_X
2398
+        #define MESH_MIN_X (_MAX(X_MIN_BED + PROBING_MARGIN, X_MIN_POS))
2399
+      #endif
2400
+      #ifndef MESH_MIN_Y
2401
+        #define MESH_MIN_Y (_MAX(Y_MIN_BED + PROBING_MARGIN, Y_MIN_POS))
2402
+      #endif
2403
+      #ifndef MESH_MAX_X
2404
+        #define MESH_MAX_X (_MIN(X_MAX_BED - (PROBING_MARGIN), X_MAX_POS))
2405
+      #endif
2406
+      #ifndef MESH_MAX_Y
2407
+        #define MESH_MAX_Y (_MIN(Y_MAX_BED - (PROBING_MARGIN), Y_MAX_POS))
2408
+      #endif
2409
+
2344 2410
       LIMIT(xpos, MESH_MIN_X, MESH_MAX_X);
2345 2411
       LIMIT(ypos, MESH_MIN_Y, MESH_MAX_Y);
2346 2412
       probe.stow();
@@ -2360,14 +2426,20 @@ TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) {
2360 2426
       inLev = false;
2361 2427
     }
2362 2428
     return zval;
2429
+  }
2363 2430
 
2364
-  #else // !HAS_BED_PROBE
2431
+#else
2365 2432
 
2366
-    sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"), xpos, ypos);
2433
+  void Tram(const uint8_t point) {
2434
+    float xpos = 0, ypos = 0, margin = 30;
2435
+    TramXY(point, margin, xpos, ypos);
2436
+
2437
+    char cmd[100] = "", str_1[6] = "", str_2[6] = "";
2438
+    sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%sY%sF5000\nG0Z0F300"), dtostrf(xpos, 1, 1, str_1), dtostrf(ypos, 1, 1, str_2));
2367 2439
     queue.inject(cmd);
2440
+  }
2368 2441
 
2369
-  #endif
2370
-}
2442
+#endif
2371 2443
 
2372 2444
 void TramFL() { Tram(0); }
2373 2445
 void TramFR() { Tram(1); }
@@ -3606,18 +3678,18 @@ void Draw_Steps_Menu() {
3606 3678
     void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); }
3607 3679
   #endif
3608 3680
 
3609
-  uint8_t mesh_x = 0;
3610
-  uint8_t mesh_y = 0;
3611
-  #define Z_OFFSET_MIN -3
3612
-  #define Z_OFFSET_MAX  3
3613
-
3614
-  void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); }
3615
-  void ApplyEditMeshX() { mesh_x = MenuData.Value; }
3616
-  void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); }
3617
-  void ApplyEditMeshY() { mesh_y = MenuData.Value; }
3618
-  void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); }
3619
-  void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); }
3620
-
3681
+  #if ENABLED(MESH_EDIT_MENU)
3682
+    uint8_t mesh_x = 0, mesh_y = 0;
3683
+    #define Z_OFFSET_MIN -3
3684
+    #define Z_OFFSET_MAX  3
3685
+
3686
+    void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); }
3687
+    void ApplyEditMeshX() { mesh_x = MenuData.Value; }
3688
+    void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); }
3689
+    void ApplyEditMeshY() { mesh_y = MenuData.Value; }
3690
+    void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); }
3691
+    void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); }
3692
+  #endif
3621 3693
 #endif
3622 3694
 
3623 3695
 #if ENABLED(AUTO_BED_LEVELING_UBL)

+ 1
- 3
Marlin/src/lcd/e3v2/proui/dwin.h Переглянути файл

@@ -238,9 +238,7 @@ void Draw_Tramming_Menu();
238 238
 #if HAS_BED_PROBE
239 239
   void Draw_ProbeSet_Menu();
240 240
 #endif
241
-#if HAS_FILAMENT_SENSOR
242
-  void Draw_FilSet_Menu();
243
-#endif
241
+void Draw_FilSet_Menu();
244 242
 #if ENABLED(NOZZLE_PARK_FEATURE)
245 243
   void Draw_ParkPos_Menu();
246 244
 #endif

+ 0
- 31
Marlin/src/lcd/e3v2/proui/dwin_defines.h Переглянути файл

@@ -39,37 +39,6 @@
39 39
   #define DASH_REDRAW 1
40 40
 #endif
41 41
 
42
-#if DISABLED(LIMITED_MAX_FR_EDITING)
43
-  #error "LIMITED_MAX_FR_EDITING is required with ProUI."
44
-#endif
45
-#if DISABLED(LIMITED_MAX_ACCEL_EDITING)
46
-  #error "LIMITED_MAX_ACCEL_EDITING is required with ProUI."
47
-#endif
48
-#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING)
49
-  #error "LIMITED_JERK_EDITING is required with ProUI."
50
-#endif
51
-#if DISABLED(FILAMENT_RUNOUT_SENSOR)
52
-  #error "FILAMENT_RUNOUT_SENSOR is required with ProUI."
53
-#endif
54
-#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
55
-  #error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI."
56
-#endif
57
-#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
58
-  #error "LCD_SET_PROGRESS_MANUALLY is required with ProUI."
59
-#endif
60
-#if DISABLED(STATUS_MESSAGE_SCROLLING)
61
-  #error "STATUS_MESSAGE_SCROLLING is required with ProUI."
62
-#endif
63
-#if DISABLED(BAUD_RATE_GCODE)
64
-  #error "BAUD_RATE_GCODE is required with ProUI."
65
-#endif
66
-#if DISABLED(SOUND_MENU_ITEM)
67
-  #error "SOUND_MENU_ITEM is required with ProUI."
68
-#endif
69
-#if DISABLED(PRINTCOUNTER)
70
-  #error "PRINTCOUNTER is required with ProUI."
71
-#endif
72
-
73 42
 #include "../common/dwin_color.h"
74 43
 #if ENABLED(LED_CONTROL_MENU)
75 44
   #include "../../../feature/leds/leds.h"

+ 3
- 3
Marlin/src/lcd/e3v2/proui/ubl_tools.cpp Переглянути файл

@@ -22,10 +22,10 @@
22 22
  */
23 23
 
24 24
 #include "../../../inc/MarlinConfigPre.h"
25
-#include "ubl_tools.h"
26 25
 
27
-#if ENABLED(DWIN_LCD_PROUI)
26
+#if BOTH(DWIN_LCD_PROUI, AUTO_BED_LEVELING_UBL)
28 27
 
28
+#include "ubl_tools.h"
29 29
 #include "../../marlinui.h"
30 30
 #include "../../../core/types.h"
31 31
 #include "dwin.h"
@@ -249,4 +249,4 @@ bool UBLMeshToolsClass::validate() {
249 249
   }
250 250
 #endif
251 251
 
252
-#endif // DWIN_LCD_PROUI
252
+#endif // DWIN_LCD_PROUI && AUTO_BED_LEVELING_UBL

Завантаження…
Відмінити
Зберегти