diff --git a/firmware/application/analog_audio_app.cpp b/firmware/application/analog_audio_app.cpp index f36532ec..fcd9cda1 100644 --- a/firmware/application/analog_audio_app.cpp +++ b/firmware/application/analog_audio_app.cpp @@ -42,10 +42,9 @@ AMOptionsView::AMOptionsView( &options_config, } }); + options_config.set_selected_index(receiver_model.am_configuration()); options_config.on_change = [this](size_t n, OptionsField::value_t) { - if( on_config_changed ) { - this->on_config_changed(n); - } + receiver_model.set_am_configuration(n); }; } @@ -62,10 +61,9 @@ NBFMOptionsView::NBFMOptionsView( &options_config, } }); + options_config.set_selected_index(receiver_model.nbfm_configuration()); options_config.on_change = [this](size_t n, OptionsField::value_t) { - if( on_config_changed ) { - this->on_config_changed(n); - } + receiver_model.set_nbfm_configuration(n); }; } @@ -261,9 +259,6 @@ void AnalogAudioView::on_show_options_modulation() { Rect { 0 * 8, 1 * 16, 30 * 8, 1 * 16 }, &style_options_group ); - widget->on_config_changed = [this](size_t n) { - this->on_am_config_index_changed(n); - }; set_options_widget(std::move(widget)); } if( modulation == ReceiverModel::Mode::NarrowbandFMAudio ) { @@ -272,9 +267,6 @@ void AnalogAudioView::on_show_options_modulation() { Rect { 0 * 8, 1 * 16, 30 * 8, 1 * 16 }, &style_options_group ); - widget->on_config_changed = [this](size_t n) { - this->on_nbfm_config_index_changed(n); - }; set_options_widget(std::move(widget)); } } @@ -293,14 +285,6 @@ void AnalogAudioView::on_headphone_volume_changed(int32_t v) { receiver_model.set_headphone_volume(new_volume); } -void AnalogAudioView::on_am_config_index_changed(size_t n) { - receiver_model.set_am_configuration(n); -} - -void AnalogAudioView::on_nbfm_config_index_changed(size_t n) { - receiver_model.set_nbfm_configuration(n); -} - void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) { const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis); receiver_model.set_baseband_configuration({ diff --git a/firmware/application/analog_audio_app.hpp b/firmware/application/analog_audio_app.hpp index a67dfc98..e3bd24a4 100644 --- a/firmware/application/analog_audio_app.hpp +++ b/firmware/application/analog_audio_app.hpp @@ -39,8 +39,6 @@ constexpr Style style_options_group { class AMOptionsView : public View { public: - std::function on_config_changed; - AMOptionsView(const Rect parent_rect, const Style* const style); private: @@ -62,8 +60,6 @@ private: class NBFMOptionsView : public View { public: - std::function on_config_changed; - NBFMOptionsView(const Rect parent_rect, const Style* const style); private: @@ -162,9 +158,6 @@ private: void on_headphone_volume_changed(int32_t v); void on_edit_frequency(); - void on_am_config_index_changed(size_t n); - void on_nbfm_config_index_changed(size_t n); - void remove_options_widget(); void set_options_widget(std::unique_ptr new_widget);