Path fixes for simulator (#357)

This commit is contained in:
Ken Van Hoeylandt 2025-10-03 22:12:55 +02:00 committed by GitHub
parent efd9662cfc
commit a05a6afaaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 38 additions and 12 deletions

View File

@ -7,7 +7,7 @@ extern void vAssertCalled(unsigned long line, const char* const file);
#define configUSE_TICKLESS_IDLE 0 #define configUSE_TICKLESS_IDLE 0
#define configTICK_RATE_HZ 1000 // Must be the same as ESP32! #define configTICK_RATE_HZ 1000 // Must be the same as ESP32!
#define configMAX_PRIORITIES 10 #define configMAX_PRIORITIES 10
#define configMINIMAL_STACK_SIZE 128 #define configMINIMAL_STACK_SIZE 2048
#define configMAX_TASK_NAME_LEN 16 #define configMAX_TASK_NAME_LEN 16
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
@ -57,7 +57,7 @@ extern void vAssertCalled(unsigned long line, const char* const file);
#define configUSE_TIMERS 1 #define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY 3 #define configTIMER_TASK_PRIORITY 3
#define configTIMER_QUEUE_LENGTH 10 #define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE #define configTIMER_TASK_STACK_DEPTH 10240
/* Define to trap errors during development. */ /* Define to trap errors during development. */
#define configASSERT(x) if( ( x ) == 0 ) vAssertCalled(__LINE__, __FILE__) #define configASSERT(x) if( ( x ) == 0 ) vAssertCalled(__LINE__, __FILE__)

View File

@ -102,5 +102,6 @@ static void lvgl_task(TT_UNUSED void* arg) {
lv_disp_remove(displayHandle); lv_disp_remove(displayHandle);
displayHandle = nullptr; displayHandle = nullptr;
vTaskDelete(nullptr);
} }

@ -1 +1 @@
Subproject commit 52146cf067ae950b1d431a84766fc7d0501f536a Subproject commit 39a0fab4d79ccd622512d6028ea3733bd4085455

View File

@ -1,6 +1,11 @@
#pragma once #pragma once
/**
* Deprecated list of LVGL asset folder paths>
*/
#define TT_ASSET_FOLDER "A:/system/" #define TT_ASSET_FOLDER "A:/system/"
#define TT_ASSET(file) TT_ASSET_FOLDER file #define TT_ASSET(file) TT_ASSET_FOLDER file
// UI // UI

View File

@ -2,6 +2,14 @@
namespace tt::lvgl { namespace tt::lvgl {
#ifdef ESP_PLATFORM
static constexpr auto* PATH_PREFIX = "A:";
#else
// PC paths are relative, unlike ESP paths.
// LVGL paths require a `/` prefix, so we have to add it here:
static constexpr auto* PATH_PREFIX = "A:/";
#endif
bool isStarted(); bool isStarted();
void start(); void start();

View File

@ -1,3 +1,5 @@
#include "Tactility/lvgl/Lvgl.h"
#include <Tactility/TactilityCore.h> #include <Tactility/TactilityCore.h>
#include <Tactility/TactilityPrivate.h> #include <Tactility/TactilityPrivate.h>
#include <Tactility/app/AppContext.h> #include <Tactility/app/AppContext.h>
@ -169,7 +171,7 @@ public:
} else { } else {
logo = hal::usb::isUsbBootMode() ? "logo_usb.png" : "logo.png"; logo = hal::usb::isUsbBootMode() ? "logo_usb.png" : "logo.png";
} }
const auto logo_path = "A:" + paths->getAssetsPath(logo); const auto logo_path = lvgl::PATH_PREFIX + paths->getAssetsPath(logo);
TT_LOG_I(TAG, "%s", logo_path.c_str()); TT_LOG_I(TAG, "%s", logo_path.c_str());
lv_image_set_src(image, logo_path.c_str()); lv_image_set_src(image, logo_path.c_str());
} }

View File

