mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-19 11:42:09 +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:-");
|
||||
}
|
||||
|
Reference in New Issue
Block a user