Skip to content

Commit

Permalink
🩹 Prevent Z error with UBL + Park unscaled E move (MarlinFirmware#23568)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-the-Kuhn authored and LCh-77 committed Feb 5, 2022
1 parent ade2a3a commit d6d5537
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#include "../module/printcounter.h"
#include "../module/temperature.h"

#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "bedlevel/bedlevel.h"
#endif

#if ENABLED(FWRETRACT)
#include "fwretract.h"
#endif
Expand Down Expand Up @@ -440,7 +444,15 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
// Initial retract before move to filament change position
if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
DEBUG_ECHOLNPGM("... retract:", retract);

#if ENABLED(AUTO_BED_LEVELING_UBL)
const bool leveling_was_enabled = planner.leveling_active; // save leveling state
set_bed_leveling_enabled(false); // turn off leveling
#endif

unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);

TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling
}

// If axes don't need to home then the nozzle can park
Expand Down Expand Up @@ -640,9 +652,16 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
}

#if ENABLED(AUTO_BED_LEVELING_UBL)
const bool leveling_was_enabled = planner.leveling_active; // save leveling state
set_bed_leveling_enabled(false); // turn off leveling
#endif

// Unretract
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));

TERN_(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(leveling_was_enabled)); // restore leveling

// Intelligent resuming
#if ENABLED(FWRETRACT)
// If retracted before goto pause
Expand Down

0 comments on commit d6d5537

Please sign in to comment.