From c6961b3ca8ea4da3e1fc0cd51b8c8997dd3f6202 Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Sat, 2 Nov 2024 16:11:47 +0700 Subject: [PATCH] Validate raw pm before correction --- src/AgOledDisplay.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/AgOledDisplay.cpp b/src/AgOledDisplay.cpp index 7f11bb5..94dd5e6 100644 --- a/src/AgOledDisplay.cpp +++ b/src/AgOledDisplay.cpp @@ -314,11 +314,10 @@ void OledDisplay::showDashboard(const char *status) { /** Draw PM2.5 value */ int pm25 = value.get(Measurements::PM25); - if (config.hasSensorSHT && config.isPMCorrectionEnabled()) { - pm25 = (int)value.getCorrectedPM25(*ag, config); - } - if (utils::isValidPm(pm25)) { + if (config.hasSensorSHT && config.isPMCorrectionEnabled()) { + pm25 = (int)value.getCorrectedPM25(*ag, config); + } if (config.isPmStandardInUSAQI()) { sprintf(strBuf, "%d", ag->pms5003.convertPm25ToUsAqi(pm25)); } else {