From 241c27e63664ca173a4ed069b974aaf13e8fe2da Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Tue, 15 Dec 2020 13:52:37 -0500 Subject: [PATCH] Add mesh value feedback --- Marlin/src/lcd/extui/dgus_creality_lcd.cpp | 20 +++++++++++++++++++ .../lib/dgus_creality/DGUSScreenHandler.cpp | 17 ++++++++++++++-- .../creality_touch/DGUSDisplayDef.h | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/extui/dgus_creality_lcd.cpp b/Marlin/src/lcd/extui/dgus_creality_lcd.cpp index 7a56034886..abe4747d15 100644 --- a/Marlin/src/lcd/extui/dgus_creality_lcd.cpp +++ b/Marlin/src/lcd/extui/dgus_creality_lcd.cpp @@ -174,6 +174,26 @@ bool hasPrintTimer = false; void onConfigurationStoreRead(bool success) { // Called after the entire EEPROM has been read, // whether successful or not. + #if HAS_MESH + if (ExtUI::getMeshValid()) + { + uint8_t abl_probe_index = 0; + for(uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + { + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) + { + uint8_t x_Point = inner; + bool zig = (outer & 1); + if (zig) x_Point = (GRID_MAX_POINTS_X - 1) - inner; + xy_uint8_t point = {x_Point, outer}; + dgusdisplay.WriteVariable( (VP_MESH_VALUE_START + (abl_probe_index * 2)), static_cast(ExtUI::getMeshPoint(point) * 1000)); + ++abl_probe_index; + } + } + + setLevelingActive(true); + } + #endif } #if HAS_MESH diff --git a/Marlin/src/lcd/extui/lib/dgus_creality/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/lib/dgus_creality/DGUSScreenHandler.cpp index dfc1a4cbbc..ff240f06b1 100644 --- a/Marlin/src/lcd/extui/lib/dgus_creality/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/lib/dgus_creality/DGUSScreenHandler.cpp @@ -497,6 +497,21 @@ void DGUSScreenHandler::OnMeshLevelingUpdate(const int8_t xpos, const int8_t ypo // Update icon dgusdisplay.WriteVariable(VP_MESH_LEVEL_STATUS, static_cast(MeshLevelIndex)); + uint8_t abl_probe_index = 0; + for(uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + { + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) + { + uint8_t x_Point = inner; + bool zig = (outer & 1); // != ((PR_OUTER_END) & 1); + if (zig) x_Point = (GRID_MAX_POINTS_X - 1) - inner; + xy_uint8_t point = {x_Point, outer}; + if(x_Point==xpos && outer ==ypos) + dgusdisplay.WriteVariable( (VP_MESH_VALUE_START + (abl_probe_index * 2)), static_cast(ExtUI::getMeshPoint(point) * 1000)); + ++abl_probe_index; + } + } + if (MeshLevelIndex == GRID_MAX_POINTS) { // Done thermalManager.disable_all_heaters(); @@ -504,8 +519,6 @@ void DGUSScreenHandler::OnMeshLevelingUpdate(const int8_t xpos, const int8_t ypo settings.save(); GotoScreen(DGUSLCD_SCREEN_ZOFFSET_LEVEL); - } else { - // We've already updated the icon, so nothing left } } diff --git a/Marlin/src/lcd/extui/lib/dgus_creality/creality_touch/DGUSDisplayDef.h b/Marlin/src/lcd/extui/lib/dgus_creality/creality_touch/DGUSDisplayDef.h index a03eef6921..494ce1734e 100644 --- a/Marlin/src/lcd/extui/lib/dgus_creality/creality_touch/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/lib/dgus_creality/creality_touch/DGUSDisplayDef.h @@ -338,6 +338,7 @@ constexpr uint16_t VP_LED_TOGGLE = 0x101F; constexpr uint16_t VP_STEPPERS = 0x1200; constexpr uint16_t VP_MESH_LEVEL_TEMP = 0x108A; constexpr uint16_t VP_MESH_LEVEL_STATUS = 0x108D; +constexpr uint16_t VP_MESH_VALUE_START = 0x1300; constexpr uint16_t VP_FEED_AMOUNT = 0x1054; constexpr uint16_t VP_FEED_PROGRESS = 0x108e;