Speeduino
Loading...
Searching...
No Matches
Functions
Universal Decoder Routines

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)
 

Detailed Description

Universal (shared between decoders) decoder routines.

Function Documentation

◆ addToothLogEntry()

static void addToothLogEntry ( unsigned long  toothTime,
byte  whichTooth 
)
inlinestatic

Add tooth log entry to toothHistory (array). Enabled by (either) currentStatus.toothLogEnabled and currentStatus.compositeTriggerUsed.

Parameters
toothTime- Tooth Time
whichTooth- 0 for Primary (Crank), 2 for Secondary (Cam) 3 for Tertiary (Cam)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPerToothTiming()

static void checkPerToothTiming ( int16_t  crankAngle,
uint16_t  currentTooth 
)
inlinestatic

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)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clampRpm()

static uint16_t clampRpm ( uint16_t  rpm)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crankingGetRPM()

static int crankingGetRPM ( byte  totalTeeth,
bool  isCamTeeth 
)
static

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)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ engineIsRunning()

bool engineIsRunning ( uint32_t  curTime)

Is the engine running?

This is based on whether or not the decoder has detected a tooth recently

Parameters
curTimeThe time in µS to use for the liveness check. Typically the result of a recent call to micros()
Returns
true If the engine is turning
false If the engine is not turning
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCranking()

static bool IsCranking ( const statuses status)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loggerPrimaryISR()

void loggerPrimaryISR ( void  )

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loggerSecondaryISR()

void loggerSecondaryISR ( void  )

Interrupt handler for secondary trigger. As loggerPrimaryISR, but for the secondary trigger.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loggerTertiaryISR()

void loggerTertiaryISR ( void  )

Interrupt handler for third trigger. As loggerPrimaryISR, but for the third trigger.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetDecoder()

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.

Returns
void
Here is the caller graph for this function:

◆ RpmFromRevolutionTimeUs()

static uint16_t RpmFromRevolutionTimeUs ( uint32_t  revTime)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFilter()

static void setFilter ( unsigned long  curGap)
static

Sets the new filter time based on the current settings. This ONLY works for even spaced decoders.

Here is the caller graph for this function:

◆ SetRevolutionTime()

static bool SetRevolutionTime ( uint32_t  revTime)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stdGetRPM()

static uint16_t stdGetRPM ( bool  isCamTeeth)
static

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.

Parameters
degreesOver- the number of crank degrees between tooth #1s. Some patterns have a tooth #1 every crank rev, others are every cam rev.
Returns
RPM
Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeToAngleIntervalTooth()

static uint16_t timeToAngleIntervalTooth ( uint32_t  time)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateRevolutionTimeFromTeeth()

static bool UpdateRevolutionTimeFromTeeth ( bool  isCamTeeth)
static
Here is the call graph for this function:
Here is the caller graph for this function: