Speeduino
Loading...
Searching...
No Matches
Classes | Functions
decoders::shared Namespace Reference

Classes

struct  compute_crank_angle_calculator_tooth_interval_t
 
struct  compute_initial_calculator_t
 A crank angle calculator that computes the initial crank angle from a tooth angle. More...
 
struct  last_tooth_rev_calculator_t
 A crank angle calculator that computes a temporal adjustment based on when the tooth was last detected. More...
 
struct  lookup_crank_angle_calculator_t
 
struct  lookup_crank_angle_calculator_tooth_interval_t
 
struct  lookup_initial_calculator_t
 A crank angle calculator that looks up the initial crank angle from an array. More...
 
struct  sequential_correction_calculator_t
 A crank angle calculator that computes a revolution adjustment. More...
 
struct  simple_crank_angle_calculator_t
 
struct  state_t
 
struct  tooth_interval_calculator_t
 A crank angle calculator that computes a temporal adjustment based on the gap between the 2 most recent teeth rather than the last full revolution. More...
 
struct  tooth_speed_sample_t
 
struct  trigger_angle_crank_angle_calculator_t
 

Functions

static auto atomic_make_lookup_caa (const state_t &decoderState)
 
static auto atomic_make_lookup_caa_secondary (const state_t &decoderState)
 
static auto atomic_make_angle_caa (const state_t &decoderState)
 
static uint16_t clampCrankAngle (int16_t crankAngle)
 
void checkPerToothTiming (const statuses &current, const state_t &decoderState, const config4 &page4, int16_t crankAngle, uint16_t currentTooth)
 
uint16_t clampToToothCount (const config4 &page4, int16_t toothNum, uint8_t toothAdder)
 
static uint8_t calcToothCalcShift (bool isCamTeeth)
 
tooth_speed_sample_t atomicToothSpeedSample (const statuses &current, const state_t &decoderState)
 
uint32_t publishedRevolutionTime (const statuses &current)
 
static bool toothInterval (uint32_t lastTime, uint32_t prevTime, uint32_t &intervalUs)
 
bool lastToothInterval (const tooth_speed_sample_t &sample, uint32_t &intervalUs)
 
bool toothOneInterval (const tooth_speed_sample_t &sample, uint32_t &intervalUs)
 
static uint32_t revolutionTimeFromInterval (uint32_t intervalUs, uint16_t toothAngleDeg)
 
bool revolutionTimeFromLastTooth (const tooth_speed_sample_t &sample, uint32_t &revolutionTime)
 
uint32_t stdGetRevolutionTime (const statuses &current, const state_t &decoderState, bool isCamTeeth)
 
uint32_t crankingGetRevolutionTime (const statuses &current, const state_t &decoderState, const config4 &page4, byte totalTeeth, bool isCamTeeth)
 

Function Documentation

◆ atomic_make_angle_caa()

static auto decoders::shared::atomic_make_angle_caa ( const state_t &  decoderState)
inlinestatic

◆ atomic_make_lookup_caa()

static auto decoders::shared::atomic_make_lookup_caa ( const state_t &  decoderState)
inlinestatic

◆ atomic_make_lookup_caa_secondary()

static auto decoders::shared::atomic_make_lookup_caa_secondary ( const state_t &  decoderState)
inlinestatic

◆ atomicToothSpeedSample()

tooth_speed_sample_t decoders::shared::atomicToothSpeedSample ( const statuses &  current,
const state_t &  decoderState 
)

◆ calcToothCalcShift()

static uint8_t decoders::shared::calcToothCalcShift ( bool  isCamTeeth)
inlinestatic

◆ checkPerToothTiming()

void decoders::shared::checkPerToothTiming ( const statuses &  current,
const state_t &  decoderState,
const config4 &  page4,
int16_t  crankAngle,
uint16_t  currentTooth 
)

◆ clampCrankAngle()

static uint16_t decoders::shared::clampCrankAngle ( int16_t  crankAngle)
inlinestatic

◆ clampToToothCount()

uint16_t decoders::shared::clampToToothCount ( const config4 &  page4,
int16_t  toothNum,
uint8_t  toothAdder 
)
inline

◆ crankingGetRevolutionTime()

uint32_t decoders::shared::crankingGetRevolutionTime ( const statuses &  current,
const state_t &  decoderState,
const config4 &  page4,
byte  totalTeeth,
bool  isCamTeeth 
)

This is a special case of revolution time 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) If the revolution time cannot be calculated, the current value is returned unchanged.

◆ lastToothInterval()

bool decoders::shared::lastToothInterval ( const tooth_speed_sample_t &  sample,
uint32_t &  intervalUs 
)

◆ publishedRevolutionTime()

uint32_t decoders::shared::publishedRevolutionTime ( const statuses &  current)

◆ revolutionTimeFromInterval()

static uint32_t decoders::shared::revolutionTimeFromInterval ( uint32_t  intervalUs,
uint16_t  toothAngleDeg 
)
inlinestatic

Crank period implied by one tooth interval that covers toothAngleDeg degrees. Split so interval * 360 cannot wrap a uint32_t: (interval / angle) * 360 + (interval % angle) * 360 / angle.

◆ revolutionTimeFromLastTooth()

bool decoders::shared::revolutionTimeFromLastTooth ( const tooth_speed_sample_t &  sample,
uint32_t &  revolutionTime 
)
Returns
false when the angle or the interval cannot be used. Caller keeps the published period.

◆ stdGetRevolutionTime()

uint32_t decoders::shared::stdGetRevolutionTime ( const statuses &  current,
const state_t &  decoderState,
bool  isCamTeeth 
)

◆ toothInterval()

static bool decoders::shared::toothInterval ( uint32_t  lastTime,
uint32_t  prevTime,
uint32_t &  intervalUs 
)
static

◆ toothOneInterval()

bool decoders::shared::toothOneInterval ( const tooth_speed_sample_t &  sample,
uint32_t &  intervalUs 
)