mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 21:17:43 +00:00
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:
@@ -820,8 +820,13 @@ void set_encoder_dial_sensitivity(uint8_t v) {
|
||||
data->encoder_dial_sensitivity = v;
|
||||
}
|
||||
|
||||
bool should_use_sdcard_for_pmem() {
|
||||
return std::filesystem::file_exists(PMEM_FILEFLAG);
|
||||
}
|
||||
|
||||
// sd persisting settings
|
||||
int save_persistent_settings_to_file(std::string filename) {
|
||||
int save_persistent_settings_to_file() {
|
||||
std::string filename = PMEM_SETTING_FILE;
|
||||
delete_file(filename);
|
||||
File outfile;
|
||||
auto result = outfile.create(filename);
|
||||
@@ -832,7 +837,8 @@ int save_persistent_settings_to_file(std::string filename) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int load_persistent_settings_from_file(std::string filename) {
|
||||
int load_persistent_settings_from_file() {
|
||||
std::string filename = PMEM_SETTING_FILE;
|
||||
File infile;
|
||||
auto result = infile.open(filename);
|
||||
if (!result.is_valid()) {
|
||||
|
@@ -32,6 +32,11 @@
|
||||
#include "modems.hpp"
|
||||
#include "serializer.hpp"
|
||||
|
||||
// persistant memory from/to sdcard flag file
|
||||
#define PMEM_FILEFLAG "/SETTINGS/PMEM_FILEFLAG"
|
||||
// persistant memory from/to sdcard flag file
|
||||
#define PMEM_SETTING_FILE "/SETTINGS/pmem_settings"
|
||||
|
||||
using namespace modems;
|
||||
using namespace serializer;
|
||||
|
||||
@@ -244,8 +249,9 @@ void set_recon_load_hamradios(const bool v);
|
||||
void set_recon_match_mode(const bool v);
|
||||
|
||||
// sd persisting settings
|
||||
int save_persistent_settings_to_file(std::string filename);
|
||||
int load_persistent_settings_from_file(std::string filename);
|
||||
bool should_use_sdcard_for_pmem();
|
||||
int save_persistent_settings_to_file();
|
||||
int load_persistent_settings_from_file();
|
||||
|
||||
} /* namespace persistent_memory */
|
||||
|
||||
|
Reference in New Issue
Block a user