Browse Source

Fix vector normalization in JD (#17938)

vanilla_fb_2.0.x
XDA-Bam 5 years ago
committed by GitHub
parent
commit
3381a4ab03
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Marlin/src/module/planner.cpp

11
Marlin/src/module/planner.cpp

@ -2256,16 +2256,17 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
{ steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e } { steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e }
#endif #endif
; ;
unit_vec *= inverse_millimeters;
#if IS_CORE && HAS_JUNCTION_DEVIATION
/** /**
* On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y]. * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y].
* So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters". * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters".
* => normalize the complete junction vector * => normalize the complete junction vector.
* Elsewise, when needed JD factors in the E component
*/ */
normalize_junction_vector(unit_vec); if (ENABLED(IS_CORE) || esteps > 0)
#endif normalize_junction_vector(unit_vec); // Normalize with XYZE components
else
unit_vec *= inverse_millimeters; // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2))
// Skip first block or when previous_nominal_speed is used as a flag for homing and offset cycles. // Skip first block or when previous_nominal_speed is used as a flag for homing and offset cycles.
if (moves_queued && !UNEAR_ZERO(previous_nominal_speed_sqr)) { if (moves_queued && !UNEAR_ZERO(previous_nominal_speed_sqr)) {

Loading…
Cancel
Save