39#if !defined(UNIT_TEST)
45 int16_t
calculate(uint32_t currMicros)
const;
57#if !defined(UNIT_TEST)
61 explicit tooth_interval_calculator_t(uint32_t toothLastToothTime, uint32_t toothLastMinusOneToothTime, uint16_t toothAngle,
bool toothAngleCorrect);
63 int16_t
calculate(uint32_t currMicros)
const;
73#if !defined(UNIT_TEST)
84 int16_t
calculate(
const int16_t toothAngles[])
const;
95#if !defined(UNIT_TEST)
109#if !defined(UNIT_TEST)
static auto atomic_copy(Args &&... args)
Atomically copy the forwarding reference arguments into a std::tuple<>
Definition atomic.h:24
The tune page structs and related defines.
int16_t CRANK_ANGLE_MAX_IGN
The number of crank degrees that the system tracks ignition over.
Definition crankMaths.cpp:14
int16_t CRANK_ANGLE_MAX_INJ
The number of crank degrees that the system tracks fuel injection over.
Definition crankMaths.cpp:15
const config4 & page4
Definition engineProtection.cpp:172
static T nudge(T min, T max, T value)
Make **one* pass at correcting the value into the range [ min, max)
Definition maths.h:351
static auto atomic_make_lookup_caa(const state_t &decoderState)
Definition crank_angle_calculator.h:191
static uint16_t clampCrankAngle(int16_t crankAngle)
Definition crank_angle_calculator.h:204
static auto atomic_make_angle_caa(const state_t &decoderState)
Definition crank_angle_calculator.h:199
static auto atomic_make_lookup_caa_secondary(const state_t &decoderState)
Definition crank_angle_calculator.h:195
Definition basicDistributor.cpp:8
Workaround when min() & max() are defined as macros, which generates compile errors in most C++ stand...
const config4 uint16_t crankAngle
Definition scheduler_ignition_controller.cpp:724
Definition config_pages.h:357
Definition crank_angle_calculator.h:176
compute_crank_angle_calculator_tooth_interval_t()=default
int16_t calculateCrankAngle(uint32_t currMicros, const config4 &page4) const
Calculate the crank angle.
Definition crank_angle_calculator.cpp:160
A crank angle calculator that computes the initial crank angle from a tooth angle.
Definition crank_angle_calculator.h:91
int16_t calculate(void) const
Definition crank_angle_calculator.cpp:69
uint16_t _toothCurrentCount
1-based tooth number
Definition crank_angle_calculator.h:92
uint16_t _toothAngle
Tooth angle (1-359°)
Definition crank_angle_calculator.h:93
compute_initial_calculator_t()=default
A crank angle calculator that computes a temporal adjustment based on when the tooth was last detecte...
Definition crank_angle_calculator.h:36
uint32_t _toothLastToothTime
Time in µS that the current tooth was last detected.
Definition crank_angle_calculator.h:37
int16_t calculate(uint32_t currMicros) const
Definition crank_angle_calculator.cpp:18
last_tooth_rev_calculator_t()=default
Definition crank_angle_calculator.h:132
lookup_crank_angle_calculator_t()=default
int16_t calculateCrankAngle(uint32_t currMicros, const int16_t toothAngles[], const config4 &page4) const
Calculate the crank angle.
Definition crank_angle_calculator.cpp:114
Definition crank_angle_calculator.h:161
int16_t calculateCrankAngle(uint32_t currMicros, const int16_t toothAngles[], const config4 &page4) const
Calculate the crank angle.
Definition crank_angle_calculator.cpp:144
lookup_crank_angle_calculator_tooth_interval_t()=default
A crank angle calculator that looks up the initial crank angle from an array.
Definition crank_angle_calculator.h:70
int16_t calculate(const int16_t toothAngles[]) const
Calculate the crank angle.
Definition crank_angle_calculator.cpp:51
lookup_initial_calculator_t()=default
uint16_t _toothCurrentCount
1-based tooth number
Definition crank_angle_calculator.h:71
A crank angle calculator that computes a revolution adjustment.
Definition crank_angle_calculator.h:106
int16_t calculate(const config4 &page4) const
Definition crank_angle_calculator.cpp:86
bool _revZeroOrOne
When calculating over 720°, tells the calculator if we are in the 1st revolution (false) or the 2nd (...
Definition crank_angle_calculator.h:107
sequential_correction_calculator_t()=default
Definition crank_angle_calculator.h:127
int16_t calculateCrankAngle(int16_t initialCrankAngle, uint32_t currMicros, const config4 &page4) const
Definition crank_angle_calculator.cpp:99
Definition decoder_state.h:17
volatile uint16_t secondaryToothCount
Definition decoder_state.h:41
volatile uint16_t triggerToothAngle
Definition decoder_state.h:45
uint16_t toothCurrentCount
Definition decoder_state.h:24
volatile bool revolutionOne
Definition decoder_state.h:39
volatile uint32_t toothLastToothTime
Definition decoder_state.h:27
A crank angle calculator that computes a temporal adjustment based on the gap between the 2 most rece...
Definition crank_angle_calculator.h:51
uint32_t _toothLastMinusOneToothTime
Time in µS that the tooth before the last tooth was detected.
Definition crank_angle_calculator.h:53
bool _toothAngleCorrect
Is _toothAngle valid.
Definition crank_angle_calculator.h:55
int16_t calculate(uint32_t currMicros) const
Definition crank_angle_calculator.cpp:32
uint16_t _toothAngle
Tooth angle (1-359°)
Definition crank_angle_calculator.h:54
tooth_interval_calculator_t()=default
uint32_t _toothLastToothTime
Time in µS that the current tooth was last detected.
Definition crank_angle_calculator.h:52
Definition crank_angle_calculator.h:147
int16_t calculateCrankAngle(uint32_t currMicros, const config4 &page4) const
Calculate the crank angle.
Definition crank_angle_calculator.cpp:129
trigger_angle_crank_angle_calculator_t()=default