|
|
|
/**
|
|
|
|
* TODO file description
|
|
|
|
*
|
|
|
|
* Created on 2021/12/13.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ESPNODE_DATA_REPORT_H
|
|
|
|
#define ESPNODE_DATA_REPORT_H
|
|
|
|
|
|
|
|
#include <stdint-gcc.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <freertos/semphr.h>
|
|
|
|
#include <freertos/task.h>
|
|
|
|
|
|
|
|
struct data_report {
|
|
|
|
bool iaq_ready;
|
|
|
|
uint32_t iaq_timestamp; // timestamp in ticks
|
|
|
|
float iaq;
|
|
|
|
float iaq_static;
|
|
|
|
float iaq_co2_ppm_equiv;
|
|
|
|
float iaq_voc_ppm_equiv;
|
|
|
|
|
|
|
|
bool thpg_ready;
|
|
|
|
uint32_t thpg_timestamp; // timestamp in ticks
|
|
|
|
float temperature;
|
|
|
|
float temperature_raw;
|
|
|
|
float pressure;
|
|
|
|
float humidity;
|
|
|
|
float humidity_raw;
|
|
|
|
float gas_raw;
|
|
|
|
|
|
|
|
bool co2_ready;
|
|
|
|
uint32_t co2_timestamp; // timestamp in ticks
|
|
|
|
float co2_ppm;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline uint32_t timestamp_age(uint32_t ticks) {
|
|
|
|
return xTaskGetTickCount() - ticks;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DATA_MAX_AGE (pdMS_TO_TICKS(60000))
|
|
|
|
|
|
|
|
extern SemaphoreHandle_t g_mux_data_report;
|
|
|
|
extern struct data_report g_data_report;
|
|
|
|
|
|
|
|
#endif //ESPNODE_DATA_REPORT_H
|