Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::control::PointCalibration< N, Standard > Class Template Reference

Capture N reference points, then fit. More...

Detailed Description

template<uint8_t N, typename Standard = VOctStandard>
class sbl::control::PointCalibration< N, Standard >

Capture N reference points, then fit.

The app decides when a reading has settled and calls capture() with the source's current su. The last capture computes the fit. cancel() restores the fit that was in force when begin() was called, so an abandoned calibration costs nothing.

Definition at line 112 of file calibration.hpp.

#include <calibration.hpp>

Public Member Functions

 PointCalibration (const float(&references)[N])
 
void begin ()
 Start capturing at point 0, remembering the current fit.
 
bool capture (float measured_su)
 Record the source's reading for the current reference.
 
void accept ()
 Leave the routine, keeping the new fit (the app persists it).
 
void cancel ()
 Abandon: restore the fit from before begin().
 
float apply (float measured_su) const
 Correct a reading. Identity until a fit is computed or loaded.
 
CalState state () const
 
bool active () const
 
uint8_t point () const
 Points captured so far — the reference to patch next, for the UI.
 
float reference () const
 The reference the app should patch for the current point.
 
const LinearFit & fit () const
 
void set_fit (const LinearFit &fit)
 Load a stored fit (boot) or install one by hand.
 

Static Public Member Functions

static constexpr uint8_t points ()
 

Constructor & Destructor Documentation

◆ PointCalibration()

template<uint8_t N, typename Standard = VOctStandard>
sbl::control::PointCalibration< N, Standard >::PointCalibration ( const float(&)  references[N])
inlineexplicit
Parameters
referencesthe reference values, in the standard's units

Definition at line 117 of file calibration.hpp.

Member Function Documentation

◆ begin()

template<uint8_t N, typename Standard = VOctStandard>
void sbl::control::PointCalibration< N, Standard >::begin ( )
inline

Start capturing at point 0, remembering the current fit.

Definition at line 122 of file calibration.hpp.

References sbl::control::Capturing.

◆ capture()

template<uint8_t N, typename Standard = VOctStandard>
bool sbl::control::PointCalibration< N, Standard >::capture ( float  measured_su)
inline

Record the source's reading for the current reference.

Returns
true when this capture completed the calibration

Definition at line 132 of file calibration.hpp.

References sbl::control::Capturing, sbl::control::Done, sbl::control::Failed, and sbl::control::fit_points().

◆ accept()

template<uint8_t N, typename Standard = VOctStandard>
void sbl::control::PointCalibration< N, Standard >::accept ( )
inline

Leave the routine, keeping the new fit (the app persists it).

Definition at line 152 of file calibration.hpp.

References sbl::control::Done, and sbl::control::Idle.

◆ cancel()

template<uint8_t N, typename Standard = VOctStandard>
void sbl::control::PointCalibration< N, Standard >::cancel ( )
inline

Abandon: restore the fit from before begin().

Definition at line 157 of file calibration.hpp.

References sbl::control::Idle.

◆ apply()

template<uint8_t N, typename Standard = VOctStandard>
float sbl::control::PointCalibration< N, Standard >::apply ( float  measured_su) const
inline

Correct a reading. Identity until a fit is computed or loaded.

Definition at line 164 of file calibration.hpp.

References sbl::control::LinearFit::apply().

◆ state()

template<uint8_t N, typename Standard = VOctStandard>
CalState sbl::control::PointCalibration< N, Standard >::state ( ) const
inline

Definition at line 166 of file calibration.hpp.

◆ active()

template<uint8_t N, typename Standard = VOctStandard>
bool sbl::control::PointCalibration< N, Standard >::active ( ) const
inline

Definition at line 167 of file calibration.hpp.

References sbl::control::Capturing.

◆ point()

template<uint8_t N, typename Standard = VOctStandard>
uint8_t sbl::control::PointCalibration< N, Standard >::point ( ) const
inline

Points captured so far — the reference to patch next, for the UI.

Definition at line 170 of file calibration.hpp.

◆ points()

template<uint8_t N, typename Standard = VOctStandard>
static constexpr uint8_t sbl::control::PointCalibration< N, Standard >::points ( )
inlinestaticconstexpr

Definition at line 171 of file calibration.hpp.

◆ reference()

template<uint8_t N, typename Standard = VOctStandard>
float sbl::control::PointCalibration< N, Standard >::reference ( ) const
inline

The reference the app should patch for the current point.

Definition at line 174 of file calibration.hpp.

◆ fit()

template<uint8_t N, typename Standard = VOctStandard>
const LinearFit & sbl::control::PointCalibration< N, Standard >::fit ( ) const
inline

◆ set_fit()

template<uint8_t N, typename Standard = VOctStandard>
void sbl::control::PointCalibration< N, Standard >::set_fit ( const LinearFit &  fit)
inline

Load a stored fit (boot) or install one by hand.

Definition at line 179 of file calibration.hpp.

References sbl::control::PointCalibration< N, Standard >::fit().


The documentation for this class was generated from the following file: