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 Scott Lahteine
parent 5ab64708c5
commit fb7bdabb70
4 changed files with 32 additions and 13 deletions

View File

@ -597,11 +597,13 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE)); unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
if (!axes_should_home()) { if (!axes_should_home()) {
// Move XY to starting position, then Z // Move XY back to saved position
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE)); destination.set(resume_position.x, resume_position.y, current_position.z);
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
// Move Z_AXIS to saved position // Move Z back to saved position
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE)); destination.z = resume_position.z;
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
} }
// Unretract // Unretract

View File

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

View File

@ -75,9 +75,18 @@ xyz_pos_t position_before_pause;
void MKS_pause_print_move() { void MKS_pause_print_move() {
queue.exhaust(); queue.exhaust();
position_before_pause = current_position; position_before_pause = current_position;
do_blocking_move_to(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y, current_position.z + mks_park_pos.z); destination.z = _MIN(current_position.z + mks_park_pos.z, Z_MAX_POS);
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
destination.set(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y);
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
}
void MKS_resume_print_move() {
destination.set(position_before_pause.x, position_before_pause.y);
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
destination.z = position_before_pause.z;
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
} }
void MKS_resume_print_move() { do_blocking_move_to(position_before_pause); }
float z_offset_add = 0; float z_offset_add = 0;

View File

@ -836,9 +836,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
#if ENABLED(TOOLCHANGE_PARK) #if ENABLED(TOOLCHANGE_PARK)
if (ok) { if (ok) {
#if ENABLED(TOOLCHANGE_NO_RETURN) #if ENABLED(TOOLCHANGE_NO_RETURN)
do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); destination.set(current_position.x, current_position.y);
prepare_internal_move_to_destination(planner.settings.max_feedrate_mm_s[Z_AXIS]);
#else #else
do_blocking_move_to(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE)); prepare_internal_move_to_destination(MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
#endif #endif
} }
#endif #endif