Fix: Junction Deviation calculates wrong cos(theta) on CoreXY (#12879)

This commit is contained in:
HackingGulliver 2019-01-12 02:25:48 +01:00 committed by Scott Lahteine
parent b402040059
commit 1fd8e2c649

View File

@ -2392,6 +2392,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
}; };
#endif #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. // 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)) {
// Compute cosine of angle between previous and current path. (prev_unit_vec is negative) // Compute cosine of angle between previous and current path. (prev_unit_vec is negative)