From ade72ff3b8183d04aa7eefca34610ed93ed90ef9 Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Sat, 2 Nov 2024 16:11:00 +0700 Subject: [PATCH] Apply correction to transmission payload Only for indoor --- src/AgValue.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/AgValue.cpp b/src/AgValue.cpp index bcf617b..ca148ca 100644 --- a/src/AgValue.cpp +++ b/src/AgValue.cpp @@ -638,10 +638,9 @@ JSONVar Measurements::buildIndoor(bool localServer, AirGradient &ag, Configurati // Add pm25 compensated value only if PM2.5 and humidity value is valid if (config.hasSensorPMS1 && utils::isValidPm(_pm_25[0].update.avg)) { if (config.hasSensorSHT && utils::isValidHumidity(_humidity[0].update.avg)) { - float pm25 = ag.pms5003.compensate(_pm_25[0].update.avg, _humidity[0].update.avg); - if (utils::isValidPm(pm25)) { - indoor[json_prop_pm25Compensated] = ag.round2(pm25); - } + // Correction using moving average value + float tmp = getCorrectedPM25(ag, config, true); + indoor[json_prop_pm25Compensated] = ag.round2(tmp); } }