From d8df9ffd61b112a21a1946a9b120e806886aa54e Mon Sep 17 00:00:00 2001 From: DerAndere <26200979+DerAndere1@users.noreply.github.com> Date: Sun, 31 Jul 2022 03:49:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20kinematic=20feedrate=20(#2?= =?UTF-8?q?4568)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/planner.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 0bf6dfb7d966..6101022fd49d 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1084,7 +1084,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { if (!position_is_reachable(destination)) return true; // Get the linear distance in XYZ - float cartesian_mm = diff.magnitude(); + float cartesian_mm = xyz_float_t(diff).magnitude(); // If the move is very short, check the E move distance TERN_(HAS_EXTRUDERS, if (UNEAR_ZERO(cartesian_mm)) cartesian_mm = ABS(diff.e)); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b4455ca5ec1f..4bc81c1051f3 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2195,7 +2195,7 @@ bool Planner::_populate_block( ); #if SECONDARY_LINEAR_AXES >= 1 && NONE(FOAMCUTTER_XYUV, ARTICULATED_ROBOT_ARM) - if (NEAR_ZERO(distance_sqr)) { + if (UNEAR_ZERO(distance_sqr)) { // Move does not involve any primary linear axes (xyz) but might involve secondary linear axes distance_sqr = (0.0f SECONDARY_AXIS_GANG( @@ -2211,7 +2211,7 @@ bool Planner::_populate_block( #endif #if HAS_ROTATIONAL_AXES && NONE(FOAMCUTTER_XYUV, ARTICULATED_ROBOT_ARM) - if (NEAR_ZERO(distance_sqr)) { + if (UNEAR_ZERO(distance_sqr)) { // Move involves only rotational axes. Calculate angular distance in accordance with LinuxCNC TERN_(INCH_MODE_SUPPORT, cartesian_move = false); distance_sqr = ROTATIONAL_AXIS_GANG(sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k), + sq(steps_dist_mm.u), + sq(steps_dist_mm.v), + sq(steps_dist_mm.w)); @@ -3154,7 +3154,9 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s PlannerHints ph = hints; if (!hints.millimeters) - ph.millimeters = (cart_dist_mm.x || cart_dist_mm.y) ? cart_dist_mm.magnitude() : TERN0(HAS_Z_AXIS, ABS(cart_dist_mm.z)); + ph.millimeters = (cart_dist_mm.x || cart_dist_mm.y) + ? xyz_pos_t(cart_dist_mm).magnitude() + : TERN0(HAS_Z_AXIS, ABS(cart_dist_mm.z)); #if ENABLED(SCARA_FEEDRATE_SCALING) // For SCARA scale the feedrate from mm/s to degrees/s