Speedup advance_spread for common divisors
This commit is contained in:
parent
fa7ecfc38e
commit
935a798236
|
|
@ -734,7 +734,14 @@ FORCE_INLINE void advance_spread(uint16_t timer)
|
||||||
else
|
else
|
||||||
eISR_Err -= timer - block;
|
eISR_Err -= timer - block;
|
||||||
|
|
||||||
eISR_Rate = timer / ticks;
|
if (ticks == 1)
|
||||||
|
eISR_Rate = timer;
|
||||||
|
else if (ticks == 2)
|
||||||
|
eISR_Rate = timer / 2;
|
||||||
|
else if (ticks == 4)
|
||||||
|
eISR_Rate = timer / 4;
|
||||||
|
else
|
||||||
|
eISR_Rate = timer / ticks;
|
||||||
nextAdvanceISR = eISR_Rate / 2;
|
nextAdvanceISR = eISR_Rate / 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -822,9 +829,8 @@ FORCE_INLINE void isr() {
|
||||||
}
|
}
|
||||||
_NEXT_ISR(OCR1A_nominal);
|
_NEXT_ISR(OCR1A_nominal);
|
||||||
#ifdef LIN_ADVANCE
|
#ifdef LIN_ADVANCE
|
||||||
if (current_block->use_advance_lead && nextAdvanceISR != ADV_NEVER) {
|
if (current_block->use_advance_lead && nextAdvanceISR != ADV_NEVER)
|
||||||
advance_spread(OCR1A_nominal);
|
advance_spread(OCR1A_nominal);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
//WRITE_NC(LOGIC_ANALYZER_CH1, false);
|
//WRITE_NC(LOGIC_ANALYZER_CH1, false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue