Added an audio FFT view in Wideband FM receive

Tried speeding up fill_rectangle for clearing the waveform widget
This commit is contained in:
furrtek 2018-05-21 18:46:48 +01:00
parent b11c3c94b6
commit b813b32593
19 changed files with 259 additions and 38 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2018 Furrtek
*
* This file is part of PortaPack.
*
@ -100,10 +101,8 @@ AnalogAudioView::AnalogAudioView(
&field_volume,
&text_ctcss,
&record_view,
&waterfall,
&waterfall
});
//exit_on_squelch = eos;
field_frequency.set_value(receiver_model.tuning_frequency());
field_frequency.set_step(receiver_model.frequency_step());
@ -177,7 +176,7 @@ void AnalogAudioView::on_hide() {
void AnalogAudioView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height };
waterfall.set_parent_rect(waterfall_rect);
}
@ -208,9 +207,9 @@ void AnalogAudioView::remove_options_widget() {
remove_child(options_widget.get());
options_widget.reset();
}
text_ctcss.hidden(true);
field_lna.set_style(nullptr);
options_modulation.set_style(nullptr);
field_frequency.set_style(nullptr);
@ -258,12 +257,23 @@ void AnalogAudioView::on_show_options_modulation() {
switch(modulation) {
case ReceiverModel::Mode::AMAudio:
widget = std::make_unique<AMOptionsView>(options_view_rect, &style_options_group);
waterfall.set_fft_widget(false);
break;
case ReceiverModel::Mode::NarrowbandFMAudio:
widget = std::make_unique<NBFMOptionsView>(nbfm_view_rect, &style_options_group);
waterfall.set_fft_widget(false);
break;
case ReceiverModel::Mode::WidebandFMAudio:
waterfall.set_fft_widget(true);
waterfall.on_show();
break;
case ReceiverModel::Mode::SpectrumAnalysis:
waterfall.set_fft_widget(false);
break;
default:
break;
}
@ -341,6 +351,7 @@ void AnalogAudioView::handle_coded_squelch(const uint32_t value) {
size_t min_idx { 0 };
size_t c;
// Find nearest match
for (c = 0; c < tone_keys.size(); c++) {
diff = abs(((float)value / 100.0) - tone_keys[c].second);
if (diff < min_diff) {
@ -349,6 +360,7 @@ void AnalogAudioView::handle_coded_squelch(const uint32_t value) {
}
}
// Arbitrary confidence threshold
if (min_diff < 40)
text_ctcss.set("CTCSS " + tone_keys[min_idx].first);
else