|
@@ -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);
|