Skip to content

Commit

Permalink
G28 tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and chrisjenda committed Apr 11, 2021
1 parent d780350 commit a570220
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/dwin/e3v2/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit a570220

Please sign in to comment.