From 107834f899eddcfe263b0698077ab392aa865a35 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 31fc1e1cf2..e2b0860eef 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 @@ -439,8 +435,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 @@ -464,10 +458,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 5bff2e9f78..8f17c30609 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();