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:
committed by
GitHub
parent
15f4fbfdc6
commit
d875ade8cb
@@ -5,7 +5,6 @@
|
||||
#include <Tactility/Assets.h>
|
||||
#include <Tactility/service/espnow/EspNow.h>
|
||||
|
||||
#include "Tactility/service/gui/Gui.h"
|
||||
#include "Tactility/lvgl/LvglSync.h"
|
||||
|
||||
#include <cstdio>
|
||||
@@ -16,7 +15,7 @@
|
||||
namespace tt::app::chat {
|
||||
|
||||
constexpr const char* TAG = "ChatApp";
|
||||
constexpr const uint8_t BROADCAST_ADDRESS[ESP_NOW_ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
constexpr uint8_t BROADCAST_ADDRESS[ESP_NOW_ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
class ChatApp : public App {
|
||||
|
||||
@@ -154,7 +153,6 @@ public:
|
||||
lv_obj_set_height(input_field, LV_PCT(100));
|
||||
lv_textarea_set_placeholder_text(input_field, "Type a message...");
|
||||
lv_textarea_set_one_line(input_field, true);
|
||||
service::gui::keyboardAddTextArea(input_field);
|
||||
|
||||
// Send button
|
||||
auto* send_btn = lv_btn_create(input_panel);
|
||||
|
||||
@@ -72,9 +72,7 @@ class DisplayApp : public App {
|
||||
|
||||
static void onGammaSliderEvent(lv_event_t* event) {
|
||||
auto* slider = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = static_cast<hal::display::DisplayDevice*>(lv_display_get_user_data(lvgl_display));
|
||||
auto hal_display = hal::findFirstDevice<hal::display::DisplayDevice>(hal::Device::Type::Display);
|
||||
assert(hal_display != nullptr);
|
||||
|
||||
if (hal_display->getGammaCurveCount() > 0) {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
#include <Tactility/service/gui/Gui.h>
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
@@ -200,7 +199,6 @@ void View::init(lv_obj_t* parent, Mode mode) {
|
||||
path_textarea = lv_textarea_create(bottom_wrapper);
|
||||
lv_textarea_set_one_line(path_textarea, true);
|
||||
lv_obj_set_flex_grow(path_textarea, 1);
|
||||
service::gui::keyboardAddTextArea(path_textarea);
|
||||
lv_obj_add_event_cb(path_textarea, onPathTextChanged, LV_EVENT_VALUE_CHANGED, this);
|
||||
|
||||
select_button = lv_button_create(bottom_wrapper);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
#include "Tactility/service/gui/Gui.h"
|
||||
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
@@ -47,8 +46,6 @@ static std::string getTitleParameter(const std::shared_ptr<const Bundle>& bundle
|
||||
|
||||
class InputDialogApp : public App {
|
||||
|
||||
private:
|
||||
|
||||
static void createButton(lv_obj_t* parent, const std::string& text, void* callbackContext) {
|
||||
lv_obj_t* button = lv_button_create(parent);
|
||||
lv_obj_t* button_label = lv_label_create(button);
|
||||
@@ -71,9 +68,9 @@ private:
|
||||
auto bundle = std::make_unique<Bundle>();
|
||||
const char* text = lv_textarea_get_text((lv_obj_t*)user_data);
|
||||
bundle->putString(RESULT_BUNDLE_KEY_RESULT, text);
|
||||
setResult(app::Result::Ok, std::move(bundle));
|
||||
setResult(Result::Ok, std::move(bundle));
|
||||
} else {
|
||||
setResult(app::Result::Cancelled);
|
||||
setResult(Result::Cancelled);
|
||||
|
||||
}
|
||||
service::loader::stopApp();
|
||||
@@ -106,7 +103,6 @@ public:
|
||||
if (parameters->optString(PARAMETER_BUNDLE_KEY_PREFILLED, prefilled)) {
|
||||
lv_textarea_set_text(textarea, prefilled.c_str());
|
||||
}
|
||||
service::gui::keyboardAddTextArea(textarea);
|
||||
|
||||
auto* button_wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_flex_flow(button_wrapper, LV_FLEX_FLOW_ROW);
|
||||
|
||||
@@ -172,8 +172,6 @@ class NotesApp : public App {
|
||||
if (!file::findOrCreateDirectory(context.getPaths()->getDataDirectory(), 0777)) {
|
||||
TT_LOG_E(TAG, "Failed to find or create path %s", context.getPaths()->getDataDirectory().c_str());
|
||||
}
|
||||
|
||||
lvgl::keyboard_add_textarea(uiNoteText);
|
||||
}
|
||||
|
||||
void onResult(AppContext& appContext, LaunchId launchId, Result result, std::unique_ptr<Bundle> resultData) override {
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "Tactility/app/AppManifest.h"
|
||||
#include "Tactility/lvgl/LvglSync.h"
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/service/gui/Gui.h"
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
#include "Tactility/service/screenshot/Screenshot.h"
|
||||
|
||||
#include <Tactility/TactilityHeadless.h>
|
||||
@@ -39,7 +37,7 @@ class ScreenshotApp final : public App {
|
||||
public:
|
||||
|
||||
ScreenshotApp();
|
||||
~ScreenshotApp() final;
|
||||
~ScreenshotApp();
|
||||
|
||||
void onShow(AppContext& app, lv_obj_t* parent) override;
|
||||
void onStartPressed();
|
||||
@@ -271,9 +269,6 @@ void ScreenshotApp::onShow(AppContext& appContext, lv_obj_t* parent) {
|
||||
createFilePathWidgets(wrapper);
|
||||
createTimerSettingsWidgets(wrapper);
|
||||
|
||||
service::gui::keyboardAddTextArea(delayTextArea);
|
||||
service::gui::keyboardAddTextArea(pathTextArea);
|
||||
|
||||
updateScreenshotMode();
|
||||
|
||||
if (!updateTimer->isRunning()) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Tactility/app/timezone/TimeZone.h"
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/lvgl/LvglSync.h"
|
||||
#include "Tactility/service/gui/Gui.h"
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
|
||||
#include <Tactility/Partitions.h>
|
||||
@@ -66,8 +65,6 @@ void setResultCode(Bundle& bundle, const std::string& code) {
|
||||
|
||||
class TimeZoneApp : public App {
|
||||
|
||||
private:
|
||||
|
||||
Mutex mutex;
|
||||
std::vector<TimeZoneEntry> entries;
|
||||
std::unique_ptr<Timer> updateTimer;
|
||||
@@ -107,7 +104,7 @@ private:
|
||||
setResultName(*bundle, entry.name);
|
||||
setResultCode(*bundle, entry.code);
|
||||
|
||||
setResult(app::Result::Ok, std::move(bundle));
|
||||
setResult(Result::Ok, std::move(bundle));
|
||||
|
||||
service::loader::stopApp();
|
||||
}
|
||||
@@ -221,7 +218,6 @@ public:
|
||||
lv_obj_add_event_cb(textarea, onTextareaValueChangedCallback, LV_EVENT_VALUE_CHANGED, this);
|
||||
filterTextareaWidget = textarea;
|
||||
lv_obj_set_flex_grow(textarea, 1);
|
||||
service::gui::keyboardAddTextArea(textarea);
|
||||
|
||||
auto* list = lv_list_create(parent);
|
||||
lv_obj_set_width(list, LV_PCT(100));
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "Tactility/app/wificonnect/View.h"
|
||||
#include "Tactility/app/wificonnect/WifiConnect.h"
|
||||
|
||||
#include "Tactility/lvgl/Style.h"
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/lvgl/Spinner.h"
|
||||
#include "Tactility/service/gui/Gui.h"
|
||||
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <Tactility/service/wifi/WifiSettings.h>
|
||||
@@ -187,10 +185,6 @@ void View::init(AppContext& app, lv_obj_t* parent) {
|
||||
// Bottom buttons
|
||||
createBottomButtons(wrapper);
|
||||
|
||||
// Keyboard bindings
|
||||
service::gui::keyboardAddTextArea(ssid_textarea);
|
||||
service::gui::keyboardAddTextArea(password_textarea);
|
||||
|
||||
// Init from app parameters
|
||||
auto bundle = app.getParameters();
|
||||
if (bundle != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user