Browse Source

Add warning to ExtUI Bed Mesh Screen. (#19397)

- Show a warning on the Mesh Bed Leveling screen if some points aren't probed.
Marcio Teixeira 4 years ago
parent
commit
c539254101

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

@@ -145,6 +145,7 @@ namespace Language_en {
145 145
   PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate";
146 146
   PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS         = u8"Level X Axis";
147 147
   PROGMEM Language_Str MSG_BED_MAPPING_DONE         = u8"Bed mapping finished";
148
+  PROGMEM Language_Str MSG_BED_MAPPING_INCOMPLETE   = u8"Not all points probed";
148 149
   PROGMEM Language_Str MSG_LEVELING                 = u8"Leveling";
149 150
   PROGMEM Language_Str MSG_SHOW_MESH                = u8"Show Bed Mesh";
150 151
 

+ 22
- 5
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp View File

@@ -223,7 +223,7 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) {
223 223
 void BedMeshScreen::onEntry() {
224 224
   screen_data.BedMeshScreen.highlightedTag = 0;
225 225
   screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
226
-  screen_data.BedMeshScreen.showMappingDone = false;
226
+  screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
227 227
   BaseScreen::onEntry();
228 228
 }
229 229
 
@@ -253,8 +253,10 @@ void BedMeshScreen::drawHighlightedPointValue() {
253 253
      .tag(1).button( OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY))
254 254
      .tag(0);
255 255
 
256
-  if (screen_data.BedMeshScreen.showMappingDone) {
257
-    cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE));
256
+  switch(screen_data.BedMeshScreen.message) {
257
+    case screen_data.BedMeshScreen.MSG_MESH_COMPLETE:   cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break;
258
+    case screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break;
259
+    default: break;
258 260
   }
259 261
 }
260 262
 
@@ -307,15 +309,30 @@ void BedMeshScreen::onMeshUpdate(const int8_t, const int8_t, const float) {
307 309
     onRefresh();
308 310
 }
309 311
 
312
+bool BedMeshScreen::isMeshComplete(ExtUI::bed_mesh_t data) {
313
+  for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
314
+    for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) {
315
+      if (isnan(data[x][y])) {
316
+        return false;
317
+      }
318
+    }
319
+  }
320
+  return true;
321
+}
322
+
310 323
 void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
311 324
   switch(state) {
312 325
     case ExtUI::MESH_START:
313 326
       screen_data.BedMeshScreen.count = 0;
314
-      screen_data.BedMeshScreen.showMappingDone = false;
327
+      screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
315 328
       break;
316 329
     case ExtUI::MESH_FINISH:
330
+      if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) {
331
+        screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE;
332
+      } else {
333
+        screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE;
334
+      }
317 335
       screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
318
-      screen_data.BedMeshScreen.showMappingDone = true;
319 336
       break;
320 337
     case ExtUI::PROBE_START:
321 338
       screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y);

+ 34
- 30
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h View File

@@ -52,42 +52,46 @@ union screen_data_t {
52 52
     uint8_t   num_page;
53 53
     uint8_t   cur_page;
54 54
     #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
55
-    uint16_t  scroll_pos;
56
-    uint16_t  scroll_max;
55
+      uint16_t  scroll_pos;
56
+      uint16_t  scroll_max;
57 57
     #endif
58 58
   } FilesScreen;
59 59
   struct {
60 60
     struct base_numeric_adjustment_t placeholder;
61 61
     float e_rel[ExtUI::extruderCount];
62 62
   } MoveAxisScreen;
63
-#if HAS_MESH
64
-  struct {
65
-    bool    showMappingDone;
66
-    uint8_t count;
67
-    uint8_t highlightedTag;
68
-  } BedMeshScreen;
69
-#endif
70
-#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
71
-  struct {
72
-    uint32_t next_watchdog_trigger;
73
-    const char*  message;
74
-  } StressTestScreen;
75
-#endif
76
-#if ENABLED(TOUCH_UI_COCOA_PRESS)
77
-  struct {
78
-    uint32_t start_ms;
79
-  } PreheatTimerScreen;
80
-#endif
81
-#if ENABLED(BABYSTEPPING)
82
-  struct {
83
-    struct base_numeric_adjustment_t placeholder;
84
-    xyz_int_t rel;
85
-    #if EXTRUDERS > 1
86
-      bool link_nozzles;
87
-    #endif
88
-    bool show_offsets;
89
-  } NudgeNozzleScreen;
90
-#endif
63
+  #if HAS_MESH
64
+    struct {
65
+      enum : uint8_t {
66
+        MSG_NONE,
67
+        MSG_MESH_COMPLETE,
68
+        MSG_MESH_INCOMPLETE
69
+      } message;
70
+      uint8_t count;
71
+      uint8_t highlightedTag;
72
+    } BedMeshScreen;
73
+  #endif
74
+  #if ENABLED(TOUCH_UI_DEVELOPER_MENU)
75
+    struct {
76
+      uint32_t next_watchdog_trigger;
77
+      const char*  message;
78
+    } StressTestScreen;
79
+  #endif
80
+  #if ENABLED(TOUCH_UI_COCOA_PRESS)
81
+    struct {
82
+      uint32_t start_ms;
83
+    } PreheatTimerScreen;
84
+  #endif
85
+  #if ENABLED(BABYSTEPPING)
86
+    struct {
87
+      struct base_numeric_adjustment_t placeholder;
88
+      xyz_int_t rel;
89
+      #if EXTRUDERS > 1
90
+        bool link_nozzles;
91
+      #endif
92
+      bool show_offsets;
93
+    } NudgeNozzleScreen;
94
+  #endif
91 95
 };
92 96
 
93 97
 extern screen_data_t screen_data;

+ 1
- 0
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h View File

@@ -533,6 +533,7 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEP
533 533
       static float getHightlightedValue();
534 534
       static void drawHighlightedPointValue();
535 535
       static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1);
536
+      static bool isMeshComplete(ExtUI::bed_mesh_t data);
536 537
 
537 538
     public:
538 539
       static void onMeshUpdate(const int8_t x, const int8_t y, const float val);

Loading…
Cancel
Save