Files
tactility/Tactility/Source/settings/BootSettings.cpp
T
Ken Van Hoeylandt 599fa46766 Driver improvements (#535)
- New drivers:
  - SD SPI
  - spi_peripheral
  - touch_placeholder
  - display_placeholder
- Devicetree compiler:
  - Implement phandle-arrays
  - Implement device addresses
- Add placeholder drivers to all devices with a SPI display
- SPI driver: add `cs-pins` and set them to high on driver start
- FileSystem: add `file_system_set_owner()` and `file_system_get_owner()`
- File locking is now checking if the related `FileSystem` is part of a shared SPI bus
- Add `device_get_child_count()`
- SDMMC driver: Remove default of `slot` value
- Fix for Crowpanel Basic 3.5" display (add delay to booting)
- Fix for LilyGO T-HMI SD card mounting (delayed mounting by disabling it initially in the dts)
2026-06-27 17:32:05 +02:00

48 lines
1.4 KiB
C++

#include <Tactility/MountPoints.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Logger.h>
#include <Tactility/settings/BootSettings.h>
#include <Tactility/Paths.h>
#include <format>
#include <string>
#include <vector>
namespace tt::settings {
constexpr auto* TAG = "BootSettings";
constexpr auto* PROPERTIES_FILE_FORMAT = "{}/settings/boot.properties";
constexpr auto* PROPERTIES_KEY_LAUNCHER_APP_ID = "launcherAppId";
constexpr auto* PROPERTIES_KEY_AUTO_START_APP_ID = "autoStartAppId";
static std::string getPropertiesFilePath() {
std::string sdcard_path;
if (findFirstMountedSdCardPath(sdcard_path)) {
std::string path = std::format(PROPERTIES_FILE_FORMAT, sdcard_path);
if (file::isFile(path)) {
return path;
}
}
return std::format(PROPERTIES_FILE_FORMAT, file::MOUNT_POINT_DATA);
}
bool loadBootSettings(BootSettings& properties) {
const std::string path = getPropertiesFilePath();
if (!file::loadPropertiesFile(path, [&properties](auto& key, auto& value) {
if (key == PROPERTIES_KEY_AUTO_START_APP_ID) {
properties.autoStartAppId = value;
} else if (key == PROPERTIES_KEY_LAUNCHER_APP_ID) {
properties.launcherAppId = value;
}
})) {
LOG_I(TAG, "No settings at %s", path.c_str());
return false;
}
return true;
}
}