Skip to content

Commit

Permalink
Fix: Junction Deviation calculates wrong cos(theta) on CoreXY (Marlin…
Browse files Browse the repository at this point in the history
  • Loading branch information
HackingGulliver authored and thinkyhead committed Jan 12, 2019
1 parent b402040 commit 1fd8e2c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
};
#endif

#if IS_CORE && ENABLED(JUNCTION_DEVIATION)
/**
* 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".
* => normalize the complete junction vector
*/
normalize_junction_vector(unit_vec);
#endif

// 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)) {
// Compute cosine of angle between previous and current path. (prev_unit_vec is negative)
Expand Down

0 comments on commit 1fd8e2c

Please sign in to comment.