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-04-18 22:48:34 +02:00
parent 9f403b2fac
commit 9bd229e11b
2 changed files with 13 additions and 13 deletions

View File

@@ -15,16 +15,16 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
}
float measure_mpx(MPXPowerMeasurement* mpx, float deviation) {
mpx->sample += deviation * deviation; // rmS
mpx->i++;
mpx->sample += deviation * deviation; // rmS
mpx->i++;
float avg_deviation = sqrtf(mpx->sample / mpx->i); // RMs
float modulation_power = deviation_to_dbr(avg_deviation);
float avg_deviation = sqrtf(mpx->sample / mpx->i); // RMs
float modulation_power = deviation_to_dbr(avg_deviation);
if (mpx->i >= mpx->sample_rate * 60) {
mpx->sample = 0;
mpx->i = 0;
}
if (mpx->i >= mpx->sample_rate * 60) {
mpx->sample = 0;
mpx->i = 0;
}
return modulation_power;
return modulation_power;
}