Touch and display driver subsystems reworked (and more) (#302)

- Refactored `TouchDevice`: it can now start/stop LVGL separately, and it has an optional `TouchDriver` interface
- Refactored `DisplayDevice`: it can now start/stop LVGL separately, and it has an optional `DisplayDriver` interface
- Updated all boards and drivers for above changes
- LVGL can now be stopped and (re)started on the fly
- Fixed issues with restarting Gui and Statusbar services
- Refactored `Gui` service to be class and renamed `Gui` to `GuiService`
- Fixed `Statusbar` service: forgot to deregister one of the icons
- Updated `esp_lcd_st7701` to v1.1.3
- `lv_textarea_create()` now automatically registers the hardware keyboard hooks (by wrapping the function)
- Fixed and updated `tactility.py`
- Cleanup of a lot of code
- `BootInitLvglBegin` and `BootInitLvglEnd` are replaced by `LvglStarted` and `LvglStopped`.
- Introduced `tt::service::State` which is accessible via `tt::service::getState()` (and internally via `ServiceInstance`)
- Started replacing `#define TAG` with `constexpr auto TAG = "..";`
This commit is contained in:
Ken Van Hoeylandt
2025-08-16 20:22:49 +02:00
committed by GitHub
parent 15f4fbfdc6
commit d875ade8cb
127 changed files with 1907 additions and 1605 deletions
@@ -130,20 +130,18 @@ static _Nullable const char* getPowerStatusIcon() {
class StatusbarService final : public Service {
private:
Mutex mutex;
std::unique_ptr<Timer> updateTimer;
int8_t gps_icon_id = lvgl::statusbar_icon_add();
int8_t gps_icon_id;
bool gps_last_state = false;
int8_t wifi_icon_id = lvgl::statusbar_icon_add();
int8_t wifi_icon_id;
const char* wifi_last_icon = nullptr;
int8_t sdcard_icon_id = lvgl::statusbar_icon_add();
int8_t sdcard_icon_id;
const char* sdcard_last_icon = nullptr;
int8_t power_icon_id = lvgl::statusbar_icon_add();
int8_t power_icon_id;
const char* power_last_icon = nullptr;
std::unique_ptr<service::Paths> paths;
std::unique_ptr<Paths> paths;
void lock() const {
mutex.lock();
@@ -154,7 +152,7 @@ private:
}
void updateGpsIcon() {
auto gps_state = service::gps::findGpsService()->getState();
auto gps_state = gps::findGpsService()->getState();
bool show_icon = (gps_state == gps::State::OnPending) || (gps_state == gps::State::On);
if (gps_last_state != show_icon) {
if (show_icon) {
@@ -199,7 +197,7 @@ private:
}
void updateSdCardIcon() {
auto sdcard = tt::hal::getConfiguration()->sdcard;
auto sdcard = hal::getConfiguration()->sdcard;
if (sdcard != nullptr) {
auto state = sdcard->getState();
if (state != hal::sdcard::SdCardDevice::State::Unknown) {
@@ -229,10 +227,18 @@ private:
public:
~StatusbarService() final {
StatusbarService() {
gps_icon_id = lvgl::statusbar_icon_add();
sdcard_icon_id = lvgl::statusbar_icon_add();
wifi_icon_id = lvgl::statusbar_icon_add();
power_icon_id = lvgl::statusbar_icon_add();
}
~StatusbarService() override {
lvgl::statusbar_icon_remove(wifi_icon_id);
lvgl::statusbar_icon_remove(sdcard_icon_id);
lvgl::statusbar_icon_remove(power_icon_id);
lvgl::statusbar_icon_remove(gps_icon_id);
}
void onStart(ServiceContext& serviceContext) override {
@@ -245,7 +251,7 @@ public:
assert(service);
onUpdate(service);
updateTimer = std::make_unique<Timer>(Timer::Type::Periodic, [service]() {
updateTimer = std::make_unique<Timer>(Timer::Type::Periodic, [service] {
onUpdate(service);
});