From 60b6df4542d78e8263f75a989c77c2f386a894fc Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:54:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20kinetic=20ABL=20mesh=20aft?= =?UTF-8?q?er=20refactor=20(#24107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23868 --- Marlin/src/feature/bedlevel/abl/bbl.h | 1 + Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 ++++ Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp | 5 ++--- Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Marlin/src/feature/bedlevel/abl/bbl.h b/Marlin/src/feature/bedlevel/abl/bbl.h index 86da5aea10..fbdb22cd00 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.h +++ b/Marlin/src/feature/bedlevel/abl/bbl.h @@ -24,6 +24,7 @@ #include "../../../inc/MarlinConfigPre.h" class LevelingBilinear { +private: static xy_pos_t grid_spacing, grid_start; static xy_float_t grid_factor; static bed_mesh_t z_values; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 3743f1ffc6..f9bdbf5e9f 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -507,6 +507,10 @@ G29_TYPE GcodeSuite::G29() { // Can't re-enable (on error) until the new grid is written abl.reenable = false; } + + // Pre-populate local Z values from the stored mesh + TERN_(IS_KINEMATIC, COPY(abl.z_values, Z_VALUES_ARR)); + #endif // AUTO_BED_LEVELING_BILINEAR } // !g29_in_progress diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 6388e1683d..0b584fac3b 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -200,7 +200,7 @@ void DGUSScreenHandler::StoreSettings(char *buff) { data.initialized = true; data.volume = dgus_display.GetVolume(); data.brightness = dgus_display.GetBrightness(); - data.abl = (ExtUI::getLevelingActive() && ExtUI::getMeshValid()); + data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getMeshValid()); memcpy(buff, &data, sizeof(data)); } @@ -216,8 +216,7 @@ void DGUSScreenHandler::LoadSettings(const char *buff) { dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS); if (data.initialized) { - leveling_active = (data.abl && ExtUI::getMeshValid()); - + leveling_active = (data.abl_okay && ExtUI::getMeshValid()); ExtUI::setLevelingActive(leveling_active); } } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 509d599200..cc59bda6d7 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -134,7 +134,7 @@ private: bool initialized; uint8_t volume; uint8_t brightness; - bool abl; + bool abl_okay; } eeprom_data_t; };