0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 03:23:54 +01:00

change the mpx power logic

This commit is contained in:
2025-03-29 19:59:48 +01:00
parent 04df2ee819
commit f2c8f7b20e

View File

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