Speeduino
|
Functions | |
static void | addToothLogEntry (unsigned long toothTime, byte whichTooth) |
void | loggerPrimaryISR (void) |
void | loggerSecondaryISR (void) |
void | loggerTertiaryISR (void) |
static uint16_t | timeToAngleIntervalTooth (uint32_t time) |
static bool | IsCranking (const statuses &status) |
bool | engineIsRunning (uint32_t curTime) |
Is the engine running? | |
void | resetDecoder (void) |
This function is called when the engine is stopped, or when the engine is started. It resets the decoder state and the tooth tracking variables. | |
static bool | SetRevolutionTime (uint32_t revTime) |
static bool | UpdateRevolutionTimeFromTeeth (bool isCamTeeth) |
static uint16_t | clampRpm (uint16_t rpm) |
static uint16_t | RpmFromRevolutionTimeUs (uint32_t revTime) |
static uint16_t | stdGetRPM (bool isCamTeeth) |
static void | setFilter (unsigned long curGap) |
static int | crankingGetRPM (byte totalTeeth, bool isCamTeeth) |
static void | checkPerToothTiming (int16_t crankAngle, uint16_t currentTooth) |
Universal (shared between decoders) decoder routines.
Add tooth log entry to toothHistory (array). Enabled by (either) currentStatus.toothLogEnabled and currentStatus.compositeTriggerUsed.
toothTime | - Tooth Time |
whichTooth | - 0 for Primary (Crank), 2 for Secondary (Cam) 3 for Tertiary (Cam) |
On decoders that are enabled for per tooth based timing adjustments, this function performs the timer compare changes on the schedules themselves For each ignition channel, a check is made whether we're at the relevant tooth and whether that ignition schedule is currently running 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)
This is a special case of RPM measure that is based on the time between the last 2 teeth rather than the time of the last full revolution. This gives much more volatile reading, but is quite useful during cranking, particularly on low resolution patterns. It can only be used on patterns where the teeth are evenly spaced. It takes an argument of the full (COMPLETE) number of teeth per revolution. For a missing tooth wheel, this is the number if the tooth had NOT been missing (Eg 36-1 = 36)
Is the engine running?
This is based on whether or not the decoder has detected a tooth recently
curTime | The time in µS to use for the liveness check. Typically the result of a recent call to micros() |
Interrupt handler for primary trigger. This function is called on both the rising and falling edges of the primary trigger, when either the composite or tooth loggers are turned on.
Interrupt handler for secondary trigger. As loggerPrimaryISR, but for the secondary trigger.
Interrupt handler for third trigger. As loggerPrimaryISR, but for the third trigger.
This function is called when the engine is stopped, or when the engine is started. It resets the decoder state and the tooth tracking variables.
Sets the new filter time based on the current settings. This ONLY works for even spaced decoders.
Compute RPM. As nearly all the decoders use a common method of determining RPM (The time the last full revolution took) A common function is simpler.
degreesOver | - the number of crank degrees between tooth #1s. Some patterns have a tooth #1 every crank rev, others are every cam rev. |