mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-20 20:22:08 +02:00
Merge pull request #224 from airgradienthq/hotfix/pms25-compensated-show-on-display
[Fix] PM2.5 compensated show on display
This commit is contained in:
@ -89,28 +89,28 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
if (utils::isValidPMS(pm01)) {
|
||||
if (utils::isValidPm(pm01)) {
|
||||
add_metric("pm1",
|
||||
"PM1.0 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm01));
|
||||
}
|
||||
if (utils::isValidPMS(pm25)) {
|
||||
if (utils::isValidPm(pm25)) {
|
||||
add_metric("pm2d5",
|
||||
"PM2.5 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm25));
|
||||
}
|
||||
if (utils::isValidPMS(pm10)) {
|
||||
if (utils::isValidPm(pm10)) {
|
||||
add_metric("pm10",
|
||||
"PM10 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm10));
|
||||
}
|
||||
if (utils::isValidPMS03Count(pm03PCount)) {
|
||||
if (utils::isValidPm03Count(pm03PCount)) {
|
||||
add_metric("pm0d3",
|
||||
"PM0.3 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in number of particules per 100 milliliters",
|
||||
|
@ -89,28 +89,28 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
if (utils::isValidPMS(pm01)) {
|
||||
if (utils::isValidPm(pm01)) {
|
||||
add_metric("pm1",
|
||||
"PM1.0 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm01));
|
||||
}
|
||||
if (utils::isValidPMS(pm25)) {
|
||||
if (utils::isValidPm(pm25)) {
|
||||
add_metric("pm2d5",
|
||||
"PM2.5 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm25));
|
||||
}
|
||||
if (utils::isValidPMS(pm10)) {
|
||||
if (utils::isValidPm(pm10)) {
|
||||
add_metric("pm10",
|
||||
"PM10 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm10));
|
||||
}
|
||||
if (utils::isValidPMS03Count(pm03PCount)) {
|
||||
if (utils::isValidPm03Count(pm03PCount)) {
|
||||
add_metric("pm0d3",
|
||||
"PM0.3 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in number of particules per 100 milliliters",
|
||||
|
@ -89,28 +89,28 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
if (utils::isValidPMS(pm01)) {
|
||||
if (utils::isValidPm(pm01)) {
|
||||
add_metric("pm1",
|
||||
"PM1.0 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm01));
|
||||
}
|
||||
if (utils::isValidPMS(pm25)) {
|
||||
if (utils::isValidPm(pm25)) {
|
||||
add_metric("pm2d5",
|
||||
"PM2.5 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm25));
|
||||
}
|
||||
if (utils::isValidPMS(pm10)) {
|
||||
if (utils::isValidPm(pm10)) {
|
||||
add_metric("pm10",
|
||||
"PM10 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm10));
|
||||
}
|
||||
if (utils::isValidPMS03Count(pm03PCount)) {
|
||||
if (utils::isValidPm03Count(pm03PCount)) {
|
||||
add_metric("pm0d3",
|
||||
"PM0.3 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in number of particules per 100 milliliters",
|
||||
|
@ -123,28 +123,28 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1 || config.hasSensorPMS2) {
|
||||
if (utils::isValidPMS(pm01)) {
|
||||
if (utils::isValidPm(pm01)) {
|
||||
add_metric("pm1",
|
||||
"PM1.0 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm01));
|
||||
}
|
||||
if (utils::isValidPMS(pm25)) {
|
||||
if (utils::isValidPm(pm25)) {
|
||||
add_metric("pm2d5",
|
||||
"PM2.5 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm25));
|
||||
}
|
||||
if (utils::isValidPMS(pm10)) {
|
||||
if (utils::isValidPm(pm10)) {
|
||||
add_metric("pm10",
|
||||
"PM10 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in micrograms per cubic meter",
|
||||
"gauge", "ugm3");
|
||||
add_metric_point("", String(pm10));
|
||||
}
|
||||
if (utils::isValidPMS03Count(pm03PCount)) {
|
||||
if (utils::isValidPm03Count(pm03PCount)) {
|
||||
add_metric("pm0d3",
|
||||
"PM0.3 concentration as measured by the AirGradient PMS "
|
||||
"sensor, in number of particules per 100 milliliters",
|
||||
|
@ -306,12 +306,13 @@ void OledDisplay::showDashboard(const char *status) {
|
||||
/** Draw PM2.5 value */
|
||||
int pm25 = value.pm25_1;
|
||||
if (config.hasSensorSHT) {
|
||||
pm25 = ag->pms5003.compensated(pm25, value.Humidity);
|
||||
pm25 = ag->pms5003.compensate(pm25, value.Humidity);
|
||||
logInfo("PM2.5:" + String(value.pm25_1) + String("Compensated:") + String(pm25));
|
||||
}
|
||||
DISP()->setFont(u8g2_font_t0_22b_tf);
|
||||
if (config.isPmStandardInUSAQI()) {
|
||||
if (utils::isValidPMS(value.pm25_1)) {
|
||||
sprintf(strBuf, "%d", ag->pms5003.convertPm25ToUsAqi(value.pm25_1));
|
||||
if (utils::isValidPm(pm25)) {
|
||||
sprintf(strBuf, "%d", ag->pms5003.convertPm25ToUsAqi(pm25));
|
||||
} else {
|
||||
sprintf(strBuf, "%s", "-");
|
||||
}
|
||||
@ -319,8 +320,8 @@ void OledDisplay::showDashboard(const char *status) {
|
||||
DISP()->setFont(u8g2_font_t0_12_tf);
|
||||
DISP()->drawUTF8(55, 61, "AQI");
|
||||
} else {
|
||||
if (utils::isValidPMS(value.pm25_1)) {
|
||||
sprintf(strBuf, "%d", value.pm25_1);
|
||||
if (utils::isValidPm(pm25)) {
|
||||
sprintf(strBuf, "%d", pm25);
|
||||
} else {
|
||||
sprintf(strBuf, "%s", "-");
|
||||
}
|
||||
@ -366,11 +367,11 @@ void OledDisplay::showDashboard(const char *status) {
|
||||
/** Set PM */
|
||||
int pm25 = value.pm25_1;
|
||||
if(config.hasSensorSHT) {
|
||||
pm25 = (int)ag->pms5003.compensated(pm25, value.Humidity);
|
||||
pm25 = (int)ag->pms5003.compensate(pm25, value.Humidity);
|
||||
}
|
||||
ag->display.setCursor(0, 12);
|
||||
if (utils::isValidPMS(value.pm25_1)) {
|
||||
snprintf(strBuf, sizeof(strBuf), "PM2.5:%d", value.pm25_1);
|
||||
if (utils::isValidPm(pm25)) {
|
||||
snprintf(strBuf, sizeof(strBuf), "PM2.5:%d", pm25);
|
||||
} else {
|
||||
snprintf(strBuf, sizeof(strBuf), "PM2.5:-");
|
||||
}
|
||||
|
@ -54,16 +54,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
|
||||
if (ag->isOne() || (ag->isPro4_2()) || ag->isPro3_3() || ag->isBasic()) {
|
||||
if (config->hasSensorPMS1) {
|
||||
if (utils::isValidPMS(this->pm01_1)) {
|
||||
if (utils::isValidPm(this->pm01_1)) {
|
||||
root["pm01"] = this->pm01_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm25_1)) {
|
||||
if (utils::isValidPm(this->pm25_1)) {
|
||||
root["pm02"] = this->pm25_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm10_1)) {
|
||||
if (utils::isValidPm(this->pm10_1)) {
|
||||
root["pm10"] = this->pm10_1;
|
||||
}
|
||||
if (utils::isValidPMS03Count(this->pm03PCount_1)) {
|
||||
if (utils::isValidPm03Count(this->pm03PCount_1)) {
|
||||
root["pm003Count"] = this->pm03PCount_1;
|
||||
}
|
||||
if (!localServer) {
|
||||
@ -89,7 +89,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
|
||||
if (config->hasSensorSHT && config->hasSensorPMS1) {
|
||||
int pm25 = ag->pms5003.compensated(this->pm25_1, this->Humidity);
|
||||
int pm25 = ag->pms5003.compensate(this->pm25_1, this->Humidity);
|
||||
if (pm25 >= 0) {
|
||||
root["pm02Compensated"] = pm25;
|
||||
}
|
||||
@ -97,16 +97,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
|
||||
} else {
|
||||
if (config->hasSensorPMS1 && config->hasSensorPMS2) {
|
||||
if (utils::isValidPMS(this->pm01_1) && utils::isValidPMS(this->pm01_2)) {
|
||||
if (utils::isValidPm(this->pm01_1) && utils::isValidPm(this->pm01_2)) {
|
||||
root["pm01"] = ag->round2((this->pm01_1 + this->pm01_2) / 2.0f);
|
||||
}
|
||||
if (utils::isValidPMS(this->pm25_1) && utils::isValidPMS(this->pm25_2)) {
|
||||
if (utils::isValidPm(this->pm25_1) && utils::isValidPm(this->pm25_2)) {
|
||||
root["pm02"] = ag->round2((this->pm25_1 + this->pm25_2) / 2.0f);
|
||||
}
|
||||
if (utils::isValidPMS(this->pm10_1) && utils::isValidPMS(this->pm10_2)) {
|
||||
if (utils::isValidPm(this->pm10_1) && utils::isValidPm(this->pm10_2)) {
|
||||
root["pm10"] = ag->round2((this->pm10_1 + this->pm10_2) / 2.0f);
|
||||
}
|
||||
if (utils::isValidPMS(this->pm03PCount_1) && utils::isValidPMS(this->pm03PCount_2)) {
|
||||
if (utils::isValidPm(this->pm03PCount_1) && utils::isValidPm(this->pm03PCount_2)) {
|
||||
root["pm003Count"] = ag->round2((this->pm03PCount_1 + this->pm03PCount_2) / 2.0f);
|
||||
}
|
||||
|
||||
@ -130,8 +130,8 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
|
||||
int pm25 = (ag->pms5003t_1.compensated(this->pm25_1, this->temp_1) +
|
||||
ag->pms5003t_2.compensated(this->pm25_2, this->temp_2)) /
|
||||
int pm25 = (ag->pms5003t_1.compensate(this->pm25_1, this->temp_1) +
|
||||
ag->pms5003t_2.compensate(this->pm25_2, this->temp_2)) /
|
||||
2;
|
||||
root["pm02Compensated"] = pm25;
|
||||
}
|
||||
@ -139,16 +139,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
if (fwMode == FW_MODE_O_1PS || fwMode == FW_MODE_O_1PST) {
|
||||
float val;
|
||||
if (config->hasSensorPMS1) {
|
||||
if (utils::isValidPMS(this->pm01_1)) {
|
||||
if (utils::isValidPm(this->pm01_1)) {
|
||||
root["pm01"] = this->pm01_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm25_1)) {
|
||||
if (utils::isValidPm(this->pm25_1)) {
|
||||
root["pm02"] = this->pm25_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm10_1)) {
|
||||
if (utils::isValidPm(this->pm10_1)) {
|
||||
root["pm10"] = this->pm10_1;
|
||||
}
|
||||
if (utils::isValidPMS03Count(this->pm03PCount_1)) {
|
||||
if (utils::isValidPm03Count(this->pm03PCount_1)) {
|
||||
root["pm003Count"] = this->pm03PCount_1;
|
||||
}
|
||||
if (utils::isValidTemperature(this->temp_1)) {
|
||||
@ -171,23 +171,23 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensated(this->pm25_1, this->temp_1);
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensate(this->pm25_1, this->temp_1);
|
||||
if (!localServer) {
|
||||
root[json_prop_pmFirmware] =
|
||||
pms5003TFirmwareVersion(ag->pms5003t_1.getFirmwareVersion());
|
||||
}
|
||||
}
|
||||
if (config->hasSensorPMS2) {
|
||||
if(utils::isValidPMS(this->pm01_2)) {
|
||||
if(utils::isValidPm(this->pm01_2)) {
|
||||
root["pm01"] = this->pm01_2;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm25_2)) {
|
||||
if(utils::isValidPm(this->pm25_2)) {
|
||||
root["pm02"] = this->pm25_2;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm10_2)) {
|
||||
if(utils::isValidPm(this->pm10_2)) {
|
||||
root["pm10"] = this->pm10_2;
|
||||
}
|
||||
if(utils::isValidPMS03Count(this->pm03PCount_2)) {
|
||||
if(utils::isValidPm03Count(this->pm03PCount_2)) {
|
||||
root["pm003Count"] = this->pm03PCount_2;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["pm02Compensated"] = ag->pms5003t_2.compensated(this->pm25_2, this->temp_2);
|
||||
root["pm02Compensated"] = ag->pms5003t_2.compensate(this->pm25_2, this->temp_2);
|
||||
if(!localServer) {
|
||||
root[json_prop_pmFirmware] =
|
||||
pms5003TFirmwareVersion(ag->pms5003t_1.getFirmwareVersion());
|
||||
@ -222,16 +222,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
if (fwMode == FW_MODE_O_1P) {
|
||||
float val;
|
||||
if (config->hasSensorPMS1) {
|
||||
if (utils::isValidPMS(this->pm01_1)) {
|
||||
if (utils::isValidPm(this->pm01_1)) {
|
||||
root["pm01"] = this->pm01_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm25_1)) {
|
||||
if (utils::isValidPm(this->pm25_1)) {
|
||||
root["pm02"] = this->pm25_1;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm10_1)) {
|
||||
if (utils::isValidPm(this->pm10_1)) {
|
||||
root["pm10"] = this->pm10_1;
|
||||
}
|
||||
if (utils::isValidPMS03Count(this->pm03PCount_1)) {
|
||||
if (utils::isValidPm03Count(this->pm03PCount_1)) {
|
||||
root["pm003Count"] = this->pm03PCount_1;
|
||||
}
|
||||
if (utils::isValidTemperature(this->temp_1)) {
|
||||
@ -253,22 +253,22 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensated(this->pm25_1, this->temp_1);
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensate(this->pm25_1, this->temp_1);
|
||||
if(!localServer) {
|
||||
root[json_prop_pmFirmware] =
|
||||
pms5003TFirmwareVersion(ag->pms5003t_1.getFirmwareVersion());
|
||||
}
|
||||
} else if (config->hasSensorPMS2) {
|
||||
if(utils::isValidPMS(this->pm01_2)) {
|
||||
if(utils::isValidPm(this->pm01_2)) {
|
||||
root["pm01"] = this->pm01_2;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm25_2)) {
|
||||
if(utils::isValidPm(this->pm25_2)) {
|
||||
root["pm02"] = this->pm25_2;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm10_2)) {
|
||||
if(utils::isValidPm(this->pm10_2)) {
|
||||
root["pm10"] = this->pm10_2;
|
||||
}
|
||||
if(utils::isValidPMS03Count(this->pm03PCount_2)) {
|
||||
if(utils::isValidPm03Count(this->pm03PCount_2)) {
|
||||
root["pm003Count"] = this->pm03PCount_2;
|
||||
}
|
||||
if (utils::isValidTemperature(this->temp_2)) {
|
||||
@ -291,7 +291,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensated(this->pm25_1, this->temp_1);
|
||||
root["pm02Compensated"] = ag->pms5003t_1.compensate(this->pm25_1, this->temp_1);
|
||||
if(!localServer) {
|
||||
root[json_prop_pmFirmware] =
|
||||
pms5003TFirmwareVersion(ag->pms5003t_2.getFirmwareVersion());
|
||||
@ -300,16 +300,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
} else {
|
||||
float val;
|
||||
if (config->hasSensorPMS1) {
|
||||
if(utils::isValidPMS(this->pm01_1)) {
|
||||
if(utils::isValidPm(this->pm01_1)) {
|
||||
root["channels"]["1"]["pm01"] = this->pm01_1;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm25_1)) {
|
||||
if(utils::isValidPm(this->pm25_1)) {
|
||||
root["channels"]["1"]["pm02"] = this->pm25_1;
|
||||
}
|
||||
if(utils::isValidPMS(this->pm10_1)) {
|
||||
if(utils::isValidPm(this->pm10_1)) {
|
||||
root["channels"]["1"]["pm10"] = this->pm10_1;
|
||||
}
|
||||
if (utils::isValidPMS03Count(this->pm03PCount_1)) {
|
||||
if (utils::isValidPm03Count(this->pm03PCount_1)) {
|
||||
root["channels"]["1"]["pm003Count"] = this->pm03PCount_1;
|
||||
}
|
||||
if(utils::isValidTemperature(this->temp_1)) {
|
||||
@ -332,7 +332,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["channels"]["1"]["pm02Compensated"] = ag->pms5003t_1.compensated(this->pm25_1, this->temp_1);
|
||||
root["channels"]["1"]["pm02Compensated"] = ag->pms5003t_1.compensate(this->pm25_1, this->temp_1);
|
||||
|
||||
// PMS5003T version
|
||||
if(!localServer) {
|
||||
@ -342,16 +342,16 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
if (config->hasSensorPMS2) {
|
||||
float val;
|
||||
if (utils::isValidPMS(this->pm01_2)) {
|
||||
if (utils::isValidPm(this->pm01_2)) {
|
||||
root["channels"]["2"]["pm01"] = this->pm01_2;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm25_2)) {
|
||||
if (utils::isValidPm(this->pm25_2)) {
|
||||
root["channels"]["2"]["pm02"] = this->pm25_2;
|
||||
}
|
||||
if (utils::isValidPMS(this->pm10_2)) {
|
||||
if (utils::isValidPm(this->pm10_2)) {
|
||||
root["channels"]["2"]["pm10"] = this->pm10_2;
|
||||
}
|
||||
if (utils::isValidPMS03Count(this->pm03PCount_2)) {
|
||||
if (utils::isValidPm03Count(this->pm03PCount_2)) {
|
||||
root["channels"]["2"]["pm003Count"] = this->pm03PCount_2;
|
||||
}
|
||||
if (utils::isValidTemperature(this->temp_2)) {
|
||||
@ -374,7 +374,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
|
||||
}
|
||||
}
|
||||
}
|
||||
root["channels"]["2"]["pm02Compensated"] = ag->pms5003t_2.compensated(this->pm25_2, this->temp_2);
|
||||
root["channels"]["2"]["pm02Compensated"] = ag->pms5003t_2.compensate(this->pm25_2, this->temp_2);
|
||||
// PMS5003T version
|
||||
if(!localServer) {
|
||||
root["channels"]["2"][json_prop_pmFirmware] =
|
||||
|
@ -48,14 +48,14 @@ bool utils::isValidCO2(int16_t value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utils::isValidPMS(int value) {
|
||||
bool utils::isValidPm(int value) {
|
||||
if ((value >= VALID_PMS_MIN) && (value <= VALID_PMS_MAX)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utils::isValidPMS03Count(int value) {
|
||||
bool utils::isValidPm03Count(int value) {
|
||||
if (value >= VALID_PMS03COUNT_MIN) {
|
||||
return true;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ public:
|
||||
static bool isValidTemperature(float value);
|
||||
static bool isValidHumidity(float value);
|
||||
static bool isValidCO2(int16_t value);
|
||||
static bool isValidPMS(int value);
|
||||
static bool isValidPMS03Count(int value);
|
||||
static bool isValidPm(int value);
|
||||
static bool isValidPm03Count(int value);
|
||||
static bool isValidNOx(int value);
|
||||
static bool isValidVOC(int value);
|
||||
static float getInvalidTemperature(void);
|
||||
|
@ -315,7 +315,7 @@ int PMSBase::pm25ToAQI(int pm02) {
|
||||
* @param humidity Humidity value (%)
|
||||
* @return int
|
||||
*/
|
||||
int PMSBase::compensated(int pm25, float humidity) {
|
||||
int PMSBase::compensate(int pm25, float humidity) {
|
||||
float value;
|
||||
float fpm25 = pm25;
|
||||
if (humidity < 0) {
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
uint8_t getErrorCode(void);
|
||||
|
||||
int pm25ToAQI(int pm02);
|
||||
int compensated(int pm25, float humidity);
|
||||
int compensate(int pm25, float humidity);
|
||||
|
||||
private:
|
||||
Stream *stream;
|
||||
|
@ -124,12 +124,14 @@ int PMS5003::convertPm25ToUsAqi(int pm25) { return pms.pm25ToAQI(pm25); }
|
||||
/**
|
||||
* @brief Correct PM2.5
|
||||
*
|
||||
* Reference formula: https://www.airgradient.com/documentation/correction-algorithms/
|
||||
*
|
||||
* @param pm25 PM2.5 raw value
|
||||
* @param humidity Humidity value
|
||||
* @return float
|
||||
* @return int
|
||||
*/
|
||||
int PMS5003::compensated(int pm25, float humidity) {
|
||||
return pms.compensated(pm25, humidity);
|
||||
int PMS5003::compensate(int pm25, float humidity) {
|
||||
return pms.compensate(pm25, humidity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
int getPm10Ae(void);
|
||||
int getPm03ParticleCount(void);
|
||||
int convertPm25ToUsAqi(int pm25);
|
||||
int compensated(int pm25, float humidity);
|
||||
int compensate(int pm25, float humidity);
|
||||
int getFirmwareVersion(void);
|
||||
uint8_t getErrorCode(void);
|
||||
|
||||
|
@ -167,12 +167,14 @@ float PMS5003T::getRelativeHumidity(void) {
|
||||
/**
|
||||
* @brief Correct PM2.5
|
||||
*
|
||||
* Reference formula: https://www.airgradient.com/documentation/correction-algorithms/
|
||||
*
|
||||
* @param pm25 PM2.5 raw value
|
||||
* @param humidity Humidity value
|
||||
* @return float
|
||||
* @return int
|
||||
*/
|
||||
float PMS5003T::compensated(int pm25, float humidity) {
|
||||
return pms.compensated(pm25, humidity);
|
||||
int PMS5003T::compensate(int pm25, float humidity) {
|
||||
return pms.compensate(pm25, humidity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
int convertPm25ToUsAqi(int pm25);
|
||||
float getTemperature(void);
|
||||
float getRelativeHumidity(void);
|
||||
float compensated(int pm25, float humidity);
|
||||
int compensate(int pm25, float humidity);
|
||||
int getFirmwareVersion(void);
|
||||
uint8_t getErrorCode(void);
|
||||
|
||||
|
Reference in New Issue
Block a user