File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -2099,11 +2099,11 @@ uint32_t Stepper::block_phase_isr() {
20992099 #if ENABLED(ADAPTIVE_STEP_SMOOTHING)
21002100 uint8_t oversampling = 0 ; // Assume no axis smoothing (via oversampling)
21012101 // Decide if axis smoothing is possible
2102- uint32_t max_rate = current_block->nominal_rate ; // Get the maximum rate (maximum event speed)
2102+ uint32_t max_rate = current_block->nominal_rate ; // Get the step event rate
21032103 while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible...
21042104 max_rate <<= 1 ; // Try to double the rate
2105- if (max_rate >= MAX_STEP_ISR_FREQUENCY_1X) break ; // Don't exceed the estimated ISR limit
2106- ++oversampling; // Increase the oversampling (used for left-shift)
2105+ if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit
2106+ ++oversampling; // Increase the oversampling (used for left-shift)
21072107 }
21082108 oversampling_factor = oversampling; // For all timer interval calculations
21092109 #else
Original file line number Diff line number Diff line change 229229#define MAX_STEP_ISR_FREQUENCY_2X ((F_CPU) / ISR_EXECUTION_CYCLES(2 ))
230230#define MAX_STEP_ISR_FREQUENCY_1X ((F_CPU) / ISR_EXECUTION_CYCLES(1 ))
231231
232- // The minimum allowable frequency for step smoothing will be 1/10 of the maximum nominal frequency (in Hz)
233- #define MIN_STEP_ISR_FREQUENCY MAX_STEP_ISR_FREQUENCY_1X
232+ // The minimum step ISR rate used by ADAPTIVE_STEP_SMOOTHING to target 50% CPU usage
233+ // This does not account for the possibility of multi-stepping.
234+ // Perhaps DISABLE_MULTI_STEPPING should be required with ADAPTIVE_STEP_SMOOTHING.
235+ #define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X / 2 )
234236
235237//
236238// Stepper class definition
You can’t perform that action at this time.
0 commit comments