moved pmem setting restore before top bar is loaded (#1105)

* moved pmem setting restore before top bar is loaded
* added a check pmem from sdcard function, replaced occurences, added a save to file on back button
* Added defines for flag file and dump file, changed test func name to should_use_sdcard_for_pmem, used file_exists, removed save and load pmem parameter
* changed a text to a more comprehesible one
This commit is contained in:
gullradriel 2023-06-04 21:25:25 +02:00 committed by GitHub
parent e3e179e380
commit 7e8a139732
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 30 deletions

View file

@ -126,6 +126,10 @@ SystemStatusView::SystemStatusView(
&sd_card_status_view,
});
if (portapack::persistent_memory::should_use_sdcard_for_pmem()) {
portapack::persistent_memory::load_persistent_settings_from_file();
}
if (portapack::persistent_memory::config_speaker())
button_speaker.hidden(false);
else
@ -156,6 +160,9 @@ SystemStatusView::SystemStatusView(
refresh();
button_back.on_select = [this](ImageButton&) {
if (portapack::persistent_memory::should_use_sdcard_for_pmem()) {
portapack::persistent_memory::save_persistent_settings_to_file();
}
if (this->on_back)
this->on_back();
};
@ -692,13 +699,6 @@ SystemView::SystemView(
navigation_view.push<SystemMenuView>();
File pmem_flag_file_handle;
std::string pmem_flag_file = "/SETTINGS/PMEM_FILEFLAG";
auto result = pmem_flag_file_handle.open(pmem_flag_file);
if (!result.is_valid()) {
portapack::persistent_memory::load_persistent_settings_from_file("SETTINGS/pmem_settings");
}
if (portapack::persistent_memory::config_splash()) {
navigation_view.push<BMPView>();
}