Speeduino
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
crank_angle_calculator.h File Reference

Crank calculations. To be reused by individual decoders. More...

#include "src/utils/nominmax.h"
#include <tuple>
#include "config_pages.h"
#include "atomic.h"
#include "decoder_state.h"

Go to the source code of this file.

Classes

struct  decoders::shared::last_tooth_rev_calculator_t
 A crank angle calculator that computes a temporal adjustment based on when the tooth was last detected. More...
 
struct  decoders::shared::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  decoders::shared::lookup_initial_calculator_t
 A crank angle calculator that looks up the initial crank angle from an array. More...
 
struct  decoders::shared::compute_initial_calculator_t
 A crank angle calculator that computes the initial crank angle from a tooth angle. More...
 
struct  decoders::shared::sequential_correction_calculator_t
 A crank angle calculator that computes a revolution adjustment. More...
 
struct  decoders::shared::simple_crank_angle_calculator_t
 
struct  decoders::shared::lookup_crank_angle_calculator_t
 
struct  decoders::shared::trigger_angle_crank_angle_calculator_t
 
struct  decoders::shared::lookup_crank_angle_calculator_tooth_interval_t
 
struct  decoders::shared::compute_crank_angle_calculator_tooth_interval_t
 

Namespaces

namespace  decoders
 
namespace  decoders::shared
 

Functions

static auto decoders::shared::atomic_make_lookup_caa (const state_t &decoderState)
 
static auto decoders::shared::atomic_make_lookup_caa_secondary (const state_t &decoderState)
 
static auto decoders::shared::atomic_make_angle_caa (const state_t &decoderState)
 
static uint16_t decoders::shared::clampCrankAngle (int16_t crankAngle)
 

Detailed Description

Crank calculations. To be reused by individual decoders.

Crank angle calculations (usually) have 4 components:

  1. The angle of the last detected tooth. This can be computed from a fixed tooth angle or looked up from an array. This only gives accuracy to the nearest tooth.
  2. A temporal adjustment to account for rotation since the last tooth was detected. This can be a simple delta or based on the interval between teeth
  3. An adjustment for sequential operation to account for the 1st (0-359°) or 2nd (360-719°) revolution
  4. A user defined offset from TDC (this accounts for sensor position on the wheel)