App settings revamp (#1139)

* WIP AppSetting overhaul

* WIP migrating apps to new settings.

* remove settings, rename tuned => target

* formatting

* Minor fixes

* Fix hang on app load

* run formatter

* PR comment fixes

* Load modulation into receiver model in app_settings

* Run formatter

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
Kyle Reed
2023-06-11 11:47:13 -07:00
committed by GitHub
parent f65e743c4c
commit 8bd3d6249d
105 changed files with 914 additions and 1136 deletions

View File

@@ -23,8 +23,9 @@
#include "file.hpp"
#include <algorithm>
#include <locale>
#include <codecvt>
#include <cstring>
#include <locale>
Optional<File::Error> File::open_fatfs(const std::filesystem::path& filename, BYTE mode) {
auto result = f_open(&f, reinterpret_cast<const TCHAR*>(filename.c_str()), mode);
@@ -138,6 +139,37 @@ Optional<File::Error> File::sync() {
}
}
File::Result<std::string> File::read_file(const std::filesystem::path& filename) {
constexpr size_t buffer_size = 0x80;
char* buffer[buffer_size];
File f;
auto error = f.open(filename);
if (error)
return *error;
std::string content;
content.resize(f.size());
auto str = &content[0];
auto total_read = 0u;
while (true) {
auto read = f.read(buffer, buffer_size);
if (!read)
return read.error();
memcpy(str, buffer, *read);
str += *read;
total_read += *read;
if (*read < buffer_size)
break;
}
content.resize(total_read);
return content;
}
/* Range used for filename matching.
* Start and end are inclusive positions of "???" */
struct pattern_range {