mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-23 14:57:29 +00:00
Scanner: Added last locked frequencies list
Added back squelch to NFM receiver Scanner: cleanup Widgets: VU-meter cleanup
This commit is contained in:
@@ -76,8 +76,6 @@ void AudioOutput::write(
|
||||
void AudioOutput::on_block(
|
||||
const buffer_f32_t& audio
|
||||
) {
|
||||
bool audio_present;
|
||||
|
||||
if (do_processing) {
|
||||
const auto audio_present_now = squelch.execute(audio);
|
||||
|
||||
@@ -98,6 +96,10 @@ void AudioOutput::on_block(
|
||||
fill_audio_buffer(audio, audio_present);
|
||||
}
|
||||
|
||||
bool AudioOutput::is_squelched() {
|
||||
return ~audio_present;
|
||||
}
|
||||
|
||||
void AudioOutput::fill_audio_buffer(const buffer_f32_t& audio, const bool send_to_fifo) {
|
||||
std::array<int16_t, 32> audio_int;
|
||||
|
||||
|
@@ -51,6 +51,8 @@ public:
|
||||
void set_stream(std::unique_ptr<StreamInput> new_stream) {
|
||||
stream = std::move(new_stream);
|
||||
}
|
||||
|
||||
bool is_squelched();
|
||||
|
||||
private:
|
||||
static constexpr float k = 32768.0f;
|
||||
@@ -68,6 +70,7 @@ private:
|
||||
|
||||
uint64_t audio_present_history = 0;
|
||||
|
||||
bool audio_present = false;
|
||||
bool do_processing = true;
|
||||
|
||||
void on_block(const buffer_f32_t& audio);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "proc_nfm_audio.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include "event_m4.hpp"
|
||||
|
||||
@@ -28,6 +29,8 @@
|
||||
#include <cstddef>
|
||||
|
||||
void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
|
||||
bool new_state;
|
||||
|
||||
if( !configured ) {
|
||||
return;
|
||||
}
|
||||
@@ -56,6 +59,13 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
|
||||
}
|
||||
|
||||
audio_output.write(pwmrssi_audio_buffer);
|
||||
|
||||
new_state = audio_output.is_squelched();
|
||||
|
||||
if (new_state && !old_state)
|
||||
shared_memory.application_queue.push(sig_message);
|
||||
|
||||
old_state = new_state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +112,8 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
|
||||
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_spectrum.set_decimation_factor(std::floor(channel_filter_output_fs / (channel_filter_pass_f + channel_filter_stop_f)));
|
||||
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config); // , 0.8f
|
||||
// TODO: Configurable squelch threshold
|
||||
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config, 0.8f);
|
||||
|
||||
synth_acc = 0;
|
||||
|
||||
|
@@ -73,6 +73,7 @@ private:
|
||||
dsp::demodulate::FM demod { };
|
||||
|
||||
AudioOutput audio_output { };
|
||||
bool old_state { };
|
||||
|
||||
SpectrumCollector channel_spectrum { };
|
||||
|
||||
@@ -85,6 +86,8 @@ private:
|
||||
void pwmrssi_config(const PWMRSSIConfigureMessage& message);
|
||||
void configure(const NBFMConfigureMessage& message);
|
||||
void capture_config(const CaptureConfigMessage& message);
|
||||
|
||||
RequestSignalMessage sig_message { RequestSignalMessage::Signal::Squelched };
|
||||
};
|
||||
|
||||
#endif/*__PROC_NFM_AUDIO_H__*/
|
||||
|
Reference in New Issue
Block a user