Skip to content

Commit

Permalink
Move where on_change for the frequency field is setup, so that the fr…
Browse files Browse the repository at this point in the history
…equency is correctly initialised when the app is launched and settings are being used
  • Loading branch information
heurist1 committed Mar 5, 2023
1 parent 3d24864 commit f6a4cc2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 5 additions & 3 deletions firmware/application/apps/analog_audio_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<FrequencyKeypadView>(receiver_model.tuning_frequency());
Expand Down
7 changes: 4 additions & 3 deletions firmware/application/apps/analog_tv_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<FrequencyKeypadView>(receiver_model.tuning_frequency());
Expand Down
8 changes: 5 additions & 3 deletions firmware/application/apps/pocsag_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<FrequencyKeypadView>(receiver_model.tuning_frequency());
Expand Down

0 comments on commit f6a4cc2

Please sign in to comment.