Merge develop into main (#313)

- Add app path get() functions to `TactilityC`
- Improved `Dispatcher` and `DispatcherThread`
- Improved `PubSub` (type safety)
- Created test for `DispatcherThread` and `PubSub`
- Save properties files on app exit (various apps) by posting it to the main dispatcher (fixes UI hanging briefly on app exit)
- Fixed bug with `SystemSettings` being read from the wrong file path.
- `loadPropertiesFile()` now uses `file::readLines()` instead of doing that manually
- Increased timer task stack size (required due to issues when reading a properties file for the very first time)
- General cleanup
- Created `EstimatedPower` driver that uses an ADC pin to measure voltage and estimate the battery charge that is left.
- Cleanup of T-Deck board (updated to new style)
This commit is contained in:
Ken Van Hoeylandt
2025-09-01 23:07:00 +02:00
committed by GitHub
parent 5cc5b50694
commit 0f8380e8fe
96 changed files with 766 additions and 682 deletions
-1
View File
@@ -9,7 +9,6 @@
#include <Tactility/kernel/SystemEvents.h>
#include <Tactility/service/ServiceRegistration.h>
#include <Tactility/settings/DisplaySettings.h>
#include <Tactility/TactilityHeadless.h>
#ifdef ESP_PLATFORM
#include <Tactility/lvgl/EspLvglPort.h>
+8 -7
View File
@@ -28,9 +28,9 @@ struct StatusbarIcon {
struct StatusbarData {
Mutex mutex = Mutex(Mutex::Type::Recursive);
std::shared_ptr<PubSub> pubsub = std::make_shared<PubSub>();
std::shared_ptr<PubSub<void*>> pubsub = std::make_shared<PubSub<void*>>();
StatusbarIcon icons[STATUSBAR_ICON_LIMIT] = {};
Timer* time_update_timer = new Timer(Timer::Type::Once, []() { onUpdateTime(); });
Timer* time_update_timer = new Timer(Timer::Type::Once, [] { onUpdateTime(); });
uint8_t time_hours = 0;
uint8_t time_minutes = 0;
bool time_set = false;
@@ -44,7 +44,7 @@ typedef struct {
lv_obj_t* time;
lv_obj_t* icons[STATUSBAR_ICON_LIMIT];
lv_obj_t* battery_icon;
PubSub::SubscriptionHandle pubsub_subscription;
PubSub<void*>::SubscriptionHandle pubsub_subscription;
} Statusbar;
static bool statusbar_lock(TickType_t timeoutTicks = portMAX_DELAY) {
@@ -108,9 +108,8 @@ static const lv_obj_class_t statusbar_class = {
.theme_inheritable = false
};
static void statusbar_pubsub_event(TT_UNUSED const void* message, void* obj) {
TT_LOG_D(TAG, "event");
auto* statusbar = static_cast<Statusbar*>(obj);
static void statusbar_pubsub_event(Statusbar* statusbar) {
TT_LOG_D(TAG, "Update event");
if (lock(portMAX_DELAY)) {
update_main(statusbar);
lv_obj_invalidate(&statusbar->obj);
@@ -133,7 +132,9 @@ static void statusbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj)
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
LV_TRACE_OBJ_CREATE("finished");
auto* statusbar = (Statusbar*)obj;
statusbar->pubsub_subscription = statusbar_data.pubsub->subscribe(&statusbar_pubsub_event, statusbar);
statusbar->pubsub_subscription = statusbar_data.pubsub->subscribe([statusbar](auto) {
statusbar_pubsub_event(statusbar);
});
if (!statusbar_data.time_update_timer->isRunning()) {
statusbar_data.time_update_timer->start(200 / portTICK_PERIOD_MS);