@ -1,3 +1,4 @@
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/Style.h> #include <Tactility/lvgl/Style.h>
#include <Tactility/lvgl/Toolbar.h> #include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h> #include <Tactility/service/loader/Loader.h>
@ -47,7 +48,7 @@ class ImageViewerApp final : public App {
tt_check(bundle != nullptr, "Parameters not set"); tt_check(bundle != nullptr, "Parameters not set");
std::string file_argument; std::string file_argument;
if (bundle->optString(IMAGE_VIEWER_FILE_ARGUMENT, file_argument)) { if (bundle->optString(IMAGE_VIEWER_FILE_ARGUMENT, file_argument)) {
std::string prefixed_path = "A:" + file_argument; std::string prefixed_path = lvgl::PATH_PREFIX + file_argument;
TT_LOG_I(TAG, "Opening %s", prefixed_path.c_str()); TT_LOG_I(TAG, "Opening %s", prefixed_path.c_str());
lv_img_set_src(image, prefixed_path.c_str()); lv_img_set_src(image, prefixed_path.c_str());
auto path = string::getLastPathSegment(file_argument); auto path = string::getLastPathSegment(file_argument);

View File

@ -4,6 +4,7 @@
#include <Tactility/app/AppPaths.h> #include <Tactility/app/AppPaths.h>
#include <Tactility/app/AppRegistration.h> #include <Tactility/app/AppRegistration.h>
#include <Tactility/hal/power/PowerDevice.h> #include <Tactility/hal/power/PowerDevice.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/service/loader/Loader.h> #include <Tactility/service/loader/Loader.h>
#include <Tactility/settings/BootSettings.h> #include <Tactility/settings/BootSettings.h>
@ -113,9 +114,9 @@ public:
const int32_t margin = is_landscape_display ? std::min<int32_t>(available_width / 16, button_size) : 0; const int32_t margin = is_landscape_display ? std::min<int32_t>(available_width / 16, button_size) : 0;
const auto paths = app.getPaths(); const auto paths = app.getPaths();
const auto apps_icon_path = "A:" + paths->getAssetsPath("icon_apps.png"); const auto apps_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_apps.png");
const auto files_icon_path = "A:" + paths->getAssetsPath("icon_files.png"); const auto files_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_files.png");
const auto settings_icon_path = "A:" + paths->getAssetsPath("icon_settings.png"); const auto settings_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_settings.png");
createAppButton(buttons_wrapper, ui_scale, apps_icon_path.c_str(), "AppList", margin); createAppButton(buttons_wrapper, ui_scale, apps_icon_path.c_str(), "AppList", margin);
createAppButton(buttons_wrapper, ui_scale, files_icon_path.c_str(), "Files", margin); createAppButton(buttons_wrapper, ui_scale, files_icon_path.c_str(), "Files", margin);

View File

@ -16,10 +16,16 @@ namespace tt::app::localesettings {
constexpr auto* TAG = "LocaleSettings"; constexpr auto* TAG = "LocaleSettings";
#ifdef ESP_PLATFORM
constexpr auto* TEXT_RESOURCE_PATH = "/system/app/LocaleSettings/i18n";
#else
constexpr auto* TEXT_RESOURCE_PATH = "system/app/LocaleSettings/i18n";
#endif
extern const AppManifest manifest; extern const AppManifest manifest;
class LocaleSettingsApp final : public App { class LocaleSettingsApp final : public App {
tt::i18n::TextResources textResources = tt::i18n::TextResources("/system/app/LocaleSettings/i18n"); tt::i18n::TextResources textResources = tt::i18n::TextResources(TEXT_RESOURCE_PATH);
Mutex mutex = Mutex(Mutex::Type::Recursive); Mutex mutex = Mutex(Mutex::Type::Recursive);
lv_obj_t* timeZoneLabel = nullptr; lv_obj_t* timeZoneLabel = nullptr;
lv_obj_t* regionLabel = nullptr; lv_obj_t* regionLabel = nullptr;

View File

@ -8,6 +8,7 @@
#include <Tactility/app/App.h> #include <Tactility/app/App.h>
#include <Tactility/app/AppManifest.h> #include <Tactility/app/AppManifest.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/lvgl/Toolbar.h> #include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/screenshot/Screenshot.h> #include <Tactility/service/screenshot/Screenshot.h>
@ -204,13 +205,13 @@ void ScreenshotApp::createFilePathWidgets(lv_obj_t* parent) {
TT_LOG_W(TAG, "Found multiple SD card devices - picking first"); TT_LOG_W(TAG, "Found multiple SD card devices - picking first");
} }
if (!sdcard_devices.empty() && sdcard_devices.front()->isMounted()) { if (!sdcard_devices.empty() && sdcard_devices.front()->isMounted()) {
std::string lvgl_mount_path = "A:" + sdcard_devices.front()->getMountPath(); std::string lvgl_mount_path = lvgl::PATH_PREFIX + sdcard_devices.front()->getMountPath();
lv_textarea_set_text(pathTextArea, lvgl_mount_path.c_str()); lv_textarea_set_text(pathTextArea, lvgl_mount_path.c_str());
} else { } else {
lv_textarea_set_text(pathTextArea, "Error: no SD card"); lv_textarea_set_text(pathTextArea, "Error: no SD card");
} }
} else { // PC } else { // PC
lv_textarea_set_text(pathTextArea, "A:"); lv_textarea_set_text(pathTextArea, lvgl::PATH_PREFIX);
} }
} }

View File

@ -2,6 +2,7 @@
#include <Tactility/app/AppManifest.h> #include <Tactility/app/AppManifest.h>
#include <Tactility/app/AppPaths.h> #include <Tactility/app/AppPaths.h>
#include <Tactility/app/timezone/TimeZone.h> #include <Tactility/app/timezone/TimeZone.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/Toolbar.h> #include <Tactility/lvgl/Toolbar.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/service/loader/Loader.h> #include <Tactility/service/loader/Loader.h>
@ -200,7 +201,7 @@ public:
lv_obj_set_style_image_recolor_opa(icon, 255, 0); lv_obj_set_style_image_recolor_opa(icon, 255, 0);
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0); lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);
std::string icon_path = "A:" + app.getPaths()->getAssetsPath("search.png"); std::string icon_path = lvgl::PATH_PREFIX + app.getPaths()->getAssetsPath("search.png");
lv_image_set_src(icon, icon_path.c_str()); lv_image_set_src(icon, icon_path.c_str());
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0); lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);