@@ -230,6 +230,7 @@ uint32_t Stepper::advance_divisor = 0,
230
230
int32_t Stepper::la_delta_error = 0 ,
231
231
Stepper::la_dividend = 0 ,
232
232
Stepper::la_advance_steps = 0 ;
233
+ bool Stepper::la_active = false ;
233
234
#endif
234
235
235
236
#if HAS_SHAPING
@@ -1868,7 +1869,7 @@ void Stepper::pulse_phase_isr() {
1868
1869
PULSE_PREP (E);
1869
1870
1870
1871
#if ENABLED(LIN_ADVANCE)
1871
- if (step_needed. e && current_block-> la_advance_rate ) {
1872
+ if (la_active && step_needed. e ) {
1872
1873
// don't actually step here, but do subtract movements steps
1873
1874
// from the linear advance step count
1874
1875
step_needed.e = false ;
@@ -2170,7 +2171,7 @@ hal_timer_t Stepper::block_phase_isr() {
2170
2171
acceleration_time += interval;
2171
2172
2172
2173
#if ENABLED(LIN_ADVANCE)
2173
- if (current_block-> la_advance_rate ) {
2174
+ if (la_active ) {
2174
2175
const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0 ;
2175
2176
la_interval = calc_timer_interval (acc_step_rate + la_step_rate) << current_block->la_scaling ;
2176
2177
}
@@ -2240,7 +2241,7 @@ hal_timer_t Stepper::block_phase_isr() {
2240
2241
deceleration_time += interval;
2241
2242
2242
2243
#if ENABLED(LIN_ADVANCE)
2243
- if (current_block-> la_advance_rate ) {
2244
+ if (la_active ) {
2244
2245
const uint32_t la_step_rate = la_advance_steps > current_block->final_adv_steps ? current_block->la_advance_rate : 0 ;
2245
2246
if (la_step_rate != step_rate) {
2246
2247
bool reverse_e = la_step_rate > step_rate;
@@ -2301,7 +2302,7 @@ hal_timer_t Stepper::block_phase_isr() {
2301
2302
ticks_nominal = calc_timer_interval (current_block->nominal_rate << oversampling_factor, steps_per_isr);
2302
2303
2303
2304
#if ENABLED(LIN_ADVANCE)
2304
- if (current_block-> la_advance_rate )
2305
+ if (la_active )
2305
2306
la_interval = calc_timer_interval (current_block->nominal_rate ) << current_block->la_scaling ;
2306
2307
#endif
2307
2308
}
@@ -2556,11 +2557,12 @@ hal_timer_t Stepper::block_phase_isr() {
2556
2557
2557
2558
// Initialize the trapezoid generator from the current block.
2558
2559
#if ENABLED(LIN_ADVANCE)
2560
+ la_active = (current_block->la_advance_rate != 0 );
2559
2561
#if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1
2560
2562
// If the now active extruder wasn't in use during the last move, its pressure is most likely gone.
2561
2563
if (stepper_extruder != last_moved_extruder) la_advance_steps = 0 ;
2562
2564
#endif
2563
- if (current_block-> la_advance_rate ) {
2565
+ if (la_active ) {
2564
2566
// Apply LA scaling and discount the effect of frequency scaling
2565
2567
la_dividend = (advance_dividend.e << current_block->la_scaling ) << oversampling_factor;
2566
2568
}
@@ -2621,7 +2623,7 @@ hal_timer_t Stepper::block_phase_isr() {
2621
2623
acceleration_time += interval;
2622
2624
2623
2625
#if ENABLED(LIN_ADVANCE)
2624
- if (current_block-> la_advance_rate ) {
2626
+ if (la_active ) {
2625
2627
const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0 ;
2626
2628
la_interval = calc_timer_interval (current_block->initial_rate + la_step_rate) << current_block->la_scaling ;
2627
2629
}
0 commit comments