mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Start/stop LVGL
This commit is contained in:
parent
ed1e2d1321
commit
a5eb8ef834
@ -1,8 +1,11 @@
|
|||||||
|
#include "../../../Tactility/Private/Tactility/service/gui/GuiService.h"
|
||||||
|
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
#include <Tactility/hal/Device.h>
|
#include <Tactility/hal/Device.h>
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include <Tactility/hal/display/NativeDisplay.h>
|
||||||
#include <Tactility/service/ServiceRegistry.h>
|
#include <Tactility/service/ServiceRegistry.h>
|
||||||
|
|
||||||
using namespace tt::app;
|
using namespace tt::app;
|
||||||
@ -23,29 +26,33 @@ class HelloWorldApp : public App {
|
|||||||
tt::service::stopService("Statusbar");
|
tt::service::stopService("Statusbar");
|
||||||
tt::service::stopService("Gui");
|
tt::service::stopService("Gui");
|
||||||
|
|
||||||
tt::service::startService("Gui");
|
using namespace tt::hal;
|
||||||
tt::service::startService("Statusbar");
|
displayDevice = findFirstDevice<display::DisplayDevice>(Device::Type::Display);
|
||||||
|
if (displayDevice == nullptr) {
|
||||||
|
TT_LOG_E("HelloWorld", "Display device not found");
|
||||||
|
stop();
|
||||||
|
} else {
|
||||||
|
if (displayDevice->supportsLvgl() && displayDevice->getLvglDisplay() != nullptr) {
|
||||||
|
if (!displayDevice->stopLvgl()) {
|
||||||
|
TT_LOG_E("HelloWorld", "Failed to detach display from LVGL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// using namespace tt::hal;
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
// displayDevice = findFirstDevice<display::DisplayDevice>(Device::Type::Display);
|
stop(); // stop this app
|
||||||
// if (displayDevice == nullptr) {
|
|
||||||
// TT_LOG_E("HelloWorld", "Display device not found");
|
|
||||||
// stop();
|
|
||||||
// } else {
|
|
||||||
// if (displayDevice->supportsLvgl() && displayDevice->getLvglDisplay() != nullptr) {
|
|
||||||
// if (!displayDevice->stopLvgl()) {
|
|
||||||
// TT_LOG_E("HelloWorld", "Failed to detach display from LVGL");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDestroy(AppContext& appContext) override {
|
void onDestroy(AppContext& appContext) override {
|
||||||
if (displayDevice != nullptr) {
|
if (displayDevice != nullptr) {
|
||||||
if (displayDevice->supportsLvgl() && displayDevice->getLvglDisplay() == nullptr) {
|
if (displayDevice->supportsLvgl() && displayDevice->getLvglDisplay() == nullptr) {
|
||||||
|
TT_LOG_I("HelloWorld", "Starting LVGL");
|
||||||
displayDevice->startLvgl();
|
displayDevice->startLvgl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tt::service::startService("Gui");
|
||||||
|
tt::service::startService("Statusbar");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user