mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-21 19:05:06 +00:00
Compare commits
2 Commits
00347cbd29
...
a05a6afaaf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a05a6afaaf | ||
|
|
efd9662cfc |
@ -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__)
|
||||||
|
|||||||
@ -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
|
||||||
@ -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
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -1,31 +1,36 @@
|
|||||||
|
#include <Tactility/MountPoints.h>
|
||||||
#include <Tactility/Mutex.h>
|
#include <Tactility/Mutex.h>
|
||||||
#include <Tactility/file/FileLock.h>
|
#include <Tactility/file/FileLock.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/settings/Language.h>
|
#include <Tactility/settings/Language.h>
|
||||||
#include <Tactility/settings/SystemSettings.h>
|
#include <Tactility/settings/SystemSettings.h>
|
||||||
|
|
||||||
|
#include <format>
|
||||||
|
|
||||||
namespace tt::settings {
|
namespace tt::settings {
|
||||||
|
|
||||||
constexpr auto* TAG = "SystemSettings";
|
constexpr auto* TAG = "SystemSettings";
|
||||||
constexpr auto* FILE_PATH = "/data/settings/system.properties";
|
constexpr auto* FILE_PATH_FORMAT = "{}/settings/system.properties";
|
||||||
|
|
||||||
static Mutex mutex = Mutex();
|
static Mutex mutex;
|
||||||
static bool cached = false;
|
static bool cached = false;
|
||||||
static SystemSettings cachedSettings;
|
static SystemSettings cachedSettings;
|
||||||
|
|
||||||
static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
||||||
|
auto file_path = std::format(FILE_PATH_FORMAT, file::MOUNT_POINT_DATA);
|
||||||
|
TT_LOG_I(TAG, "System settings loading from %s", file_path.c_str());
|
||||||
std::map<std::string, std::string> map;
|
std::map<std::string, std::string> map;
|
||||||
if (!file::withLock<bool>(FILE_PATH, [&map] {
|
if (!file::withLock<bool>(file_path, [&map, &file_path] {
|
||||||
return file::loadPropertiesFile(FILE_PATH, map);
|
return file::loadPropertiesFile(file_path, map);
|
||||||
})) {
|
})) {
|
||||||
TT_LOG_E(TAG, "Failed to load %s", FILE_PATH);
|
TT_LOG_E(TAG, "Failed to load %s", file_path.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto language_entry = map.find("language");
|
auto language_entry = map.find("language");
|
||||||
if (language_entry != map.end()) {
|
if (language_entry != map.end()) {
|
||||||
if (!fromString(language_entry->second, properties.language)) {
|
if (!fromString(language_entry->second, properties.language)) {
|
||||||
TT_LOG_W(TAG, "Unknown language \"%s\" in %s", language_entry->second.c_str(), FILE_PATH);
|
TT_LOG_W(TAG, "Unknown language \"%s\" in %s", language_entry->second.c_str(), file_path.c_str());
|
||||||
properties.language = Language::en_US;
|
properties.language = Language::en_US;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -36,6 +41,7 @@ static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
|||||||
bool time_format_24h = time_format_entry == map.end() ? true : (time_format_entry->second == "true");
|
bool time_format_24h = time_format_entry == map.end() ? true : (time_format_entry->second == "true");
|
||||||
properties.timeFormat24h = time_format_24h;
|
properties.timeFormat24h = time_format_24h;
|
||||||
|
|
||||||
|
TT_LOG_I(TAG, "System settings loaded");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,13 +64,14 @@ bool saveSystemSettings(const SystemSettings& properties) {
|
|||||||
auto scoped_lock = mutex.asScopedLock();
|
auto scoped_lock = mutex.asScopedLock();
|
||||||
scoped_lock.lock();
|
scoped_lock.lock();
|
||||||
|
|
||||||
return file::withLock<bool>(FILE_PATH, [&properties] {
|
auto file_path = std::format(FILE_PATH_FORMAT, file::MOUNT_POINT_DATA);
|
||||||
|
return file::withLock<bool>(file_path, [&properties, &file_path] {
|
||||||
std::map<std::string, std::string> map;
|
std::map<std::string, std::string> map;
|
||||||
map["language"] = toString(properties.language);
|
map["language"] = toString(properties.language);
|
||||||
map["timeFormat24h"] = properties.timeFormat24h ? "true" : "false";
|
map["timeFormat24h"] = properties.timeFormat24h ? "true" : "false";
|
||||||
|
|
||||||
if (!file::savePropertiesFile(FILE_PATH, map)) {
|
if (!file::savePropertiesFile(file_path, map)) {
|
||||||
TT_LOG_E(TAG, "Failed to save %s", FILE_PATH);
|
TT_LOG_E(TAG, "Failed to save %s", file_path.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user