Reset LA_phase at each trapezoid stage

There used to be a single stage where an extruder reversal could occur,
but since PR #2591 reversals can happen up to two times per trapezoid.

Reset LA_phase when ADV_INIT is set, since it is re-inizialized only
when needed a few lines afterward. This improves performance by avoiding
to check the phase continuosly to the end of the trapezoid.

Likewise, always set ADV_INIT during the first cruising step, also to
force a LA_phase reset.
This commit is contained in:
Yuri D'Elia 2020-06-22 00:19:47 +02:00
parent 7c140bc497
commit 51a539608c

View File

@ -848,12 +848,10 @@ FORCE_INLINE void isr() {
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
if(current_block->use_advance_lead) { if(current_block->use_advance_lead) {
if (!nextAdvanceISR) { // Due to E-jerk, there can be discontinuities in pressure state where an
// Due to E-jerk, there can be discontinuities in pressure state where an // acceleration or deceleration can be skipped or joined with the previous block.
// acceleration or deceleration can be skipped or joined with the previous block. // If LA was not previously active, re-check the pressure level
// If LA was not previously active, re-check the pressure level la_state = ADV_INIT;
la_state = ADV_INIT;
}
} }
#endif #endif
} }
@ -865,6 +863,7 @@ FORCE_INLINE void isr() {
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
// avoid multiple instances or function calls to advance_spread // avoid multiple instances or function calls to advance_spread
if (la_state & ADV_INIT) { if (la_state & ADV_INIT) {
LA_phase = -1;
if (current_adv_steps == target_adv_steps) { if (current_adv_steps == target_adv_steps) {
// nothing to be done in this phase // nothing to be done in this phase
la_state = 0; la_state = 0;