Added reset persitent memory

This commit is contained in:
GullCode 2023-05-03 19:42:57 +02:00
parent 2f343adf21
commit 658d0c9b3a
2 changed files with 21 additions and 6 deletions

View File

@ -41,7 +41,6 @@ using namespace portapack;
#include "freqman.hpp"
namespace ui {
SetDateTimeView::SetDateTimeView(
NavigationView& nav
) {
@ -306,7 +305,6 @@ namespace ui {
checkbox_load_app_settings.set_value(persistent_memory::load_app_settings());
checkbox_save_app_settings.set_value(persistent_memory::save_app_settings());
button_save.on_select = [&nav, this](Button&) {
persistent_memory::set_load_app_settings(checkbox_load_app_settings.value());
persistent_memory::set_save_app_settings(checkbox_save_app_settings.value());
@ -405,6 +403,7 @@ namespace ui {
&check_load_mem_at_startup,
&button_save_mem_to_file,
&button_load_mem_from_file,
&button_load_mem_defaults,
&button_return
});
@ -483,6 +482,17 @@ namespace ui {
}
};
button_load_mem_defaults.on_select = [&nav, this](Button&) {
nav.push<ModalMessageView>(
"Warning!",
"This will reset the persistent_memory\nand set the default settings",
YESNO,
[this](bool choice) {
if (choice) {
portapack::persistent_memory::cache::defaults();
}
} );
};
button_return.on_select = [&nav, this](Button&) {
nav.pop();

View File

@ -314,7 +314,7 @@ private:
25,
"Save app settings"
};
Button button_save {
{ 2 * 8, 16 * 16, 12 * 8, 32 },
"Save"
@ -464,15 +464,20 @@ private:
};
Button button_save_mem_to_file {
{ 0, 9 * 16, 240, 32 },
{ 0, 8 * 16, 240, 32 },
"save p.mem to sdcard"
};
Button button_load_mem_from_file {
{ 0, 12 * 16, 240, 32 },
{ 0, 10 * 16 + 4 , 240, 32 },
"load p.mem from sdcard"
};
Button button_load_mem_defaults {
{ 0, 12 * 16 + 8 , 240, 32 },
"!! reset p.mem, load defaults !!"
};
Button button_return {
{ 16 * 8, 16 * 16, 12 * 8, 32 },
"Return",