From f6a4cc26eeb8cae8f1e6c4e07a61f502c29710ee Mon Sep 17 00:00:00 2001 From: heurist1 Date: Sun, 5 Mar 2023 19:50:56 +0000 Subject: [PATCH] Move where on_change for the frequency field is setup, so that the frequency is correctly initialised when the app is launched and settings are being used --- firmware/application/apps/analog_audio_app.cpp | 8 +++++--- firmware/application/apps/analog_tv_app.cpp | 7 ++++--- firmware/application/apps/pocsag_app.cpp | 8 +++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/firmware/application/apps/analog_audio_app.cpp b/firmware/application/apps/analog_audio_app.cpp index f54875ee..4af233d9 100644 --- a/firmware/application/apps/analog_audio_app.cpp +++ b/firmware/application/apps/analog_audio_app.cpp @@ -129,6 +129,11 @@ AnalogAudioView::AnalogAudioView( &waterfall }); + // Set on_change before initialising the field + field_frequency.on_change = [this](rf::Frequency f) { + this->on_tuning_frequency_changed(f); + }; + // load app settings auto rc = settings.load("rx_audio", &app_settings); if(rc == SETTINGS_OK) { @@ -144,9 +149,6 @@ AnalogAudioView::AnalogAudioView( record_view.set_filename_date_frequency(true); field_frequency.set_step(receiver_model.frequency_step()); - field_frequency.on_change = [this](rf::Frequency f) { - this->on_tuning_frequency_changed(f); - }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push(receiver_model.tuning_frequency()); diff --git a/firmware/application/apps/analog_tv_app.cpp b/firmware/application/apps/analog_tv_app.cpp index 50a1cb20..c5102134 100644 --- a/firmware/application/apps/analog_tv_app.cpp +++ b/firmware/application/apps/analog_tv_app.cpp @@ -57,6 +57,10 @@ AnalogTvView::AnalogTvView( &tv }); + // Set on_change before initialising the field + field_frequency.on_change = [this](rf::Frequency f) { + this->on_tuning_frequency_changed(f); + }; // load app settings auto rc = settings.load("rx_tv", &app_settings); @@ -70,9 +74,6 @@ AnalogTvView::AnalogTvView( field_frequency.set_step(receiver_model.frequency_step()); - field_frequency.on_change = [this](rf::Frequency f) { - this->on_tuning_frequency_changed(f); - }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push(receiver_model.tuning_frequency()); diff --git a/firmware/application/apps/pocsag_app.cpp b/firmware/application/apps/pocsag_app.cpp index d1dcb6b4..0c5580b8 100644 --- a/firmware/application/apps/pocsag_app.cpp +++ b/firmware/application/apps/pocsag_app.cpp @@ -77,6 +77,11 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) { &console }); + // Set on_change before initialising the field + field_frequency.on_change = [this](rf::Frequency f) { + update_freq(f); + }; + // load app settings auto rc = settings.load("rx_pocsag", &app_settings); if(rc == SETTINGS_OK) { @@ -94,9 +99,6 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) { receiver_model.enable(); field_frequency.set_step(receiver_model.frequency_step()); - field_frequency.on_change = [this](rf::Frequency f) { - update_freq(f); - }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push(receiver_model.tuning_frequency());