@@ -1761,7 +1761,7 @@ void Stepper::pulse_phase_isr() {
1761
1761
}while (0 )
1762
1762
1763
1763
#define PAGE_PULSE_PREP (AXIS ) do { \
1764
- step_needed.set (_AXIS (AXIS), \
1764
+ step_needed.set (_AXIS (AXIS), \
1765
1765
pgm_read_byte (&segment_table[page_step_state.sd [_AXIS (AXIS)]][page_step_state.segment_steps & 0x7 ])); \
1766
1766
}while (0 )
1767
1767
@@ -1802,7 +1802,7 @@ void Stepper::pulse_phase_isr() {
1802
1802
page_step_state.bd [_AXIS (AXIS)] += VALUE;
1803
1803
1804
1804
#define PAGE_PULSE_PREP (AXIS ) do { \
1805
- step_needed.set (_AXIS (AXIS), \
1805
+ step_needed.set (_AXIS (AXIS), \
1806
1806
pgm_read_byte (&segment_table[page_step_state.sd [_AXIS (AXIS)]][page_step_state.segment_steps & 0x3 ])); \
1807
1807
}while (0 )
1808
1808
@@ -1890,7 +1890,7 @@ void Stepper::pulse_phase_isr() {
1890
1890
PULSE_PREP (E);
1891
1891
1892
1892
#if ENABLED(LIN_ADVANCE)
1893
- if (step_needed. e && la_active ) {
1893
+ if (la_active && step_needed. e ) {
1894
1894
// don't actually step here, but do subtract movements steps
1895
1895
// from the linear advance step count
1896
1896
step_needed.e = false ;
@@ -2070,17 +2070,9 @@ void Stepper::pulse_phase_isr() {
2070
2070
// Get the timer interval and the number of loops to perform per tick
2071
2071
hal_timer_t Stepper::calc_timer_interval (uint32_t step_rate, uint8_t loops) {
2072
2072
#if DISABLED(DISABLE_MULTI_STEPPING)
2073
- if (loops >= 16 ) {
2074
- step_rate >>= 4 ;
2075
- loops >>= 4 ;
2076
- }
2077
- if (loops >= 4 ) {
2078
- step_rate >>= 2 ;
2079
- loops >>= 2 ;
2080
- }
2081
- if (loops >= 2 ) {
2082
- step_rate >>= 1 ;
2083
- }
2073
+ if (loops >= 16 ) { step_rate >>= 4 ; loops >>= 4 ; }
2074
+ if (loops >= 4 ) { step_rate >>= 2 ; loops >>= 2 ; }
2075
+ if (loops >= 2 ) { step_rate >>= 1 ; }
2084
2076
#else
2085
2077
NOMORE (step_rate, uint32_t (MAX_STEP_ISR_FREQUENCY_1X));
2086
2078
#endif
@@ -2110,7 +2102,7 @@ hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t loops) {
2110
2102
}
2111
2103
else {
2112
2104
step_rate = 0 ;
2113
- uintptr_t table_address = (uintptr_t )&speed_lookuptable_slow[0 ][0 ];
2105
+ const uintptr_t table_address = (uintptr_t )&speed_lookuptable_slow[0 ][0 ];
2114
2106
return uint16_t (pgm_read_word (table_address));
2115
2107
}
2116
2108
}
@@ -2585,13 +2577,13 @@ hal_timer_t Stepper::block_phase_isr() {
2585
2577
2586
2578
// Initialize the trapezoid generator from the current block.
2587
2579
#if ENABLED(LIN_ADVANCE)
2588
- la_active = bool (current_block->la_advance_rate );
2580
+ la_active = (current_block->la_advance_rate != 0 );
2589
2581
#if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1
2590
2582
// If the now active extruder wasn't in use during the last move, its pressure is most likely gone.
2591
2583
if (stepper_extruder != last_moved_extruder) la_advance_steps = 0 ;
2592
2584
#endif
2593
2585
if (la_active) {
2594
- // apply LA scaling and discount the effect of frequency scaling
2586
+ // Apply LA scaling and discount the effect of frequency scaling
2595
2587
la_dividend = (advance_dividend.e << current_block->la_scaling ) << oversampling_factor;
2596
2588
}
2597
2589
#endif
@@ -2671,8 +2663,8 @@ hal_timer_t Stepper::block_phase_isr() {
2671
2663
// the acceleration and speed values calculated in block_phase_isr().
2672
2664
// This helps keep LA in sync with, for example, S_CURVE_ACCELERATION.
2673
2665
la_delta_error += la_dividend;
2674
- const bool step_needed = la_delta_error >= 0 ;
2675
- if (step_needed ) {
2666
+ const bool e_step_needed = la_delta_error >= 0 ;
2667
+ if (e_step_needed ) {
2676
2668
count_position.e += count_direction.e ;
2677
2669
la_advance_steps += count_direction.e ;
2678
2670
la_delta_error -= advance_divisor;
@@ -2683,7 +2675,7 @@ hal_timer_t Stepper::block_phase_isr() {
2683
2675
2684
2676
TERN_ (I2S_STEPPER_STREAM, i2s_push_sample ());
2685
2677
2686
- if (step_needed ) {
2678
+ if (e_step_needed ) {
2687
2679
// Enforce a minimum duration for STEP pulse ON
2688
2680
#if ISR_PULSE_CONTROL
2689
2681
USING_TIMED_PULSE ();
0 commit comments