From 92a358bfdbddf5ae953a8d97bdfa87b1d75e098c Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Tue, 29 Apr 2025 20:21:11 +0200 Subject: [PATCH] change bs412 logic --- dsp/bs412.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsp/bs412.c b/dsp/bs412.c index e327730..97a463b 100644 --- a/dsp/bs412.c +++ b/dsp/bs412.c @@ -9,7 +9,7 @@ float deviation_to_dbr(float deviation) { } void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) { - mpx->i = 1; + mpx->i = 0; mpx->sample = 0; mpx->sample_rate = sample_rate; } @@ -22,8 +22,8 @@ float measure_mpx(MPXPowerMeasurement* mpx, float deviation) { float modulation_power = deviation_to_dbr(avg_deviation); if (mpx->i >= mpx->sample_rate * 60) { - mpx->sample = 0; - mpx->i = 0; + mpx->sample = avg_deviation * avg_deviation; + mpx->i = 1; } return modulation_power;