Sound Byte Libs 0.5.1-340-gab5b79a
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 reading. 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 132 of file calibration.hpp.

#include <calibration.hpp>

Public Member Functions

 PointCalibration (const float(&references)[N])
 
void begin ()
 
bool capture (float measured)
 Record the source's reading for the current reference.
 
void accept ()
 
void cancel ()
 
float apply (float measured) const
 Correct a reading; identity until a fit is computed or loaded.
 
CalState state () const
 Where the routine is.
 
bool active () const
 True while capturing points.
 
uint8_t point () const
 Points captured so far: the index of 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
 The current fit.
 
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 ()
 Points the routine captures.
 

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 137 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 144 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)
inline

Record the source's reading for the current reference.

Parameters
measuredThe source's reading, uncorrected
Returns
true when this capture completed the calibration

Definition at line 155 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 181 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 188 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) const
inline

Correct a reading; identity until a fit is computed or loaded.

Parameters
measuredMeasured value
Returns
The corrected value

Definition at line 199 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

Where the routine is.

Definition at line 202 of file calibration.hpp.

◆ active()

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

True while capturing points.

Definition at line 204 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 index of the reference to patch next, for the UI.

Definition at line 207 of file calibration.hpp.

◆ points()

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

Points the routine captures.

Definition at line 209 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 212 of file calibration.hpp.

◆ fit()

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

The current fit.

Definition at line 215 of file calibration.hpp.

Referenced by sbl::control::PointCalibration< N, Standard >::set_fit().

◆ 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.

Parameters
fitThe fit to use

Definition at line 221 of file calibration.hpp.

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


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