Thomas Kolb
49bd9247e0
The measurement module now provides averaged measurements. These are used in some places where accuracy is more important than latency (for example for the temperature limit, where noise triggered the limit too early).
30 lines
670 B
C
30 lines
670 B
C
#ifndef MEASUREMENT_H
|
|
#define MEASUREMENT_H
|
|
|
|
#include <fxp_basic.h>
|
|
|
|
struct MeasurementResult
|
|
{
|
|
fxp_t u_bat; // in Volt
|
|
fxp_t u_solar; // in Volt
|
|
fxp_t u_sw; // in Volt
|
|
fxp_t i_solar; // in Ampere
|
|
fxp_t i_load; // in Ampere
|
|
fxp_t temperature; // in degrees Celsius
|
|
|
|
// exponentially averaged versions of the above
|
|
fxp_t avg_u_bat;
|
|
fxp_t avg_u_solar;
|
|
fxp_t avg_u_sw;
|
|
fxp_t avg_i_solar;
|
|
fxp_t avg_i_load;
|
|
fxp_t avg_temperature;
|
|
};
|
|
|
|
void measurement_init(void);
|
|
void measurement_start(void);
|
|
void measurement_wait_for_completion(void);
|
|
void measurement_finalize(struct MeasurementResult *result);
|
|
|
|
#endif // MEASUREMENT_H
|