mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-20 12:12:08 +02:00
fix PM2.5 compensated on display, #221
This commit is contained in:
@ -307,11 +307,12 @@ void OledDisplay::showDashboard(const char *status) {
|
||||
int pm25 = value.pm25_1;
|
||||
if (config.hasSensorSHT) {
|
||||
pm25 = ag->pms5003.compensated(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::isValidPMS(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::isValidPMS(pm25)) {
|
||||
sprintf(strBuf, "%d", pm25);
|
||||
} else {
|
||||
sprintf(strBuf, "%s", "-");
|
||||
}
|
||||
@ -369,8 +370,8 @@ void OledDisplay::showDashboard(const char *status) {
|
||||
pm25 = (int)ag->pms5003.compensated(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::isValidPMS(pm25)) {
|
||||
snprintf(strBuf, sizeof(strBuf), "PM2.5:%d", pm25);
|
||||
} else {
|
||||
snprintf(strBuf, sizeof(strBuf), "PM2.5:-");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ int PMS5003::convertPm25ToUsAqi(int pm25) { return pms.pm25ToAQI(pm25); }
|
||||
*
|
||||
* @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);
|
||||
|
@ -169,9 +169,9 @@ float PMS5003T::getRelativeHumidity(void) {
|
||||
*
|
||||
* @param pm25 PM2.5 raw value
|
||||
* @param humidity Humidity value
|
||||
* @return float
|
||||
* @return int
|
||||
*/
|
||||
float PMS5003T::compensated(int pm25, float humidity) {
|
||||
int PMS5003T::compensated(int pm25, float humidity) {
|
||||
return pms.compensated(pm25, humidity);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
int convertPm25ToUsAqi(int pm25);
|
||||
float getTemperature(void);
|
||||
float getRelativeHumidity(void);
|
||||
float compensated(int pm25, float humidity);
|
||||
int compensated(int pm25, float humidity);
|
||||
|
||||
private:
|
||||
bool _isBegin = false;
|
||||
|
Reference in New Issue
Block a user