Loading files
c04356942This file is pinned to the selected release. Download the original to open it in your design tool.
#pragma once
#include "Device/BaroDevice.hpp"
#include "Model.h"
#include "Sensor/BaseSensor.hpp"
#include "Utils/Filter.h"
namespace Espfc::Sensor {
class BaroSensor : public BaseSensor
{
public:
enum BaroState
{
BARO_STATE_INIT,
BARO_STATE_TEMP_GET,
BARO_STATE_PRESS_GET,
};
BaroSensor(Model& model);
int begin();
int update();
int read();
int reload(ModelChangeEvent event);
private:
void readTemperature();
void readPressure();
void updateAltitude();
Model& _model;
Device::BaroDevice* _baro;
BaroState _state;
Utils::Filter _temperatureFilter;
Utils::Filter _pressureFilter;
Utils::Filter _altitudeFilter;
Utils::Filter _varioFilter;
uint32_t _wait;
int32_t _counter;
float _biasAlpha;
bool _first{true};
};
} // namespace Espfc::Sensor