From 61d0d7eb83ffe05cc762da897d946c818c4e3750 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 29 Mar 2025 20:05:08 +0100 Subject: [PATCH] average every minute, not second --- lib/bs412.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bs412.c b/lib/bs412.c index e10ca81..aa5d5a7 100644 --- a/lib/bs412.c +++ b/lib/bs412.c @@ -11,8 +11,8 @@ float measure_mpx(MPXPowerMeasurement* mpx, int deviation) { float modulation_power = mpx->sample/(mpx->i++); - if (mpx->i >= mpx->sample_rate) { - mpx->sample = modulation_power; + if (mpx->i >= mpx->sample_rate*60) { + mpx->sample = 0; mpx->i = 0; } return modulation_power;