Use a define instead of hard-coding a divider
This commit is contained in:
parent
a2fa8e5313
commit
707849e6c4
1 changed files with 6 additions and 2 deletions
|
@ -853,6 +853,10 @@ FORCE_INLINE void advance_isr() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LA_FREQ_MDIV 8 // divider for the advance frequency for maximum
|
||||||
|
// time allotted to merge regular and advance
|
||||||
|
// ticks (stick to a power-of-two)
|
||||||
|
|
||||||
FORCE_INLINE void advance_isr_scheduler() {
|
FORCE_INLINE void advance_isr_scheduler() {
|
||||||
// Integrate the final timer value, accounting for scheduling adjustments
|
// Integrate the final timer value, accounting for scheduling adjustments
|
||||||
if(nextAdvanceISR && nextAdvanceISR != ADV_NEVER)
|
if(nextAdvanceISR && nextAdvanceISR != ADV_NEVER)
|
||||||
|
@ -880,7 +884,7 @@ FORCE_INLINE void advance_isr_scheduler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the next advance isr if triggered now or soon enough
|
// Run the next advance isr if triggered now or soon enough
|
||||||
bool eisr = nextAdvanceISR < (TCNT1 + nextAdvanceISR / 8);
|
bool eisr = nextAdvanceISR < (TCNT1 + nextAdvanceISR / LA_FREQ_MDIV);
|
||||||
if (eisr)
|
if (eisr)
|
||||||
{
|
{
|
||||||
#ifdef LA_DEBUG_LOGIC
|
#ifdef LA_DEBUG_LOGIC
|
||||||
|
@ -910,7 +914,7 @@ FORCE_INLINE void advance_isr_scheduler() {
|
||||||
|
|
||||||
// Schedule the next closest tick, ignoring advance if scheduled to
|
// Schedule the next closest tick, ignoring advance if scheduled to
|
||||||
// soon in order to avoid skewing the regular stepper acceleration
|
// soon in order to avoid skewing the regular stepper acceleration
|
||||||
if (nextAdvanceISR != ADV_NEVER && (nextAdvanceISR + TCNT1 + nextAdvanceISR / 8) < nextMainISR)
|
if (nextAdvanceISR != ADV_NEVER && (nextAdvanceISR + TCNT1 + nextAdvanceISR / LA_FREQ_MDIV) < nextMainISR)
|
||||||
OCR1A = nextAdvanceISR;
|
OCR1A = nextAdvanceISR;
|
||||||
else
|
else
|
||||||
OCR1A = nextMainISR;
|
OCR1A = nextMainISR;
|
||||||
|
|
Loading…
Add table
Reference in a new issue