From a57022041fddf27ab3aa65a48266e49ac10d7168 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 5 Dec 2020 19:14:15 -0600 Subject: [PATCH] G28 tweaks --- Marlin/src/gcode/calibrate/G28.cpp | 17 ++++++----------- Marlin/src/lcd/dwin/e3v2/dwin.h | 2 ++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index cd3d1238b44b..2ac75ca97ecb 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -211,10 +211,6 @@ void GcodeSuite::G28() { TERN_(LASER_MOVE_G28_OFF, cutter.set_inline_enabled(false)); // turn off laser - TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true); - - TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart()); - #if ENABLED(DUAL_X_CARRIAGE) bool IDEX_saved_duplication_state = extruder_duplication_enabled; DualXMode IDEX_saved_mode = dual_x_carriage_mode; @@ -236,17 +232,17 @@ void GcodeSuite::G28() { return; } + TERN_(DWIN_CREALITY_LCD, DWIN_StartHoming()); + TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart()); + planner.synchronize(); // Wait for planner moves to finish! SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state // Disable the leveling matrix before homing #if HAS_LEVELING - - // Cancel the active G29 session - TERN_(PROBE_MANUALLY, g29_in_progress = false); - TERN_(RESTORE_LEVELING_AFTER_G28, const bool leveling_was_active = planner.leveling_active); + TERN_(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session set_bed_leveling_enabled(false); #endif @@ -448,8 +444,6 @@ void GcodeSuite::G28() { do_blocking_move_to_z(delta_clip_start_height); #endif - TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_was_active)); - restore_feedrate_and_scaling(); // Restore the active tool after homing @@ -473,10 +467,11 @@ void GcodeSuite::G28() { #endif #endif + TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_restore_state)); + ui.refresh(); TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming()); - TERN_(EXTENSIBLE_UI, ExtUI::onHomingComplete()); report_current_position(); diff --git a/Marlin/src/lcd/dwin/e3v2/dwin.h b/Marlin/src/lcd/dwin/e3v2/dwin.h index 5bff2e9f7890..8f17c3060983 100644 --- a/Marlin/src/lcd/dwin/e3v2/dwin.h +++ b/Marlin/src/lcd/dwin/e3v2/dwin.h @@ -369,5 +369,7 @@ void DWIN_Update(); void EachMomentUpdate(); void DWIN_HandleScreen(); +inline void DWIN_StartHoming() { HMI_flag.home_flag = true; } + void DWIN_CompletedHoming(); void DWIN_CompletedLeveling();