diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index b2096ace7e51..a71ff812febf 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -242,7 +242,7 @@ void GcodeSuite::G28() { // Disable the leveling matrix before homing #if CAN_SET_LEVELING_AFTER_G28 - const bool leveling_restore_state = parser.boolval('L', TERN1(RESTORE_LEVELING_AFTER_G28, planner.leveling_active)); + const bool leveling_restore_state = ENABLED(ENABLE_LEVELING_AFTER_G28) || parser.boolval('L', TERN1(RESTORE_LEVELING_AFTER_G28, planner.leveling_active)); #endif // Cancel any prior G29 session diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 1c50b30436e3..974c2ddd62e9 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -154,11 +154,11 @@ void DGUSRxHandler::Scroll(DGUS_VP& vp, void* data_ptr) { break; case DGUS_Data::Scroll::DOWN: - if (dgus_screen_handler.filelist_offset + offset >= dgus_screen_handler.filelist.count()) { - offset = dgus_screen_handler.filelist.count() - offset; + if (dgus_screen_handler.filelist_offset + offset < dgus_screen_handler.filelist.count()) { + //offset = dgus_screen_handler.filelist.count() - offset; + dgus_screen_handler.filelist_offset += offset; +// offset = 0; } - - dgus_screen_handler.filelist_offset += offset; break; } DEBUG_ECHOLNPAIR_F("New offset ", dgus_screen_handler.filelist_offset, " file count ", dgus_screen_handler.filelist.count()); @@ -595,6 +595,9 @@ void DGUSRxHandler::Probe(DGUS_VP& vp, void* data_ptr) { queue.enqueue_now_P(DGUS_CMD_HOME); return; } + else { + dgus_screen_handler.TriggerScreenChange(DGUS_Screen::LEVELING_PROBING); + } } #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 4e9ebea8772a..7419dca7fec3 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -43,7 +43,10 @@ int16_t DGUSScreenHandler::filelist_selected = -1; DGUS_Data::StepSize DGUSScreenHandler::offset_steps = DGUS_Data::StepSize::MMP1; DGUS_Data::StepSize DGUSScreenHandler::move_steps = DGUS_Data::StepSize::MM10; -uint16_t DGUSScreenHandler::probing_icons[] = { 0, 0 }; +#if HAS_LEVELING + uint16_t DGUSScreenHandler::probing_colors[] = { 0, 0 }; + float DGUSScreenHandler::probing_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; +#endif uint8_t DGUSScreenHandler::levelingPoint = 0; DGUS_Data::Extruder DGUSScreenHandler::filament_extruder = DGUS_Data::Extruder::CURRENT; @@ -326,15 +329,13 @@ void DGUSScreenHandler::MoveToLevelPoint() { } #if HAS_LEVELING -void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) { - // if (current_screen == DGUS_Screen::LEVELING_PROBING || current_screen == DGUS_Screen::LEVELING_AUTOMATIC) { - // TriggerFullUpdate(); - // } +void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + probing_values[xpos][ypos] = zval; uint8_t point = ypos * GRID_MAX_POINTS_X + xpos; - probing_icons[point < 16 ? 0 : 1] |= (1U << (point % 16)); + probing_colors[point < 16 ? 0 : 1] |= (1U << (point % 16)); if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getMeshValid()) - probing_icons[0] = probing_icons[1] = 0; + probing_colors[0] = probing_colors[1] = 0; TriggerFullUpdate(); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 08384e15b717..08cc9a0127e0 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -46,7 +46,7 @@ class DGUSScreenHandler { static void ConfigurationStoreRead(bool success); static void PlayTone(const uint16_t frequency, const uint16_t duration); - static void MeshUpdate(const int8_t xpos, const int8_t ypos); + static void MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval); static void PrintTimerStarted(); static void PrintTimerPaused(); static void PrintTimerStopped(); @@ -101,7 +101,10 @@ class DGUSScreenHandler { static DGUS_Data::StepSize offset_steps; static DGUS_Data::StepSize move_steps; - static uint16_t probing_icons[2]; + #if HAS_LEVELING + static uint16_t probing_colors[2]; + static float probing_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; + #endif static uint8_t levelingPoint; static DGUS_Data::Extruder filament_extruder; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index 0d1117154dfb..cdc8a15a805f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -31,6 +31,10 @@ #include "../../../gcode/queue.h" +#if HAS_LEVELING + #include "../../../feature/bedlevel/bedlevel.h" +#endif + #if ENABLED(SDSUPPORT) bool DGUSSetupHandler::Print() { dgus_screen_handler.filelist.refresh(); @@ -133,13 +137,15 @@ bool DGUSSetupHandler::LevelingAutomatic() { ExtUI::setLevelingActive(true); } + COPY(dgus_screen_handler.probing_values, bedlevel.z_values); return true; } bool DGUSSetupHandler::LevelingProbing() { - dgus_screen_handler.probing_icons[0] = 0; - dgus_screen_handler.probing_icons[1] = 0; + dgus_screen_handler.probing_colors[0] = 0; + dgus_screen_handler.probing_colors[1] = 0; + COPY(dgus_screen_handler.probing_values, bedlevel.z_values); #if ENABLED(AUTO_BED_LEVELING_UBL) queue.enqueue_now_P(PSTR("G29P1\nG29P3\nG29P5C")); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index 4f59b3279ef3..d3083781f856 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -369,7 +369,7 @@ void DGUSTxHandler::ABLGrid(DGUS_VP& vp) { for (int i = 0; i < DGUS_LEVEL_GRID_SIZE; i++) { point.x = i % (GRID_MAX_POINTS_X); point.y = i / (GRID_MAX_POINTS_X); - fixed = dgus_display.ToFixedPoint(ExtUI::getMeshPoint(point)); + fixed = dgus_display.ToFixedPoint(dgus_screen_handler.probing_values[point.x][point.y]); DEBUG_ECHOLNPAIR_F("grid x ", point.x, " y ", point.y, " value ", fixed); data[i] = Swap16(fixed); } @@ -381,7 +381,7 @@ void DGUSTxHandler::ABLGridColor(DGUS_VP& vp) { // Set color for each value for (int point = 0; point < DGUS_LEVEL_GRID_SIZE; point++) { uint16_t color = Swap16(COLOR_WHITE); - if ((dgus_screen_handler.probing_icons[point < 16 ? 0 : 1] & (1U << (point % 16))) != 0) { + if ((dgus_screen_handler.probing_colors[point < 16 ? 0 : 1] & (1U << (point % 16))) != 0) { color = Swap16(COLOR_GREEN); } dgus_display.Write((uint16_t)vp.addr + point * DGUS_SP_VARIABLE_LEN + (int)DGUS_SP_Variable::COLOR, color); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 15a950b28021..0bb58e0b3528 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -133,7 +133,7 @@ namespace ExtUI { #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - dgus_screen_handler.MeshUpdate(xpos, ypos); + dgus_screen_handler.MeshUpdate(xpos, ypos, zval); } //#if HAS_MESH void onLevelingStart() {} @@ -141,7 +141,8 @@ namespace ExtUI { void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) { if (state == ExtUI::probe_state_t::G29_POINT_FINISH) { - dgus_screen_handler.MeshUpdate(xpos, ypos); + xy_uint8_t pos = { (uint8_t)xpos, (uint8_t)ypos }; + dgus_screen_handler.MeshUpdate(xpos, ypos, ExtUI::getMeshPoint(pos)); } }