Fix Resume Print with UBL (#21564)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
espr14
2021-04-13 03:10:21 +02:00
committed by GitHub
parent 41c55a30cd
commit a5d6f6ac98
4 changed files with 32 additions and 13 deletions

View File

@ -88,9 +88,17 @@ void GcodeSuite::M701() {
tool_change(target_extruder, false);
#endif
// Lift Z axis
if (park_point.z > 0)
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
auto move_z_by = [](const_float_t zdist) {
if (zdist) {
destination = current_position;
destination.z += zdist;
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
}
};
// Raise the Z axis (with max limit)
const float park_raise = _MIN(0, park_point.z, (Z_MAX_POS) - current_position.z);
move_z_by(park_raise);
// Load filament
#if HAS_PRUSA_MMU2
@ -113,8 +121,7 @@ void GcodeSuite::M701() {
#endif
// Restore Z axis
if (park_point.z > 0)
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
move_z_by(-park_raise);
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Restore toolhead if it was changed