Reduce Step Smoothing ceiling to 50% CPU usage (#18719)

This commit is contained in:
Jason Smith
2020-07-19 19:53:29 -07:00
committed by GitHub
parent 4a55bdb165
commit a847f37d43
2 changed files with 7 additions and 5 deletions

View File

@@ -2099,11 +2099,11 @@ uint32_t Stepper::block_phase_isr() {
#if ENABLED(ADAPTIVE_STEP_SMOOTHING)
uint8_t oversampling = 0; // Assume no axis smoothing (via oversampling)
// Decide if axis smoothing is possible
uint32_t max_rate = current_block->nominal_rate; // Get the maximum rate (maximum event speed)
uint32_t max_rate = current_block->nominal_rate; // Get the step event rate
while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible...
max_rate <<= 1; // Try to double the rate
if (max_rate >= MAX_STEP_ISR_FREQUENCY_1X) break; // Don't exceed the estimated ISR limit
++oversampling; // Increase the oversampling (used for left-shift)
if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit
++oversampling; // Increase the oversampling (used for left-shift)
}
oversampling_factor = oversampling; // For all timer interval calculations
#else