From 658d0c9b3a029120077a0467c9bc35ef0cf7ae5f Mon Sep 17 00:00:00 2001 From: GullCode Date: Wed, 3 May 2023 19:42:57 +0200 Subject: [PATCH 1/3] Added reset persitent memory --- firmware/application/apps/ui_settings.cpp | 14 ++++++++++++-- firmware/application/apps/ui_settings.hpp | 13 +++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index 1e11e9cf..7c3fc14d 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -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( + "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(); diff --git a/firmware/application/apps/ui_settings.hpp b/firmware/application/apps/ui_settings.hpp index d252e535..c5c7fee6 100644 --- a/firmware/application/apps/ui_settings.hpp +++ b/firmware/application/apps/ui_settings.hpp @@ -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", From 1dae2c0d250d2cffd774aa3b737a2a53efed0254 Mon Sep 17 00:00:00 2001 From: GullCode Date: Wed, 3 May 2023 19:44:08 +0200 Subject: [PATCH 2/3] indentation --- firmware/application/apps/ui_settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index 7c3fc14d..69dec3f1 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -489,7 +489,7 @@ namespace ui { YESNO, [this](bool choice) { if (choice) { - portapack::persistent_memory::cache::defaults(); + portapack::persistent_memory::cache::defaults(); } } ); }; From c4373d15604b6360957146733758f0b3a1f7341d Mon Sep 17 00:00:00 2001 From: GullCode Date: Wed, 3 May 2023 19:45:01 +0200 Subject: [PATCH 3/3] indentation --- firmware/application/apps/ui_settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index 69dec3f1..0f384ef1 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -403,7 +403,7 @@ namespace ui { &check_load_mem_at_startup, &button_save_mem_to_file, &button_load_mem_from_file, - &button_load_mem_defaults, + &button_load_mem_defaults, &button_return });