93 void add_value(
float val,
float update_rate);
123 check_limits(avg, 0, UINT8_MAX);
125 ret =
static_cast<uint8_t
>(avg);
128 void get_scaled(int8_t &ret,
float scalingfactor)
const 132 check_limits(avg, INT8_MIN, INT8_MAX);
134 ret =
static_cast<int8_t
>(avg);
139 float _window = 60.0f;
140 Mode _mode = AVERAGE;
141 float _result = 0.0f;
143 void check_limits(
float &x,
float min,
float max)
const;
144 void int_round(
float &x)
const;
147 void convert_limit_safe(
float in, uint16_t &out);
148 void convert_limit_safe(
float in, int16_t &out);
void reset()
Reset the analyzer to the initial state.
Definition: mavlink_simple_analyzer.cpp:54
SimpleAnalyzer.
Definition: mavlink_simple_analyzer.h:61
void get_scaled(uint8_t &ret, float scalingfactor) const
Get the rounded scaled value casted to the input template type.
Definition: mavlink_simple_analyzer.h:119
float get_scaled(float scalingfactor) const
Get the scaled value of the current result of the analyzer.
Definition: mavlink_simple_analyzer.cpp:125
bool valid() const
Returns true if at least one value has been added to the analyzer.
Definition: mavlink_simple_analyzer.cpp:115
SimpleAnalyzer(Mode mode, float window=60.0f)
Constructor.
Definition: mavlink_simple_analyzer.cpp:47
void add_value(float val, float update_rate)
Add a new value to the analyzer and update the result according to the mode.
Definition: mavlink_simple_analyzer.cpp:79