From de62eb8f7c826e9b35f75bf86c18043ddc6366a6 Mon Sep 17 00:00:00 2001 From: ghislain Date: Sun, 10 Jul 2022 09:37:52 -0400 Subject: [PATCH] Attempt to fix baby stepping when no BLTouch. The baby step offset should be displayed correctly. I cannot test it. --- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 17 ++++++++++++++++- .../extui/dgus_reloaded/DGUSScreenHandler.cpp | 5 +++++ .../lcd/extui/dgus_reloaded/DGUSScreenHandler.h | 5 ++++- .../dgus_reloaded/definition/DGUS_VPList.cpp | 4 ++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 974c2ddd62e9..13428c7fca00 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -324,11 +324,18 @@ void DGUSRxHandler::BabystepSet(DGUS_VP& vp, void* data_ptr) { const int16_t data = Swap16(*(int16_t*)data_ptr); const float offset = dgus_display.FromFixedPoint(data); +#if HAS_LEVELING const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z); +#else + const int16_t steps = ExtUI::mmToWholeSteps(offset - dgus_screen_handler.baby_offset, ExtUI::Z); + dgus_screen_handler.baby_offset = offset; +#endif ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); +#if HAS_LEVELING dgus_screen_handler.TriggerEEPROMSave(); +#endif dgus_screen_handler.TriggerFullUpdate(); } @@ -343,15 +350,23 @@ void DGUSRxHandler::Babystep(DGUS_VP& vp, void* data_ptr) { return; case DGUS_Data::Adjust::INCREMENT: steps = ExtUI::mmToWholeSteps(DGUS_PRINT_BABYSTEP, ExtUI::Z); + #if !HAS_LEVELING + dgus_screen_handler.baby_offset += DGUS_PRINT_BABYSTEP; + #endif break; case DGUS_Data::Adjust::DECREMENT: steps = ExtUI::mmToWholeSteps(-DGUS_PRINT_BABYSTEP, ExtUI::Z); + #if !HAS_LEVELING + dgus_screen_handler.baby_offset -= DGUS_PRINT_BABYSTEP; + #endif break; } ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); - dgus_screen_handler.TriggerEEPROMSave(); + #if HAS_LEVELING + dgus_screen_handler.TriggerEEPROMSave(); + #endif dgus_screen_handler.TriggerFullUpdate(); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 7419dca7fec3..b2b1e9757f24 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -46,6 +46,8 @@ DGUS_Data::StepSize DGUSScreenHandler::move_steps = DGUS_Data::StepSize::MM10; #if HAS_LEVELING uint16_t DGUSScreenHandler::probing_colors[] = { 0, 0 }; float DGUSScreenHandler::probing_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; +#else + float DGUSScreenHandler::baby_offset = 0; #endif uint8_t DGUSScreenHandler::levelingPoint = 0; @@ -343,6 +345,9 @@ void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos, const_f void DGUSScreenHandler::PrintTimerStarted() { TriggerScreenChange(DGUS_Screen::PRINT_STATUS); + #if !HAS_LEVELING + baby_offset = 0; + #endif } void DGUSScreenHandler::PrintTimerPaused() { diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 08cc9a0127e0..20972b7c61d1 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -101,10 +101,13 @@ class DGUSScreenHandler { static DGUS_Data::StepSize offset_steps; static DGUS_Data::StepSize move_steps; - #if HAS_LEVELING + #if HAS_LEVELING static uint16_t probing_colors[2]; static float probing_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; + #else + static float baby_offset; #endif + static uint8_t levelingPoint; static DGUS_Data::Extruder filament_extruder; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index 7310169c7ff0..1e6c5d958dbb 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -253,6 +253,10 @@ VP_HELPER(DGUS_Addr::LEVEL_AUTO_Grid, sizeof(int16_t) * DGUS_LEVEL_GRID_SIZE, VPFLAG_NONE, nullptr, nullptr, &DGUSTxHandler::ABLGrid), VP_HELPER(DGUS_Addr::SP_LEVEL_AUTO_Grid, 2, VPFLAG_NONE, nullptr, nullptr, &DGUSTxHandler::ABLGridColor), + #else + VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_OFFSET_Current, + &DGUSScreenHandler::baby_offset, + (&DGUSTxHandler::ExtraToFixedPoint)), #endif VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::FilamentIcons),