Claire/include/sensor_manager.hpp
admar 7094d20eca Several improvements:
* Fix color mapping of precipitation
* Fix bug in calculation of max value of pollen / AQI
* Added update() method to backend which will only update after interval period has passed
2024-09-07 00:03:53 +02:00

54 lines
1.4 KiB
C++

#ifndef __SENSOR_MANAGER_HPP__
#define __SENSOR_MANAGER_HPP__
#include "bsec.h"
class SensorManager {
public:
// Public types
struct SensorData {
__typeof__(Bsec::iaq) iaq;
__typeof__(Bsec::iaqAccuracy) iaq_accuracy;
__typeof__(Bsec::staticIaq) static_iaq;
__typeof__(Bsec::co2Equivalent) co2_equivalent;
__typeof__(Bsec::breathVocEquivalent) breath_voc_equivalent;
__typeof__(Bsec::rawTemperature) raw_temperature;
__typeof__(Bsec::pressure) pressure;
__typeof__(Bsec::rawHumidity) raw_humidity;
__typeof__(Bsec::gasResistance) gas_resistance;
__typeof__(Bsec::stabStatus) stab_status;
__typeof__(Bsec::runInStatus) run_in_status;
__typeof__(Bsec::temperature) temperature;
__typeof__(Bsec::humidity) humidity;
__typeof__(Bsec::gasPercentage) gas_percentage;
};
public:
// Constructor
SensorManager();
bool setup();
bool read();
public:
// Public members
SensorData data;
private:
bool checkIaqSensorStatus();
private:
// Private static members
constexpr static uint8_t BME_CS = 5U;
constexpr static uint8_t BSEC_CONFIG_IAQ[] = {
#include "config/generic_33v_3s_4d/bsec_iaq.txt"
};
private:
// Private members
Bsec m_iaq_sensor;
uint32_t m_next_call;
};
#endif // __SENSOR_MANAGER_HPP__