Merge develop into main (#304)

## New

- Read property files with `PropertiesFile`
- Support `boot.properties` so the user can specify the launcher app and an optional app to start after the launcher finishes. (see `BootProperties.cpp`)
- Create registry for CPU affinity and update code to make use of it
- `AppRegistration` and `ServiceRegistration` now also ensure that the `/data` directories always exist for all apps
- `Notes` is now the default app for opening text files. `TextViewer` is removed entirely. Created `tt::app::notes::start(path)` function.
- WiFi settings moved from NVS to properties file.
- Specify `*.ap.properties` file on the SD card for automatic WiFi settings import on start-up.
- Added `file::getLock(path)` and `file::withLock(path, function)` to do safe file operations on SD cards

## Improvements

- Update TinyUSB to `1.7.6~1`
- Improved `Boot.cpp` code. General code quality fixes and some restructuring to improve readability.
- `tt::string` functionality improvements
- Rename `AppRegistry` to `AppRegistration`
- Rename `ServiceRegistry` to `ServiceRegistration`
- Cleanup in `Notes.cpp`
- `FileTest.cpp` fix for PC
- Created `TestFile` helper class for tests, which automatically deletes files after the test.
- Renamed `Partitions.h` to `MountPoints.h`
- Created `std::string getMountPoints()` function for easy re-use
- Other code quality improvements
- `SdCardDevice`'s `getState()` and `isMounted()` now have a timeout argument

## Fixes

- ELF loading now has a lock so to avoid a bug when 2 ELF apps are loaded in parallel
This commit is contained in:
Ken Van Hoeylandt
2025-08-23 17:10:18 +02:00
committed by GitHub
parent fbaff8cbac
commit ee5a5a7181
109 changed files with 1396 additions and 744 deletions
+31 -16
View File
@@ -1,17 +1,19 @@
#include <Tactility/app/AppManifest.h>
#include <Tactility/file/File.h>
#include <Tactility/lvgl/Keyboard.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/Assets.h>
#include <lvgl.h>
#include "Tactility/app/AppManifest.h"
#include "Tactility/app/fileselection/FileSelection.h"
#include "Tactility/file/FileLock.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/Assets.h"
#include <Tactility/app/fileselection/FileSelection.h>
#include <Tactility/hal/sdcard/SdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/file/File.h>
#include <lvgl.h>
namespace tt::app::notes {
constexpr const char* TAG = "Notes";
constexpr auto* TAG = "Notes";
constexpr auto* NOTES_FILE_ARGUMENT = "file";
class NotesApp : public App {
@@ -81,7 +83,7 @@ class NotesApp : public App {
void openFile(const std::string& path) {
// We might be reading from the SD card, which could share a SPI bus with other devices (display)
hal::sdcard::withSdCardLock<void>(path, [this, path]() {
file::withLock<void>(path, [this, path] {
auto data = file::readString(path);
if (data != nullptr) {
auto lock = lvgl::getSyncLock()->asScopedLock();
@@ -96,7 +98,7 @@ class NotesApp : public App {
bool saveFile(const std::string& path) {
// We might be writing to SD card, which could share a SPI bus with other devices (display)
return hal::sdcard::withSdCardLock<bool>(path, [this, path]() {
return file::withLock<bool>(path, [this, path] {
if (file::writeString(path, saveBuffer.c_str())) {
TT_LOG_I(TAG, "Saved to %s", path.c_str());
filePath = path;
@@ -109,11 +111,20 @@ class NotesApp : public App {
#pragma endregion Open_Events_Functions
void onCreate(AppContext& appContext) override {
auto parameters = appContext.getParameters();
std::string file_path;
if (parameters != nullptr && parameters->optString(NOTES_FILE_ARGUMENT, file_path)) {
if (!file_path.empty()) {
filePath = file_path;
}
}
}
void onShow(AppContext& context, lv_obj_t* parent) override {
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
lv_obj_t* toolbar = tt::lvgl::toolbar_create(parent, context);
lv_obj_t* toolbar = lvgl::toolbar_create(parent, context);
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
uiDropDownMenu = lv_dropdown_create(toolbar);
@@ -168,9 +179,8 @@ class NotesApp : public App {
lv_label_set_text(uiCurrentFileName, "Untitled");
lv_obj_align(uiCurrentFileName, LV_ALIGN_CENTER, 0, 0);
//TODO: Move this to SD Card?
if (!file::findOrCreateDirectory(context.getPaths()->getDataDirectory(), 0777)) {
TT_LOG_E(TAG, "Failed to find or create path %s", context.getPaths()->getDataDirectory().c_str());
if (!filePath.empty()) {
openFile(filePath);
}
}
@@ -202,4 +212,9 @@ extern const AppManifest manifest = {
.createApp = create<NotesApp>
};
void start(const std::string& filePath) {
auto parameters = std::make_shared<Bundle>();
parameters->putString(NOTES_FILE_ARGUMENT, filePath);
service::loader::startApp(manifest.id, parameters);
}
} // namespace tt::app::notes