11 uint16_t
get_aqi(uint16_t pm2_5_value, uint16_t pm10_0_value)
override {
15 return (pm2_5_index < pm10_0_index) ? pm10_0_index : pm2_5_index;
22 {201, 300}, {301, 400}, {401, 500}};
25 {151, 250}, {251, 350}, {351, 500}};
28 {355, 424}, {425, 504}, {505, 604}};
32 int aqi_lo = index_grid_[grid_index][0];
33 int aqi_hi = index_grid_[grid_index][1];
34 int conc_lo = array[grid_index][0];
35 int conc_hi = array[grid_index][1];
37 return (value - conc_lo) * (aqi_hi - aqi_lo) / (conc_hi - conc_lo) + aqi_lo;
42 if (value >= array[i][0] && value <= array[i][1]) {
int pm10_0_calculation_grid_[AMOUNT_OF_LEVELS][2]
int pm2_5_calculation_grid_[AMOUNT_OF_LEVELS][2]
int get_grid_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2])
int calculate_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2])
Implementation of SPI Controller mode.
int index_grid_[AMOUNT_OF_LEVELS][2]
static const int AMOUNT_OF_LEVELS
uint16_t get_aqi(uint16_t pm2_5_value, uint16_t pm10_0_value) override