mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-15 11:02:58 +00:00
Opt-in channel-power squelch for AM audio RX (#3315)
* AM: add opt-in channel-power squelch for AM audio RX Add an SDR++-style power squelch on the complex channel signal for the Analog Audio RX app in AM modes (DSB/SSB/CW). The squelch measures the mean channel power, converts it to dBFS, and mutes the demodulated audio when the signal is below a user-set threshold. Being carrier-based it keys on the AM carrier (e.g. airband/ATC) rather than on audio-band noise, which the existing FM squelch could not do for AM. A new 'SQ' field (0-99, 0 = off) is added to the AM options view and is persisted per app via app_settings. Default is 0, so existing AM behaviour is unchanged unless the user enables it. Threshold maps 1..99 to -80..-20 dBFS. Touches: message (AMConfigureMessage.squelch_level), baseband_api (AMConfig::apply), receiver_model (am_squelch_level get/set), app_settings (persistence), proc_am_audio (DSP), analog_audio_app (UI). * Refactor audio power calculation to use magnitude squared Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -739,7 +739,8 @@ class AMConfigureMessage : public Message {
|
||||
const fir_taps_complex<64> channel_filter,
|
||||
const Modulation modulation,
|
||||
const iir_biquad_config_t audio_hpf_lpf_config,
|
||||
const size_t channel_spectrum_decimation_factor)
|
||||
const size_t channel_spectrum_decimation_factor,
|
||||
const uint8_t squelch_level = 0)
|
||||
|
||||
: Message{ID::AMConfigure},
|
||||
decim_0_filter(decim_0_filter),
|
||||
@@ -748,7 +749,8 @@ class AMConfigureMessage : public Message {
|
||||
channel_filter(channel_filter),
|
||||
modulation{modulation},
|
||||
audio_hpf_lpf_config(audio_hpf_lpf_config),
|
||||
channel_spectrum_decimation_factor(channel_spectrum_decimation_factor) {
|
||||
channel_spectrum_decimation_factor(channel_spectrum_decimation_factor),
|
||||
squelch_level(squelch_level) {
|
||||
}
|
||||
|
||||
const fir_taps_real<24> decim_0_filter;
|
||||
@@ -758,6 +760,7 @@ class AMConfigureMessage : public Message {
|
||||
const Modulation modulation;
|
||||
const iir_biquad_config_t audio_hpf_lpf_config;
|
||||
const size_t channel_spectrum_decimation_factor;
|
||||
const uint8_t squelch_level; // AM channel-power squelch threshold (0 = off)
|
||||
};
|
||||
|
||||
// TODO: Put this somewhere else, or at least the implementation part.
|
||||
|
||||
Reference in New Issue
Block a user