From f2c8f7b20eb94bba893c7ff8cc9deaf2c5a24b12 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 29 Mar 2025 19:59:48 +0100 Subject: [PATCH] change the mpx power logic --- lib/bs412.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bs412.c b/lib/bs412.c index 100757d..265113c 100644 --- a/lib/bs412.c +++ b/lib/bs412.c @@ -8,8 +8,8 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) { float measure_mpx(MPXPowerMeasurement* mpx, int deviation) { mpx->sample += 10*log10f(deviation/19000.0f); - mpx->i++; float modulation_power = mpx->sample/mpx->i; + mpx->i++; if (mpx->i >= mpx->sample_rate) { mpx->sample = modulation_power; mpx->i = 0;