Various improvements (#547)

- Fixed crash when returning to Setup app (from any of the steps)
- Fixed crash when returning to TimeDateSettings app (after locale selection)
- Fixed GuiService inconsistent behaviour: now always perform operations async (e.g. to show/hide apps). This fixes crashes in some onHide() calls where onHide() might be called before onShow() was called.
- Fix for incorrect WebServService path
- Remove CYD-4848S040C SD card functionality, but added a GPIO fix for releasing 3-wire SPI pin sharing.
- Fix for saving/loading settings for various apps
This commit is contained in:
Ken Van Hoeylandt
2026-07-04 21:26:43 +02:00
committed by GitHub
parent a323f8e148
commit ecad2248d9
33 changed files with 278 additions and 146 deletions
@@ -60,8 +60,11 @@ bool hasFileForDevice(const std::string& addr_hex) {
}
bool load(const std::string& addr_hex, PairedDevice& device) {
auto file_path = getFilePath(addr_hex);
if (!file::isFile(file_path)) return false;
std::map<std::string, std::string> map;
if (!file::loadPropertiesFile(getFilePath(addr_hex), map)) return false;
if (!file::loadPropertiesFile(file_path, map)) return false;
if (!map.contains(KEY_ADDR)) return false;
if (!hexToAddr(map[KEY_ADDR], device.addr)) return false;
@@ -83,7 +86,12 @@ bool save(const PairedDevice& device) {
map[KEY_ADDR] = addr_hex;
map[KEY_AUTO_CONNECT] = device.autoConnect ? "true" : "false";
map[KEY_PROFILE_ID] = std::to_string(device.profileId);
return file::savePropertiesFile(getFilePath(addr_hex), map);
auto file_path = getFilePath(addr_hex);
if (!file::findOrCreateParentDirectory(file_path, 0755)) {
LOGGER.error("Failed to create parent dir for {}", file_path);
return false;
}
return file::savePropertiesFile(file_path, map);
}
bool remove(const std::string& addr_hex) {
@@ -29,8 +29,13 @@ static BluetoothSettings cached;
static bool cached_valid = false;
static bool load(BluetoothSettings& out) {
auto settings_path = getSettingsPath();
if (!file::isFile(settings_path)) {
return false;
}
std::map<std::string, std::string> map;
if (!file::loadPropertiesFile(getSettingsPath(), map)) {
if (!file::loadPropertiesFile(settings_path, map)) {
return false;
}
auto it = map.find(KEY_ENABLE_ON_BOOT);
@@ -47,11 +52,18 @@ static bool load(BluetoothSettings& out) {
static bool save(const BluetoothSettings& s) {
std::map<std::string, std::string> map;
file::loadPropertiesFile(getSettingsPath(), map); // ignore failure — may not exist yet
if (file::isFile(getSettingsPath())) {
file::loadPropertiesFile(getSettingsPath(), map);
}
map[KEY_ENABLE_ON_BOOT] = s.enableOnBoot ? "true" : "false";
map[KEY_SPP_AUTO_START] = s.sppAutoStart ? "true" : "false";
map[KEY_MIDI_AUTO_START] = s.midiAutoStart ? "true" : "false";
return file::savePropertiesFile(getSettingsPath(), map);
auto settings_path = getSettingsPath();
if (!file::findOrCreateParentDirectory(settings_path, 0755)) {
LOGGER.error("Failed to create parent dir for {}", settings_path);
return false;
}
return file::savePropertiesFile(settings_path, map);
}
static BluetoothSettings getCachedOrLoad() {