diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index afd30a44e0..9c1f8cd4ad 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -367,12 +367,13 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/ planner.e_factor[active_extruder] = 1.0f; #endif - #if IS_KINEMATIC - if (is_fast) - prepare_fast_move_to_destination(); - else + #if !IS_KINEMATIC + constexpr bool is_fast = false; #endif - prepare_line_to_destination(); + if (is_fast) + prepare_fast_move_to_destination(); + else + prepare_line_to_destination(); feedrate_mm_s = old_feedrate; feedrate_percentage = old_pct; @@ -382,7 +383,12 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/ } /** - * Plan a move to (X, Y, Z) and set the current_position + * Plan a move to (X, Y, Z) with separation of the XY and Z components. + * + * - If Z is moving up, the Z move is done before XY. + * - If Z is moving down, the Z move is done after XY. + * - Delta may lower Z first to get into the free motion zone. + * - Before returning, wait for the planner buffer to empty. */ void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s/*=0.0*/) { DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING)); @@ -391,20 +397,21 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const_f const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS), xy_feedrate = fr_mm_s ?: feedRate_t(XY_PROBE_FEEDRATE_MM_S); - #if ENABLED(DELTA) - + #if EITHER(DELTA, IS_SCARA) if (!position_is_reachable(rx, ry)) return; + destination = current_position; // sync destination at the start + #endif - REMEMBER(fr, feedrate_mm_s, xy_feedrate); + #if ENABLED(DELTA) - destination = current_position; // sync destination at the start + REMEMBER(fr, feedrate_mm_s, xy_feedrate); if (DEBUGGING(LEVELING)) DEBUG_POS("destination = current_position", destination); // when in the danger zone if (current_position.z > delta_clip_start_height) { - if (rz > delta_clip_start_height) { // staying in the danger zone - destination.set(rx, ry, rz); // move directly (uninterpolated) + if (rz > delta_clip_start_height) { // staying in the danger zone + destination.set(rx, ry, rz); // move directly (uninterpolated) prepare_internal_fast_move_to_destination(); // set current_position from destination if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position); return; @@ -432,10 +439,6 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const_f #elif IS_SCARA - if (!position_is_reachable(rx, ry)) return; - - destination = current_position; - // If Z needs to raise, do it before moving XY if (destination.z < rz) { destination.z = rz;