mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
some safety changes to bs412
This commit is contained in:
@@ -5,7 +5,7 @@ float dbr_to_deviation(float dbr) {
|
||||
}
|
||||
|
||||
float deviation_to_dbr(float deviation) {
|
||||
return 20*log10f(deviation/19000.0f);
|
||||
return 20 * log10f((deviation + 1e-6f) / 19000.0f);
|
||||
}
|
||||
|
||||
void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
|
||||
@@ -14,7 +14,7 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
|
||||
mpx->sample_rate = sample_rate;
|
||||
}
|
||||
|
||||
float measure_mpx(MPXPowerMeasurement* mpx, int deviation) {
|
||||
float measure_mpx(MPXPowerMeasurement* mpx, float deviation) {
|
||||
mpx->sample += deviation;
|
||||
|
||||
float avg_deviation = (float)mpx->sample / mpx->i;
|
||||
|
||||
@@ -12,4 +12,4 @@ float dbr_to_deviation(float dbr);
|
||||
float deviation_to_dbr(float deviation);
|
||||
|
||||
void init_modulation_power_measure(MPXPowerMeasurement *mpx, int sample_rate);
|
||||
float measure_mpx(MPXPowerMeasurement *mpx, int deviation);
|
||||
float measure_mpx(MPXPowerMeasurement *mpx, float deviation);
|
||||
Reference in New Issue
Block a user