Minor bits missed from last commit

This commit is contained in:
Josh Stewart 2019-03-06 18:17:33 +11:00
parent 9101356c5a
commit 05e3d928ad
3 changed files with 28 additions and 2 deletions

View File

@ -66,7 +66,8 @@ void initBoard()
//TCCR5B = (1 << CS12); //Timer5 Control Reg B: Timer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
//TCCR5B = 0x03; //aka Divisor = 64 = 490.1Hz
TCCR5B = (1 << CS11) | (1 << CS10); //Timer5 Control Reg B: Timer Prescaler set to 64. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
TIFR5 = 0xFF;
TIFR5 |= (1 << OCF5A) | (1<<OCF5B) | (1<<OCF5C);
//0xFF;
#if defined(TIMER5_MICROS)
TIMSK5 |= (1 << TOIE5); //Enable the timer5 overflow interrupt (See timers.ino for ISR)

View File

@ -208,7 +208,7 @@ For each ignition channel, a check is made whether we're at the relevant tooth a
Only if both these conditions are met will the schedule be updated with the latest timing information.
If it's the correct tooth, but the schedule is not yet started, calculate and an end compare value (This situation occurs when both the start and end of the ignition pulse happen after the end tooth, but before the next tooth)
*/
#define MIN_CYCLES_FOR_ENDCOMPARE 5
#define MIN_CYCLES_FOR_ENDCOMPARE 6
#define checkPerToothTiming(crankAngle, currentTooth) \
{ \
if (fixedCrankingOverride == 0 && currentStatus.RPM > 0) \

View File

@ -65,6 +65,11 @@ void initialiseSchedulers()
ignitionSchedule7.Status = OFF;
ignitionSchedule8.Status = OFF;
IGN1_TIMER_ENABLE();
IGN2_TIMER_ENABLE();
IGN3_TIMER_ENABLE();
IGN4_TIMER_ENABLE();
ignitionSchedule1.schedulesSet = 0;
ignitionSchedule2.schedulesSet = 0;
ignitionSchedule3.schedulesSet = 0;
@ -1009,6 +1014,11 @@ static inline void ignitionSchedule1Interrupt() //Most ARM chips can simply call
ignitionCount += 1; //Increment the igintion counter
IGN1_TIMER_DISABLE();
}
else if (ignitionSchedule1.Status == OFF)
{
//Catch any spurious interrupts. This really shouldn't ever be called, but there as a safety
IGN1_TIMER_DISABLE();
}
}
#endif
@ -1036,6 +1046,11 @@ static inline void ignitionSchedule2Interrupt() //Most ARM chips can simply call
ignitionCount += 1; //Increment the igintion counter
IGN2_TIMER_DISABLE();
}
else if (ignitionSchedule2.Status == OFF)
{
//Catch any spurious interrupts. This really shouldn't ever be called, but there as a safety
IGN2_TIMER_DISABLE();
}
}
#endif
@ -1073,6 +1088,11 @@ static inline void ignitionSchedule3Interrupt() //Most ARM chips can simply call
}
else { IGN3_TIMER_DISABLE(); }
}
else if (ignitionSchedule3.Status == OFF)
{
//Catch any spurious interrupts. This really shouldn't ever be called, but there as a safety
IGN3_TIMER_DISABLE();
}
}
#endif
@ -1109,6 +1129,11 @@ static inline void ignitionSchedule4Interrupt() //Most ARM chips can simply call
}
else { IGN4_TIMER_DISABLE(); }
}
else if (ignitionSchedule4.Status == OFF)
{
//Catch any spurious interrupts. This really shouldn't ever be called, but there as a safety
IGN4_TIMER_DISABLE();
}
}
#endif