Remember previous capture settings (#2450)

This commit is contained in:
Mark Thompson 2024-12-29 02:21:08 -06:00 committed by GitHub
parent 854ac514cb
commit 57ce978bab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -55,12 +55,15 @@ CaptureAppView::CaptureAppView(NavigationView& nav)
this->field_frequency.set_step(v);
};
option_format.set_selected_index(0); // Default to C16
option_format.set_selected_index(previous_format);
option_format.on_change = [this](size_t, uint32_t file_type) {
previous_format = file_type;
record_view.set_file_type((RecordView::FileType)file_type);
};
check_trim.set_value(previous_trim);
check_trim.on_select = [this](Checkbox&, bool v) {
previous_trim = v;
record_view.set_auto_trim(v);
};
@ -100,7 +103,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav)
};
receiver_model.enable();
option_bandwidth.set_by_value(500000);
option_bandwidth.set_by_value(previous_bandwidth);
record_view.on_error = [&nav](std::string message) {
nav.display_modal("Error", message);

View File

@ -48,12 +48,21 @@ class CaptureAppView : public View {
private:
static constexpr ui::Dim header_height = 3 * 16;
uint32_t previous_bandwidth{500000};
uint32_t previous_format{0};
bool previous_trim{false};
NavigationView& nav_;
RxRadioState radio_state_{ReceiverModel::Mode::Capture};
app_settings::SettingsManager settings_{
"rx_capture", app_settings::Mode::RX};
"rx_capture",
app_settings::Mode::RX,
{
{"previous_bandwidth"sv, &previous_bandwidth},
{"previous_format"sv, &previous_format},
{"previous_trim"sv, &previous_trim},
}};
Labels labels{
{{0 * 8, 1 * 16}, "Rate:", Theme::getInstance()->fg_light->foreground},