Skip to content

Commit

Permalink
🐛 Fix kinematic feedrate (MarlinFirmware#24568)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndere1 authored and LCh-77 committed Aug 22, 2022
1 parent 9529ba9 commit 49053ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49053ee

Please sign in to comment.