mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-03-01 09:47:21 +00:00
Make FM squelch runtime-configurable.
This commit is contained in:
parent
86cf967464
commit
8adaddac5f
@ -43,3 +43,7 @@ bool FMSquelch::execute(buffer_s16_t audio) {
|
|||||||
|
|
||||||
return (max_squared < threshold_squared);
|
return (max_squared < threshold_squared);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FMSquelch::set_threshold(const uint32_t new_value) {
|
||||||
|
threshold_squared = new_value * new_value;
|
||||||
|
}
|
||||||
|
@ -33,9 +33,11 @@ class FMSquelch {
|
|||||||
public:
|
public:
|
||||||
bool execute(buffer_s16_t audio);
|
bool execute(buffer_s16_t audio);
|
||||||
|
|
||||||
|
void set_threshold(const uint32_t new_value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t N = 32;
|
static constexpr size_t N = 32;
|
||||||
static constexpr uint32_t threshold_squared = 8192 * 8192;
|
uint32_t threshold_squared { 0 };
|
||||||
|
|
||||||
IIRBiquadFilter non_audio_hpf { non_audio_hpf_config };
|
IIRBiquadFilter non_audio_hpf { non_audio_hpf_config };
|
||||||
};
|
};
|
||||||
|
@ -106,6 +106,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
|
|||||||
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
|
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
|
||||||
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
|
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
|
||||||
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
|
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
|
||||||
|
squelch.set_threshold(8192);
|
||||||
|
|
||||||
configured = true;
|
configured = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user