From 49fba5a82a488ff1eb6731fd9a0157e9fc9a2497 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 12 Apr 2021 20:15:41 -0500 Subject: [PATCH] Add 'blocking move' comments --- Marlin/src/module/motion.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index afd30a44e..9c1f8cd4a 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 EITHER(DELTA, IS_SCARA) + if (!position_is_reachable(rx, ry)) return; + destination = current_position; // sync destination at the start + #endif + #if ENABLED(DELTA) - if (!position_is_reachable(rx, ry)) return; - REMEMBER(fr, feedrate_mm_s, xy_feedrate); - destination = current_position; // sync destination at the start - 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;