0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-26 19:23:51 +01:00
This commit is contained in:
2025-03-29 20:02:15 +01:00
parent 28933d0ae8
commit d2a07802b4

View File

@@ -8,12 +8,9 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
float measure_mpx(MPXPowerMeasurement* mpx, int deviation) {
mpx->sample += 10*log10f(deviation/19000.0f);
float div = mpx->i;
if(div == 0) div = 1;
float modulation_power = mpx->sample/div;
mpx->i++;
float modulation_power = mpx->sample/(mpx->i++);
if (mpx->i >= mpx->sample_rate) {
mpx->sample = modulation_power;
mpx->i = 0;