mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-18 07:55:06 +00:00
LvglSync removed (#591)
Replaced all usages with lvgl-module functions.
This commit is contained in:
parent
03a6285328
commit
3354924359
@ -1,13 +1,12 @@
|
|||||||
#include <tactility/module.h>
|
#include <tactility/module.h>
|
||||||
|
|
||||||
#include <tactility/error.h>
|
#include <tactility/error.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <Tactility/SystemEvents.h>
|
#include <Tactility/SystemEvents.h>
|
||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/kernel/Kernel.h>
|
#include <Tactility/kernel/Kernel.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/settings/TrackballSettings.h>
|
#include <Tactility/settings/TrackballSettings.h>
|
||||||
|
|
||||||
#include <lilygo/drivers/trackball.h>
|
#include <lilygo/drivers/trackball.h>
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
// Official LVGL library header
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/Lock.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace tt::lvgl {
|
|
||||||
|
|
||||||
constexpr TickType_t defaultLockTime = 500 / portTICK_PERIOD_MS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LVGL locking function
|
|
||||||
* @param[in] timeout as ticks
|
|
||||||
* @warning when passing zero, we wait forever, as this is the default behaviour for esp_lvgl_port, and we want it to remain consistent
|
|
||||||
* @deprecated Use lvgl_lock() or lvgl_try_lock() from lvgl-module instead.
|
|
||||||
*/
|
|
||||||
bool lock(TickType_t timeout = portMAX_DELAY) __attribute__((deprecated("Use lvgl_lock() from lvgl-module")));
|
|
||||||
|
|
||||||
/** @deprecated Use lvgl_unlock() from lvgl-module instead. */
|
|
||||||
void unlock() __attribute__((deprecated("Use lvgl_unlock() from lvgl-module")));
|
|
||||||
|
|
||||||
std::shared_ptr<Lock> getSyncLock() __attribute__((deprecated("Use lvgl locking functions from lvgl-module")));
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@ -3,7 +3,6 @@
|
|||||||
#include <Tactility/MessageQueue.h>
|
#include <Tactility/MessageQueue.h>
|
||||||
#include <Tactility/PubSub.h>
|
#include <Tactility/PubSub.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
|
||||||
#include <Tactility/service/Service.h>
|
#include <Tactility/service/Service.h>
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
|
|
||||||
@ -11,7 +10,6 @@
|
|||||||
|
|
||||||
#include <tactility/concurrent/dispatcher.h>
|
#include <tactility/concurrent/dispatcher.h>
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
namespace tt::service::gui {
|
namespace tt::service::gui {
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
|
|
||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <tactility/check.h>
|
|
||||||
#include <Tactility/lvgl/Style.h>
|
#include <Tactility/lvgl/Style.h>
|
||||||
#include <lvgl/widgets/toolbar.h>
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
#include <format>
|
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
|
|
||||||
|
#include <tactility/check.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
|
#include <format>
|
||||||
|
|
||||||
namespace tt::app::appdetails {
|
namespace tt::app::appdetails {
|
||||||
|
|
||||||
extern const AppManifest manifest;
|
extern const AppManifest manifest;
|
||||||
|
|||||||
@ -1,20 +1,21 @@
|
|||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/app/apphub/AppHub.h>
|
#include <Tactility/app/apphub/AppHub.h>
|
||||||
#include <Tactility/app/apphub/AppHubEntry.h>
|
#include <Tactility/app/apphub/AppHubEntry.h>
|
||||||
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>
|
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <lvgl/widgets/spinner.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/network/Http.h>
|
#include <Tactility/network/Http.h>
|
||||||
#include <Tactility/Paths.h>
|
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/spinner.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <lvgl.h>
|
|
||||||
#include <tactility/log.h>
|
|
||||||
|
|
||||||
namespace tt::app::apphub {
|
namespace tt::app::apphub {
|
||||||
|
|
||||||
@ -58,20 +59,16 @@ class AppHubApp final : public App {
|
|||||||
|
|
||||||
void onRefreshSuccess() {
|
void onRefreshSuccess() {
|
||||||
LOG_I(TAG, "Request success");
|
LOG_I(TAG, "Request success");
|
||||||
auto lockable = lvgl::getSyncLock();
|
lvgl_lock();
|
||||||
auto lock = lockable->asScopedLock();
|
|
||||||
lock.lock();
|
|
||||||
|
|
||||||
showApps();
|
showApps();
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRefreshError(const char* error) {
|
void onRefreshError(const char* error) {
|
||||||
LOG_E(TAG, "Request failed: %s", error);
|
LOG_E(TAG, "Request failed: %s", error);
|
||||||
auto lockable = lvgl::getSyncLock();
|
lvgl_lock();
|
||||||
auto lock = lockable->asScopedLock();
|
|
||||||
lock.lock();
|
|
||||||
|
|
||||||
showRefreshFailedError("Cannot reach server");
|
showRefreshFailedError("Cannot reach server");
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createAppWidget(const std::shared_ptr<AppManifest>& manifest, lv_obj_t* list) {
|
static void createAppWidget(const std::shared_ptr<AppManifest>& manifest, lv_obj_t* list) {
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
|
#include <Tactility/Paths.h>
|
||||||
|
#include <Tactility/StringUtils.h>
|
||||||
|
#include <Tactility/app/AppRegistration.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <Tactility/app/apphub/AppHub.h>
|
#include <Tactility/app/apphub/AppHub.h>
|
||||||
#include <Tactility/app/apphub/AppHubEntry.h>
|
#include <Tactility/app/apphub/AppHubEntry.h>
|
||||||
#include <Tactility/app/AppRegistration.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <lvgl/widgets/toolbar.h>
|
|
||||||
#include <Tactility/network/Http.h>
|
#include <Tactility/network/Http.h>
|
||||||
#include <Tactility/Paths.h>
|
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/StringUtils.h>
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
namespace tt::app::apphubdetails {
|
namespace tt::app::apphubdetails {
|
||||||
@ -87,15 +88,15 @@ class AppHubDetailsApp final : public App {
|
|||||||
void uninstallApp() {
|
void uninstallApp() {
|
||||||
LOG_I(TAG, "Uninstall");
|
LOG_I(TAG, "Uninstall");
|
||||||
|
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
|
|
||||||
uninstall(entry.appId);
|
uninstall(entry.appId);
|
||||||
|
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
updateViews();
|
updateViews();
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void doInstall() {
|
void doInstall() {
|
||||||
@ -115,9 +116,9 @@ class AppHubDetailsApp final : public App {
|
|||||||
LOG_I(TAG, "Deleted temporary file %s", temp_file_path.c_str());
|
LOG_I(TAG, "Deleted temporary file %s", temp_file_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
updateViews();
|
updateViews();
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
},
|
},
|
||||||
[temp_file_path](const char* errorMessage) {
|
[temp_file_path](const char* errorMessage) {
|
||||||
LOG_E(TAG, "Download failed: %s", errorMessage);
|
LOG_E(TAG, "Download failed: %s", errorMessage);
|
||||||
@ -133,9 +134,9 @@ class AppHubDetailsApp final : public App {
|
|||||||
void installApp() {
|
void installApp() {
|
||||||
LOG_I(TAG, "Install");
|
LOG_I(TAG, "Install");
|
||||||
|
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
|
|
||||||
doInstall();
|
doInstall();
|
||||||
}
|
}
|
||||||
@ -143,9 +144,9 @@ class AppHubDetailsApp final : public App {
|
|||||||
void updateApp() {
|
void updateApp() {
|
||||||
LOG_I(TAG, "Update");
|
LOG_I(TAG, "Update");
|
||||||
|
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_remove_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
|
|
||||||
LOG_I(TAG, "Removing previous version");
|
LOG_I(TAG, "Removing previous version");
|
||||||
uninstall(entry.appId);
|
uninstall(entry.appId);
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
|
|
||||||
#include <Tactility/PubSub.h>
|
#include <Tactility/PubSub.h>
|
||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/service/audio/Audio.h>
|
#include <Tactility/service/audio/Audio.h>
|
||||||
#include <lvgl/widgets/sliderbox.h>
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/icons/shared.h>
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/sliderbox.h>
|
||||||
|
|
||||||
namespace tt::app::audiosettings {
|
namespace tt::app::audiosettings {
|
||||||
|
|
||||||
@ -161,10 +157,9 @@ public:
|
|||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
audioSubscription = service::audio::getPubsub()->subscribe([this](auto) {
|
audioSubscription = service::audio::getPubsub()->subscribe([this](auto) {
|
||||||
if (lvgl::lock(lvgl::defaultLockTime)) {
|
lvgl_lock();
|
||||||
refresh();
|
refresh();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <Tactility/app/btmanage/BtManagePrivate.h>
|
#include <Tactility/app/btmanage/BtManagePrivate.h>
|
||||||
#include <Tactility/app/btmanage/View.h>
|
#include <Tactility/app/btmanage/View.h>
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
@ -79,12 +79,9 @@ void BtManage::unlock() {
|
|||||||
void BtManage::requestViewUpdate() {
|
void BtManage::requestViewUpdate() {
|
||||||
lock();
|
lock();
|
||||||
if (isViewEnabled) {
|
if (isViewEnabled) {
|
||||||
if (lvgl::lock(1000)) {
|
lvgl_lock();
|
||||||
view.update();
|
view.update();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,21 @@
|
|||||||
#include <Tactility/app/btpeersettings/BtPeerSettings.h>
|
#include <Tactility/app/btpeersettings/BtPeerSettings.h>
|
||||||
|
|
||||||
#include "tactility/device.h"
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <Tactility/bluetooth/Bluetooth.h>
|
#include <Tactility/bluetooth/Bluetooth.h>
|
||||||
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
|
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Style.h>
|
#include <Tactility/lvgl/Style.h>
|
||||||
#include <lvgl/widgets/toolbar.h>
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <tactility/drivers/bluetooth.h>
|
#include <tactility/drivers/bluetooth.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
namespace tt::app::btpeersettings {
|
namespace tt::app::btpeersettings {
|
||||||
|
|
||||||
constexpr auto* TAG = "BtPeerSettings";
|
constexpr auto* TAG = "BtPeerSettings";
|
||||||
@ -84,12 +82,9 @@ class BtPeerSettings : public App {
|
|||||||
|
|
||||||
void requestViewUpdate() const {
|
void requestViewUpdate() const {
|
||||||
if (viewEnabled) {
|
if (viewEnabled) {
|
||||||
if (lvgl::lock(1000)) {
|
lvgl_lock();
|
||||||
updateViews();
|
updateViews();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,15 +6,16 @@
|
|||||||
|
|
||||||
#include <Tactility/app/chat/ChatAppPrivate.h>
|
#include <Tactility/app/chat/ChatAppPrivate.h>
|
||||||
#include <Tactility/app/chat/ChatProtocol.h>
|
#include <Tactility/app/chat/ChatProtocol.h>
|
||||||
|
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <tactility/log.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace tt::app::chat {
|
namespace tt::app::chat {
|
||||||
@ -83,12 +84,9 @@ void ChatApp::onReceive(const esp_now_recv_info_t* receiveInfo, const uint8_t* d
|
|||||||
|
|
||||||
state.addMessage(msg);
|
state.addMessage(msg);
|
||||||
|
|
||||||
{
|
lvgl_lock();
|
||||||
auto lockable = lvgl::getSyncLock();
|
view.displayMessage(msg);
|
||||||
auto lock = lockable->asScopedLock();
|
lvgl_unlock();
|
||||||
lock.lock();
|
|
||||||
view.displayMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatApp::sendMessage(const std::string& text) {
|
void ChatApp::sendMessage(const std::string& text) {
|
||||||
@ -115,12 +113,9 @@ void ChatApp::sendMessage(const std::string& text) {
|
|||||||
|
|
||||||
state.addMessage(msg);
|
state.addMessage(msg);
|
||||||
|
|
||||||
{
|
lvgl_lock();
|
||||||
auto lockable = lvgl::getSyncLock();
|
view.displayMessage(msg);
|
||||||
auto lock = lockable->asScopedLock();
|
lvgl_unlock();
|
||||||
lock.lock();
|
|
||||||
view.displayMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatApp::applySettings(const std::string& nickname, const std::string& keyHex) {
|
void ChatApp::applySettings(const std::string& nickname, const std::string& keyHex) {
|
||||||
@ -173,12 +168,9 @@ void ChatApp::switchChannel(const std::string& chatChannel) {
|
|||||||
settings.chatChannel = trimmedChannel;
|
settings.chatChannel = trimmedChannel;
|
||||||
saveSettings(settings);
|
saveSettings(settings);
|
||||||
|
|
||||||
{
|
lvgl_lock();
|
||||||
auto lockable = lvgl::getSyncLock();
|
view.refreshMessageList();
|
||||||
auto lock = lockable->asScopedLock();
|
lvgl_unlock();
|
||||||
lock.lock();
|
|
||||||
view.refreshMessageList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const AppManifest manifest = {
|
extern const AppManifest manifest = {
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Style.h>
|
#include <Tactility/lvgl/Style.h>
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/service/development/DevelopmentService.h>
|
#include <Tactility/service/development/DevelopmentService.h>
|
||||||
@ -11,12 +10,12 @@
|
|||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <lvgl/lvgl.h>
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
namespace tt::app::development {
|
namespace tt::app::development {
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include <Tactility/app/files/SupportedFiles.h>
|
#include <Tactility/app/files/SupportedFiles.h>
|
||||||
#include <Tactility/app/files/View.h>
|
#include <Tactility/app/files/View.h>
|
||||||
|
|
||||||
#include <Tactility/Platform.h>
|
#include <Tactility/Platform.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
@ -9,14 +8,15 @@
|
|||||||
#include <Tactility/app/inputdialog/InputDialog.h>
|
#include <Tactility/app/inputdialog/InputDialog.h>
|
||||||
#include <Tactility/app/notes/Notes.h>
|
#include <Tactility/app/notes/Notes.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <tactility/check.h>
|
|
||||||
|
|
||||||
|
#include <tactility/check.h>
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
#include <tactility/drivers/usb_host_msc.h>
|
#include <tactility/drivers/usb_host_msc.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -450,9 +450,7 @@ void View::onEjectPressed() {
|
|||||||
void View::update(size_t start_index) {
|
void View::update(size_t start_index) {
|
||||||
const bool is_root = (state->getCurrentPath() == "/");
|
const bool is_root = (state->getCurrentPath() == "/");
|
||||||
|
|
||||||
auto sync_lockable = lvgl::getSyncLock();
|
if (!lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
auto scoped_lockable = sync_lockable->asScopedLock();
|
|
||||||
if (!scoped_lockable.lock(lvgl::defaultLockTime)) {
|
|
||||||
LOG_E(TAG, "Mutex acquisition timeout (%s)", "lvgl");
|
LOG_E(TAG, "Mutex acquisition timeout (%s)", "lvgl");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -516,6 +514,8 @@ void View::update(size_t start_index) {
|
|||||||
} else {
|
} else {
|
||||||
lv_obj_add_flag(lv_obj_get_parent(paste_button), LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(lv_obj_get_parent(paste_button), LV_OBJ_FLAG_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::init(const AppContext& appContext, lv_obj_t* parent) {
|
void View::init(const AppContext& appContext, lv_obj_t* parent) {
|
||||||
@ -551,18 +551,16 @@ void View::init(const AppContext& appContext, lv_obj_t* parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void View::onDirEntryListScrollBegin() {
|
void View::onDirEntryListScrollBegin() {
|
||||||
auto sync_lockable = lvgl::getSyncLock();
|
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
auto scoped_lockable = sync_lockable->asScopedLock();
|
|
||||||
if (scoped_lockable.lock(lvgl::defaultLockTime)) {
|
|
||||||
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onNavigate() {
|
void View::onNavigate() {
|
||||||
auto sync_lockable = lvgl::getSyncLock();
|
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
auto scoped_lockable = sync_lockable->asScopedLock();
|
|
||||||
if (scoped_lockable.lock(lvgl::defaultLockTime)) {
|
|
||||||
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
#include <Tactility/app/fileselection/View.h>
|
#include <Tactility/app/fileselection/View.h>
|
||||||
|
#include <Tactility/Platform.h>
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/Platform.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <lvgl/widgets/toolbar.h>
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -155,26 +155,27 @@ void View::onNavigateUpPressed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void View::update() {
|
void View::update() {
|
||||||
auto sync_lockable = lvgl::getSyncLock();
|
if (!lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
auto scoped_lockable = sync_lockable->asScopedLock();
|
|
||||||
if (scoped_lockable.lock(lvgl::defaultLockTime)) {
|
|
||||||
lv_obj_clean(dir_entry_list);
|
|
||||||
|
|
||||||
state->withEntries([this](const std::vector<dirent>& entries) {
|
|
||||||
for (auto entry : entries) {
|
|
||||||
LOG_D(TAG, "Entry: %s %d", entry.d_name, (int)entry.d_type);
|
|
||||||
createDirEntryWidget(dir_entry_list, entry);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (state->getCurrentPath() == "/") {
|
|
||||||
lv_obj_add_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
} else {
|
|
||||||
lv_obj_remove_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_E(TAG, "Mutex acquisition timeout (%s)", "lvgl");
|
LOG_E(TAG, "Mutex acquisition timeout (%s)", "lvgl");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_obj_clean(dir_entry_list);
|
||||||
|
|
||||||
|
state->withEntries([this](const std::vector<dirent>& entries) {
|
||||||
|
for (auto entry : entries) {
|
||||||
|
LOG_D(TAG, "Entry: %s %d", entry.d_name, (int)entry.d_type);
|
||||||
|
createDirEntryWidget(dir_entry_list, entry);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (state->getCurrentPath() == "/") {
|
||||||
|
lv_obj_add_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
} else {
|
||||||
|
lv_obj_remove_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::init(lv_obj_t* parent, Mode mode) {
|
void View::init(lv_obj_t* parent, Mode mode) {
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
#include <Tactility/app/i2cscanner/I2cScannerPrivate.h>
|
|
||||||
#include <Tactility/app/i2cscanner/I2cHelpers.h>
|
#include <Tactility/app/i2cscanner/I2cHelpers.h>
|
||||||
|
#include <Tactility/app/i2cscanner/I2cScannerPrivate.h>
|
||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/Preferences.h>
|
#include <Tactility/Preferences.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
|
|
||||||
#include <tactility/drivers/i2c_controller.h>
|
#include <tactility/drivers/i2c_controller.h>
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
#include <tactility/log.h>
|
|
||||||
|
|
||||||
namespace tt::app::i2cscanner {
|
namespace tt::app::i2cscanner {
|
||||||
|
|
||||||
@ -367,12 +367,9 @@ void I2cScannerApp::updateViews() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void I2cScannerApp::updateViewsSafely() {
|
void I2cScannerApp::updateViewsSafely() {
|
||||||
if (lvgl::lock(200 / portTICK_PERIOD_MS)) {
|
lvgl_lock();
|
||||||
updateViews();
|
updateViews();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_W(TAG, "Mutex acquisition timeout (%s)", "updateViewsSafely");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2cScannerApp::onScanTimerFinished() {
|
void I2cScannerApp::onScanTimerFinished() {
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
|
#include "lvgl/lvgl.h"
|
||||||
|
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/fileselection/FileSelection.h>
|
#include <Tactility/app/fileselection/FileSelection.h>
|
||||||
#include <Tactility/file/FileLock.h>
|
#include <Tactility/file/FileLock.h>
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/Assets.h>
|
|
||||||
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
@ -42,16 +41,16 @@ class NotesApp final : public App {
|
|||||||
break;
|
break;
|
||||||
case 1: // Save
|
case 1: // Save
|
||||||
if (!filePath.empty()) {
|
if (!filePath.empty()) {
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
saveBuffer = lv_textarea_get_text(uiNoteText);
|
saveBuffer = lv_textarea_get_text(uiNoteText);
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
saveFile(filePath);
|
saveFile(filePath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // Save as...
|
case 2: // Save as...
|
||||||
lvgl::getSyncLock()->lock();
|
lvgl_lock();
|
||||||
saveBuffer = lv_textarea_get_text(uiNoteText);
|
saveBuffer = lv_textarea_get_text(uiNoteText);
|
||||||
lvgl::getSyncLock()->unlock();
|
lvgl_unlock();
|
||||||
saveFileLaunchId = fileselection::startForExistingOrNewFile();
|
saveFileLaunchId = fileselection::startForExistingOrNewFile();
|
||||||
LOG_I(TAG, "launched with id %u", saveFileLaunchId);
|
LOG_I(TAG, "launched with id %u", saveFileLaunchId);
|
||||||
break;
|
break;
|
||||||
@ -87,13 +86,12 @@ class NotesApp final : public App {
|
|||||||
file::getLock(path)->withLock([this, path] {
|
file::getLock(path)->withLock([this, path] {
|
||||||
auto data = file::readString(path);
|
auto data = file::readString(path);
|
||||||
if (data != nullptr) {
|
if (data != nullptr) {
|
||||||
auto lockable = lvgl::getSyncLock();
|
lvgl_lock();
|
||||||
auto lock = lockable->asScopedLock();
|
lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
|
||||||
lock.lock();
|
lv_label_set_text(uiCurrentFileName, path.c_str());
|
||||||
lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
|
lvgl_unlock();
|
||||||
lv_label_set_text(uiCurrentFileName, path.c_str());
|
filePath = path;
|
||||||
filePath = path;
|
LOG_I(TAG, "Loaded from %s", path.c_str());
|
||||||
LOG_I(TAG, "Loaded from %s", path.c_str());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/lvgl/LvglSync.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>
|
||||||
|
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
#include <tactility/drivers/power_supply.h>
|
#include <tactility/drivers/power_supply.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -136,7 +134,7 @@ class PowerApp : public App {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl::lock(kernel::millisToTicks(1000));
|
lvgl_lock();
|
||||||
|
|
||||||
for (auto& entry : entries) {
|
for (auto& entry : entries) {
|
||||||
if (entry.enableSwitch != nullptr) {
|
if (entry.enableSwitch != nullptr) {
|
||||||
@ -155,7 +153,7 @@ class PowerApp : public App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -7,16 +7,16 @@
|
|||||||
#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/Lvgl.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>
|
||||||
|
|
||||||
#include <Tactility/Paths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
|
||||||
namespace tt::app::screenshot {
|
namespace tt::app::screenshot {
|
||||||
|
|
||||||
constexpr auto* TAG = "Screenshot";
|
constexpr auto* TAG = "Screenshot";
|
||||||
@ -87,10 +87,9 @@ ScreenshotApp::~ScreenshotApp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenshotApp::onTimerTick() {
|
void ScreenshotApp::onTimerTick() {
|
||||||
auto lockable = lvgl::getSyncLock();
|
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
auto lock = lockable->asScopedLock();
|
|
||||||
if (lock.lock(lvgl::defaultLockTime)) {
|
|
||||||
updateScreenshotMode();
|
updateScreenshotMode();
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,10 @@
|
|||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/setup/Setup.h>
|
#include <Tactility/app/setup/Setup.h>
|
||||||
|
|
||||||
#include <Tactility/Preferences.h>
|
#include <Tactility/Preferences.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/app/timezone/TimeZone.h>
|
#include <Tactility/app/timezone/TimeZone.h>
|
||||||
#include <Tactility/app/wifimanage/WifiManage.h>
|
#include <Tactility/app/wifimanage/WifiManage.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|
||||||
#include <Tactility/Paths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <lvgl.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
@ -247,20 +245,18 @@ class SystemInfoApp final : public App {
|
|||||||
Timer memoryTimer = Timer(Timer::Type::Periodic, kernel::millisToTicks(10000), [] {
|
Timer memoryTimer = Timer(Timer::Type::Periodic, kernel::millisToTicks(10000), [] {
|
||||||
auto app = optApp();
|
auto app = optApp();
|
||||||
if (app) {
|
if (app) {
|
||||||
auto lockable = lvgl::getSyncLock();
|
lvgl_lock();
|
||||||
auto lock = lockable->asScopedLock();
|
|
||||||
lock.lock();
|
|
||||||
app->updateMemory();
|
app->updateMemory();
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Timer tasksTimer = Timer(Timer::Type::Periodic, kernel::millisToTicks(15000), [] {
|
Timer tasksTimer = Timer(Timer::Type::Periodic, kernel::millisToTicks(15000), [] {
|
||||||
auto app = optApp();
|
auto app = optApp();
|
||||||
if (app) {
|
if (app) {
|
||||||
auto lockable = lvgl::getSyncLock();
|
lvgl_lock();
|
||||||
auto lock = lockable->asScopedLock();
|
|
||||||
lock.lock();
|
|
||||||
app->updateTasks();
|
app->updateTasks();
|
||||||
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,16 @@
|
|||||||
#include <lvgl/lvgl.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/timezone/TimeZone.h>
|
#include <Tactility/app/timezone/TimeZone.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/settings/SystemSettings.h>
|
#include <Tactility/settings/SystemSettings.h>
|
||||||
#include <Tactility/settings/Time.h>
|
#include <Tactility/settings/Time.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
|
||||||
namespace tt::app::timedatesettings {
|
namespace tt::app::timedatesettings {
|
||||||
|
|
||||||
constexpr auto* TAG = "TimeDate";
|
constexpr auto* TAG = "TimeDate";
|
||||||
|
|||||||
@ -1,21 +1,20 @@
|
|||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <lvgl/fonts.h>
|
|
||||||
|
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/timezone/TimeZone.h>
|
#include <Tactility/app/timezone/TimeZone.h>
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/MountPoints.h>
|
#include <Tactility/MountPoints.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/settings/Time.h>
|
#include <Tactility/settings/Time.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
#include <lvgl/fonts.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace tt::app::timezone {
|
namespace tt::app::timezone {
|
||||||
@ -166,16 +165,16 @@ class TimeZoneApp final : public App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateList() {
|
void updateList() {
|
||||||
if (lvgl::lock(200 / portTICK_PERIOD_MS)) {
|
if (lvgl_try_lock(200 / portTICK_PERIOD_MS)) {
|
||||||
std::string filter = string::lowercase(std::string(lv_textarea_get_text(filterTextareaWidget)));
|
std::string filter = string::lowercase(std::string(lv_textarea_get_text(filterTextareaWidget)));
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
readTimeZones(filter);
|
readTimeZones(filter);
|
||||||
} else {
|
} else {
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "TimeZone LVGL");
|
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "TimeZone LVGL");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lvgl::lock(200 / portTICK_PERIOD_MS)) {
|
if (lvgl_try_lock(200 / portTICK_PERIOD_MS)) {
|
||||||
if (mutex.lock(100 / portTICK_PERIOD_MS)) {
|
if (mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||||
lv_obj_clean(listWidget);
|
lv_obj_clean(listWidget);
|
||||||
|
|
||||||
@ -188,7 +187,7 @@ class TimeZoneApp final : public App {
|
|||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
} else {
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "TimeZone LVGL");
|
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "TimeZone LVGL");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,22 +2,17 @@
|
|||||||
|
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/settings/WebServerSettings.h>
|
#include <Tactility/settings/WebServerSettings.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
|
||||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
|
||||||
#include <Tactility/service/webserver/AssetVersion.h>
|
|
||||||
#include <Tactility/service/webserver/WebServerService.h>
|
|
||||||
#include <Tactility/Assets.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/service/webserver/WebServerService.h>
|
||||||
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
#include <lvgl/icons/shared.h>
|
||||||
#include <lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
#include <tactility/log.h>
|
|
||||||
|
|
||||||
#include <esp_netif.h>
|
#include <esp_netif.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
|
||||||
#include <freertos/timers.h>
|
|
||||||
|
|
||||||
namespace tt::app::webserversettings {
|
namespace tt::app::webserversettings {
|
||||||
|
|
||||||
@ -47,10 +42,9 @@ class WebServerSettingsApp final : public App {
|
|||||||
app->wsSettings.wifiMode = static_cast<settings::webserver::WiFiMode>(index);
|
app->wsSettings.wifiMode = static_cast<settings::webserver::WiFiMode>(index);
|
||||||
app->updated = true;
|
app->updated = true;
|
||||||
app->wifiSettingsChanged = true;
|
app->wifiSettingsChanged = true;
|
||||||
if (lvgl::lock(100)) {
|
lvgl_lock();
|
||||||
app->updateUrlDisplay();
|
app->updateUrlDisplay();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,10 +54,9 @@ class WebServerSettingsApp final : public App {
|
|||||||
getMainDispatcher().dispatch([app, enabled] {
|
getMainDispatcher().dispatch([app, enabled] {
|
||||||
app->wsSettings.webServerEnabled = enabled;
|
app->wsSettings.webServerEnabled = enabled;
|
||||||
app->updated = true;
|
app->updated = true;
|
||||||
if (lvgl::lock(100)) {
|
lvgl_lock();
|
||||||
app->updateUrlDisplay();
|
app->updateUrlDisplay();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
}
|
|
||||||
|
|
||||||
// Apply immediately instead of waiting for app exit
|
// Apply immediately instead of waiting for app exit
|
||||||
const auto copy = app->wsSettings;
|
const auto copy = app->wsSettings;
|
||||||
|
|||||||
@ -1,20 +1,17 @@
|
|||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <Tactility/lvgl/Style.h>
|
#include <Tactility/lvgl/Style.h>
|
||||||
#include <lvgl/widgets/toolbar.h>
|
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
namespace tt::app::wifiapsettings {
|
namespace tt::app::wifiapsettings {
|
||||||
|
|
||||||
constexpr auto* TAG = "WifiApSettings";
|
constexpr auto* TAG = "WifiApSettings";
|
||||||
@ -88,12 +85,9 @@ class WifiApSettings : public App {
|
|||||||
|
|
||||||
void requestViewUpdate() const {
|
void requestViewUpdate() const {
|
||||||
if (viewEnabled) {
|
if (viewEnabled) {
|
||||||
if (lvgl::lock(1000)) {
|
lvgl_lock();
|
||||||
updateViews();
|
updateViews();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
#include <Tactility/app/wificonnect/WifiConnect.h>
|
#include <Tactility/app/wificonnect/WifiConnect.h>
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
namespace tt::app::wificonnect {
|
namespace tt::app::wificonnect {
|
||||||
|
|
||||||
@ -68,12 +66,9 @@ void WifiConnect::unlock() {
|
|||||||
void WifiConnect::requestViewUpdate() {
|
void WifiConnect::requestViewUpdate() {
|
||||||
lock();
|
lock();
|
||||||
if (viewEnabled) {
|
if (viewEnabled) {
|
||||||
if (lvgl::lock(1000)) {
|
lvgl_lock();
|
||||||
view.update();
|
view.update();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
#include <Tactility/app/wifimanage/WifiManagePrivate.h>
|
|
||||||
#include <Tactility/app/wifimanage/View.h>
|
#include <Tactility/app/wifimanage/View.h>
|
||||||
|
#include <Tactility/app/wifimanage/WifiManagePrivate.h>
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
|
||||||
#include <Tactility/app/AppContext.h>
|
#include <Tactility/app/AppContext.h>
|
||||||
#include <Tactility/app/wifiapsettings/WifiApSettings.h>
|
#include <Tactility/app/wifiapsettings/WifiApSettings.h>
|
||||||
#include <Tactility/app/wificonnect/WifiConnect.h>
|
#include <Tactility/app/wificonnect/WifiConnect.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
|
|
||||||
#include <lvgl/icons/shared.h>
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/icons/shared.h>
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
namespace tt::app::wifimanage {
|
namespace tt::app::wifimanage {
|
||||||
|
|
||||||
constexpr auto* TAG = "WifiManage";
|
constexpr auto* TAG = "WifiManage";
|
||||||
@ -65,12 +65,9 @@ void WifiManage::unlock() {
|
|||||||
void WifiManage::requestViewUpdate() {
|
void WifiManage::requestViewUpdate() {
|
||||||
lock();
|
lock();
|
||||||
if (isViewEnabled) {
|
if (isViewEnabled) {
|
||||||
if (lvgl::lock(1000)) {
|
lvgl_lock();
|
||||||
view.update();
|
view.update();
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,8 @@
|
|||||||
#include <Tactility/Assets.h>
|
#include <Tactility/Assets.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/lvgl/Keyboard.h>
|
#include <Tactility/lvgl/Keyboard.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <host/ble_gap.h>
|
#include <host/ble_gap.h>
|
||||||
#include <host/ble_gatt.h>
|
#include <host/ble_gatt.h>
|
||||||
@ -20,8 +21,8 @@
|
|||||||
#include <esp_timer.h>
|
#include <esp_timer.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/queue.h>
|
#include <freertos/queue.h>
|
||||||
#include <lvgl.h>
|
|
||||||
#include <tactility/log.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -226,7 +227,7 @@ static void hidHostHandleMouseReport(const uint8_t* data, uint16_t len) {
|
|||||||
if (hid_host_ctx && hid_host_ctx->mouseIndev == nullptr) {
|
if (hid_host_ctx && hid_host_ctx->mouseIndev == nullptr) {
|
||||||
getMainDispatcher().dispatch([] {
|
getMainDispatcher().dispatch([] {
|
||||||
if (!hid_host_ctx || hid_host_ctx->mouseIndev != nullptr) return;
|
if (!hid_host_ctx || hid_host_ctx->mouseIndev != nullptr) return;
|
||||||
if (!tt::lvgl::lock(1000)) { LOG_W(TAG, "LVGL lock failed for mouse indev"); return; }
|
if (!lvgl_try_lock(1000)) { LOG_W(TAG, "LVGL lock failed for mouse indev"); return; }
|
||||||
auto* ms = lv_indev_create();
|
auto* ms = lv_indev_create();
|
||||||
lv_indev_set_type(ms, LV_INDEV_TYPE_POINTER);
|
lv_indev_set_type(ms, LV_INDEV_TYPE_POINTER);
|
||||||
lv_indev_set_read_cb(ms, hidHostMouseReadCb);
|
lv_indev_set_read_cb(ms, hidHostMouseReadCb);
|
||||||
@ -237,7 +238,7 @@ static void hidHostHandleMouseReport(const uint8_t* data, uint16_t len) {
|
|||||||
lv_indev_set_cursor(ms, cur);
|
lv_indev_set_cursor(ms, cur);
|
||||||
hid_host_ctx->mouseIndev = ms;
|
hid_host_ctx->mouseIndev = ms;
|
||||||
hid_host_ctx->mouseCursor = cur;
|
hid_host_ctx->mouseCursor = cur;
|
||||||
tt::lvgl::unlock();
|
lvgl_unlock();
|
||||||
LOG_I(TAG, "Mouse indev registered");
|
LOG_I(TAG, "Mouse indev registered");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -468,13 +469,13 @@ static void hidHostSubscribeNext(HidHostCtx& ctx) {
|
|||||||
}
|
}
|
||||||
getMainDispatcher().dispatch([] {
|
getMainDispatcher().dispatch([] {
|
||||||
if (!hid_host_ctx || hid_host_ctx->kbIndev != nullptr) return;
|
if (!hid_host_ctx || hid_host_ctx->kbIndev != nullptr) return;
|
||||||
if (!tt::lvgl::lock(1000)) { LOG_W(TAG, "LVGL lock failed for kb indev"); return; }
|
if (!lvgl_try_lock(1000)) { LOG_W(TAG, "LVGL lock failed for kb indev"); return; }
|
||||||
auto* kb = lv_indev_create();
|
auto* kb = lv_indev_create();
|
||||||
lv_indev_set_type(kb, LV_INDEV_TYPE_KEYPAD);
|
lv_indev_set_type(kb, LV_INDEV_TYPE_KEYPAD);
|
||||||
lv_indev_set_read_cb(kb, hidHostKeyboardReadCb);
|
lv_indev_set_read_cb(kb, hidHostKeyboardReadCb);
|
||||||
hid_host_ctx->kbIndev = kb;
|
hid_host_ctx->kbIndev = kb;
|
||||||
tt::lvgl::hardware_keyboard_set_indev(kb);
|
lvgl::hardware_keyboard_set_indev(kb);
|
||||||
tt::lvgl::unlock();
|
lvgl_unlock();
|
||||||
LOG_I(TAG, "Keyboard indev registered");
|
LOG_I(TAG, "Keyboard indev registered");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -694,18 +695,18 @@ static int hidHostGapCb(struct ble_gap_event* event, void* /*arg*/) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getMainDispatcher().dispatch([saved_kb, saved_mouse, saved_cursor, saved_queue] {
|
getMainDispatcher().dispatch([saved_kb, saved_mouse, saved_cursor, saved_queue] {
|
||||||
if (!tt::lvgl::lock(1000)) {
|
if (!lvgl_try_lock(1000)) {
|
||||||
LOG_W(TAG, "Failed to acquire LVGL lock for indev cleanup");
|
LOG_W(TAG, "Failed to acquire LVGL lock for indev cleanup");
|
||||||
if (saved_queue) vQueueDelete(saved_queue);
|
if (saved_queue) vQueueDelete(saved_queue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (saved_kb) {
|
if (saved_kb) {
|
||||||
tt::lvgl::hardware_keyboard_set_indev(nullptr);
|
lvgl::hardware_keyboard_set_indev(nullptr);
|
||||||
lv_indev_delete(saved_kb);
|
lv_indev_delete(saved_kb);
|
||||||
}
|
}
|
||||||
if (saved_mouse) lv_indev_delete(saved_mouse);
|
if (saved_mouse) lv_indev_delete(saved_mouse);
|
||||||
if (saved_cursor) lv_obj_delete(saved_cursor);
|
if (saved_cursor) lv_obj_delete(saved_cursor);
|
||||||
tt::lvgl::unlock();
|
lvgl_unlock();
|
||||||
if (saved_queue) vQueueDelete(saved_queue);
|
if (saved_queue) vQueueDelete(saved_queue);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
|
|
||||||
#include <Tactility/Mutex.h>
|
|
||||||
#include <lvgl/lvgl.h>
|
|
||||||
|
|
||||||
namespace tt::lvgl {
|
|
||||||
|
|
||||||
bool lock(TickType_t timeout) {
|
|
||||||
return lvgl_try_lock(timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unlock() {
|
|
||||||
lvgl_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
class LvglSync : public Lock {
|
|
||||||
public:
|
|
||||||
~LvglSync() override = default;
|
|
||||||
|
|
||||||
bool lock(TickType_t timeoutTicks) const override {
|
|
||||||
return lvgl_try_lock(timeoutTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unlock() const override {
|
|
||||||
lvgl_unlock();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::shared_ptr<Lock> lvglSync = std::make_shared<LvglSync>();
|
|
||||||
|
|
||||||
std::shared_ptr<Lock> getSyncLock() {
|
|
||||||
return lvglSync;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@ -5,17 +5,16 @@
|
|||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Statusbar.h>
|
#include <Tactility/lvgl/Statusbar.h>
|
||||||
#include <Tactility/lvgl/Style.h>
|
#include <Tactility/lvgl/Style.h>
|
||||||
#include <Tactility/settings/Time.h>
|
#include <Tactility/settings/Time.h>
|
||||||
|
|
||||||
#include <lvgl/fonts.h>
|
|
||||||
#include <lvgl/lvgl.h>
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/fonts.h>
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace tt::lvgl {
|
namespace tt::lvgl {
|
||||||
@ -106,10 +105,10 @@ static lv_obj_class_t statusbar_class = {
|
|||||||
|
|
||||||
static void statusbar_pubsub_event(Statusbar* statusbar) {
|
static void statusbar_pubsub_event(Statusbar* statusbar) {
|
||||||
LOG_D(TAG, "Update event");
|
LOG_D(TAG, "Update event");
|
||||||
if (lock(defaultLockTime)) {
|
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||||
update_main(statusbar);
|
update_main(statusbar);
|
||||||
lv_obj_invalidate(&statusbar->obj);
|
lv_obj_invalidate(&statusbar->obj);
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
} else {
|
} else {
|
||||||
LOG_W(TAG, "Mutex acquisition timeout (%s)", "Statusbar");
|
LOG_W(TAG, "Mutex acquisition timeout (%s)", "Statusbar");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <Tactility/Assets.h>
|
#include <Tactility/Assets.h>
|
||||||
#include <Tactility/lvgl/Keyboard.h>
|
#include <Tactility/lvgl/Keyboard.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
#include <tactility/drivers/usb_host_hid.h>
|
#include <tactility/drivers/usb_host_hid.h>
|
||||||
@ -16,7 +14,9 @@
|
|||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
namespace tt::lvgl {
|
namespace tt::lvgl {
|
||||||
|
|
||||||
@ -148,33 +148,31 @@ static void usbHidInputTask(void* arg) {
|
|||||||
auto* ctx = static_cast<UsbHidInputCtx*>(arg);
|
auto* ctx = static_cast<UsbHidInputCtx*>(arg);
|
||||||
LOG_I(TAG, "started");
|
LOG_I(TAG, "started");
|
||||||
|
|
||||||
|
// TODO: Implement time-out
|
||||||
while (!lv_is_initialized()) {
|
while (!lv_is_initialized()) {
|
||||||
vTaskDelay(pdMS_TO_TICKS(100));
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lock()) {
|
lvgl_lock();
|
||||||
ctx->mouse_cursor = lv_image_create(lv_layer_sys());
|
|
||||||
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_CLICKABLE);
|
|
||||||
lv_image_set_src(ctx->mouse_cursor, TT_ASSETS_UI_CURSOR);
|
|
||||||
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
|
|
||||||
ctx->mouse_indev = lv_indev_create();
|
ctx->mouse_cursor = lv_image_create(lv_layer_sys());
|
||||||
lv_indev_set_type(ctx->mouse_indev, LV_INDEV_TYPE_POINTER);
|
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_CLICKABLE);
|
||||||
lv_indev_set_read_cb(ctx->mouse_indev, mouse_read_cb);
|
lv_image_set_src(ctx->mouse_cursor, TT_ASSETS_UI_CURSOR);
|
||||||
lv_indev_set_user_data(ctx->mouse_indev, ctx);
|
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_indev_set_cursor(ctx->mouse_indev, ctx->mouse_cursor);
|
|
||||||
|
|
||||||
ctx->kb_indev = lv_indev_create();
|
ctx->mouse_indev = lv_indev_create();
|
||||||
lv_indev_set_type(ctx->kb_indev, LV_INDEV_TYPE_KEYPAD);
|
lv_indev_set_type(ctx->mouse_indev, LV_INDEV_TYPE_POINTER);
|
||||||
lv_indev_set_read_cb(ctx->kb_indev, keyboard_read_cb);
|
lv_indev_set_read_cb(ctx->mouse_indev, mouse_read_cb);
|
||||||
lv_indev_set_user_data(ctx->kb_indev, ctx);
|
lv_indev_set_user_data(ctx->mouse_indev, ctx);
|
||||||
lv_indev_set_group(ctx->kb_indev, lv_group_get_default());
|
lv_indev_set_cursor(ctx->mouse_indev, ctx->mouse_cursor);
|
||||||
|
|
||||||
unlock();
|
ctx->kb_indev = lv_indev_create();
|
||||||
LOG_I(TAG, "LVGL input devices registered");
|
lv_indev_set_type(ctx->kb_indev, LV_INDEV_TYPE_KEYPAD);
|
||||||
} else {
|
lv_indev_set_read_cb(ctx->kb_indev, keyboard_read_cb);
|
||||||
LOG_W(TAG, "could not acquire LVGL lock for indev registration");
|
lv_indev_set_user_data(ctx->kb_indev, ctx);
|
||||||
}
|
lv_indev_set_group(ctx->kb_indev, lv_group_get_default());
|
||||||
|
|
||||||
|
lvgl_unlock();
|
||||||
|
|
||||||
// Drain the HID event queue and route events to the appropriate destinations
|
// Drain the HID event queue and route events to the appropriate destinations
|
||||||
while (ctx->running) {
|
while (ctx->running) {
|
||||||
@ -228,29 +226,29 @@ static void usbHidInputTask(void* arg) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case USB_HID_EVENT_KEYBOARD_CONNECTED:
|
case USB_HID_EVENT_KEYBOARD_CONNECTED:
|
||||||
if (ctx->kb_indev && lock(pdMS_TO_TICKS(200))) {
|
if (ctx->kb_indev && lvgl_try_lock(pdMS_TO_TICKS(200))) {
|
||||||
hardware_keyboard_set_indev(ctx->kb_indev);
|
hardware_keyboard_set_indev(ctx->kb_indev);
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case USB_HID_EVENT_KEYBOARD_DISCONNECTED:
|
case USB_HID_EVENT_KEYBOARD_DISCONNECTED:
|
||||||
if (lock(pdMS_TO_TICKS(200))) {
|
if (lvgl_try_lock(pdMS_TO_TICKS(200))) {
|
||||||
hardware_keyboard_set_indev(nullptr);
|
hardware_keyboard_set_indev(nullptr);
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case USB_HID_EVENT_MOUSE_CONNECTED:
|
case USB_HID_EVENT_MOUSE_CONNECTED:
|
||||||
ctx->mouse_connected = true;
|
ctx->mouse_connected = true;
|
||||||
if (ctx->mouse_cursor && lock(pdMS_TO_TICKS(200))) {
|
if (ctx->mouse_cursor && lvgl_try_lock(pdMS_TO_TICKS(200))) {
|
||||||
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case USB_HID_EVENT_MOUSE_DISCONNECTED:
|
case USB_HID_EVENT_MOUSE_DISCONNECTED:
|
||||||
ctx->mouse_connected = false;
|
ctx->mouse_connected = false;
|
||||||
if (ctx->mouse_cursor && lock(pdMS_TO_TICKS(200))) {
|
if (ctx->mouse_cursor && lvgl_try_lock(pdMS_TO_TICKS(200))) {
|
||||||
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -258,16 +256,15 @@ static void usbHidInputTask(void* arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lock()) {
|
lvgl_lock();
|
||||||
if (ctx->mouse_indev) { lv_indev_delete(ctx->mouse_indev); ctx->mouse_indev = nullptr; }
|
if (ctx->mouse_indev) { lv_indev_delete(ctx->mouse_indev); ctx->mouse_indev = nullptr; }
|
||||||
if (ctx->mouse_cursor) { lv_obj_delete(ctx->mouse_cursor); ctx->mouse_cursor = nullptr; }
|
if (ctx->mouse_cursor) { lv_obj_delete(ctx->mouse_cursor); ctx->mouse_cursor = nullptr; }
|
||||||
if (ctx->kb_indev) {
|
if (ctx->kb_indev) {
|
||||||
hardware_keyboard_set_indev(nullptr);
|
hardware_keyboard_set_indev(nullptr);
|
||||||
lv_indev_delete(ctx->kb_indev);
|
lv_indev_delete(ctx->kb_indev);
|
||||||
ctx->kb_indev = nullptr;
|
ctx->kb_indev = nullptr;
|
||||||
}
|
|
||||||
unlock();
|
|
||||||
}
|
}
|
||||||
|
lvgl_unlock();
|
||||||
|
|
||||||
LOG_I(TAG, "stopped");
|
LOG_I(TAG, "stopped");
|
||||||
xSemaphoreGive(ctx->task_done);
|
xSemaphoreGive(ctx->task_done);
|
||||||
@ -334,7 +331,7 @@ void stopUsbHidInput() {
|
|||||||
vTaskDelete(ctx->task);
|
vTaskDelete(ctx->task);
|
||||||
// Task was killed before it could clean up LVGL objects; do it here to
|
// Task was killed before it could clean up LVGL objects; do it here to
|
||||||
// prevent mouse_read_cb / keyboard_read_cb from running with a freed ctx.
|
// prevent mouse_read_cb / keyboard_read_cb from running with a freed ctx.
|
||||||
if (lock(pdMS_TO_TICKS(200))) {
|
if (lvgl_try_lock(pdMS_TO_TICKS(200))) {
|
||||||
if (ctx->mouse_indev) { lv_indev_delete(ctx->mouse_indev); ctx->mouse_indev = nullptr; }
|
if (ctx->mouse_indev) { lv_indev_delete(ctx->mouse_indev); ctx->mouse_indev = nullptr; }
|
||||||
if (ctx->mouse_cursor) { lv_obj_delete(ctx->mouse_cursor); ctx->mouse_cursor = nullptr; }
|
if (ctx->mouse_cursor) { lv_obj_delete(ctx->mouse_cursor); ctx->mouse_cursor = nullptr; }
|
||||||
if (ctx->kb_indev) {
|
if (ctx->kb_indev) {
|
||||||
@ -342,7 +339,7 @@ void stopUsbHidInput() {
|
|||||||
lv_indev_delete(ctx->kb_indev);
|
lv_indev_delete(ctx->kb_indev);
|
||||||
ctx->kb_indev = nullptr;
|
ctx->kb_indev = nullptr;
|
||||||
}
|
}
|
||||||
unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx->task = nullptr;
|
ctx->task = nullptr;
|
||||||
|
|||||||
@ -1,19 +1,18 @@
|
|||||||
#include <Tactility/service/gui/GuiService.h>
|
#include <Tactility/service/gui/GuiService.h>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/app/AppInstance.h>
|
#include <Tactility/app/AppInstance.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Statusbar.h>
|
#include <Tactility/lvgl/Statusbar.h>
|
||||||
#include <Tactility/lvgl/UsbHidInput.h>
|
#include <Tactility/lvgl/UsbHidInput.h>
|
||||||
#include <Tactility/service/ServiceRegistration.h>
|
#include <Tactility/service/ServiceRegistration.h>
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace tt::service::gui {
|
namespace tt::service::gui {
|
||||||
|
|
||||||
extern const ServiceManifest manifest;
|
extern const ServiceManifest manifest;
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
#include "Tactility/lvgl/Keyboard.h"
|
#include <Tactility/lvgl/Keyboard.h>
|
||||||
#include "Tactility/lvgl/LvglSync.h"
|
#include <Tactility/service/gui/GuiService.h>
|
||||||
#include "Tactility/service/gui/GuiService.h"
|
|
||||||
|
|
||||||
#include <tactility/check.h>
|
|
||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/service/espnow/EspNowService.h>
|
#include <Tactility/service/espnow/EspNowService.h>
|
||||||
|
|
||||||
|
#include <tactility/check.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
namespace tt::service::gui {
|
namespace tt::service::gui {
|
||||||
|
|
||||||
static void show_keyboard(lv_event_t* event) {
|
static void show_keyboard(lv_event_t* event) {
|
||||||
@ -53,7 +54,7 @@ void GuiService::keyboardAddTextArea(lv_obj_t* textarea) {
|
|||||||
lock();
|
lock();
|
||||||
|
|
||||||
if (isStarted) {
|
if (isStarted) {
|
||||||
check(lvgl::lock(0), "lvgl should already be locked before calling this method");
|
check(lvgl_try_lock(0), "lvgl should already be locked before calling this method");
|
||||||
|
|
||||||
if (softwareKeyboardIsEnabled()) {
|
if (softwareKeyboardIsEnabled()) {
|
||||||
lv_obj_add_event_cb(textarea, show_keyboard, LV_EVENT_FOCUSED, nullptr);
|
lv_obj_add_event_cb(textarea, show_keyboard, LV_EVENT_FOCUSED, nullptr);
|
||||||
@ -66,7 +67,7 @@ void GuiService::keyboardAddTextArea(lv_obj_t* textarea) {
|
|||||||
lvgl::software_keyboard_activate(keyboardGroup);
|
lvgl::software_keyboard_activate(keyboardGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock();
|
unlock();
|
||||||
|
|||||||
@ -5,16 +5,17 @@
|
|||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/CpuAffinity.h>
|
#include <Tactility/CpuAffinity.h>
|
||||||
#include <Tactility/TactilityCore.h>
|
#include <Tactility/TactilityCore.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/service/loader/Loader.h>
|
#include <Tactility/service/loader/Loader.h>
|
||||||
#include <Tactility/service/screenshot/ScreenshotTask.h>
|
#include <Tactility/service/screenshot/ScreenshotTask.h>
|
||||||
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <lv_screenshot.h>
|
#include <lv_screenshot.h>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
|
||||||
|
|
||||||
namespace tt::service::screenshot {
|
namespace tt::service::screenshot {
|
||||||
|
|
||||||
constexpr auto* TAG = "ScreenshotTask";
|
constexpr auto* TAG = "ScreenshotTask";
|
||||||
@ -50,13 +51,13 @@ void ScreenshotTask::setFinished() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void makeScreenshot(const std::string& filename) {
|
static void makeScreenshot(const std::string& filename) {
|
||||||
if (lvgl::lock(50 / portTICK_PERIOD_MS)) {
|
if (lvgl_try_lock(50 / portTICK_PERIOD_MS)) {
|
||||||
if (lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, filename.c_str())) {
|
if (lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, filename.c_str())) {
|
||||||
LOG_I(TAG, "Screenshot saved to %s", filename.c_str());
|
LOG_I(TAG, "Screenshot saved to %s", filename.c_str());
|
||||||
} else {
|
} else {
|
||||||
LOG_E(TAG, "Screenshot not saved to %s", filename.c_str());
|
LOG_E(TAG, "Screenshot not saved to %s", filename.c_str());
|
||||||
}
|
}
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
} else {
|
} else {
|
||||||
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
#include <Tactility/Mutex.h>
|
#include <Tactility/Mutex.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
#include <Tactility/bluetooth/Bluetooth.h>
|
#include <Tactility/bluetooth/Bluetooth.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/service/ServiceContext.h>
|
#include <Tactility/service/ServiceContext.h>
|
||||||
#include <Tactility/service/ServicePaths.h>
|
#include <Tactility/service/ServicePaths.h>
|
||||||
#include <Tactility/service/ServiceRegistration.h>
|
#include <Tactility/service/ServiceRegistration.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
#include <tactility/drivers/bluetooth.h>
|
#include <tactility/drivers/bluetooth.h>
|
||||||
@ -18,7 +18,6 @@
|
|||||||
#include <tactility/drivers/usb_host_midi.h>
|
#include <tactility/drivers/usb_host_midi.h>
|
||||||
#include <tactility/drivers/usb_host_msc.h>
|
#include <tactility/drivers/usb_host_msc.h>
|
||||||
#include <tactility/filesystem/file_system.h>
|
#include <tactility/filesystem/file_system.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <lvgl/icons/statusbar.h>
|
#include <lvgl/icons/statusbar.h>
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
|
||||||
#include <tactility/check.h>
|
|
||||||
#include <Tactility/service/webserver/WebServerService.h>
|
#include <Tactility/service/webserver/WebServerService.h>
|
||||||
#include <Tactility/service/webserver/AssetVersion.h>
|
|
||||||
#include <Tactility/service/ServiceManifest.h>
|
#include <Tactility/service/ServiceManifest.h>
|
||||||
#include <Tactility/settings/WebServerSettings.h>
|
#include <Tactility/settings/WebServerSettings.h>
|
||||||
#include <Tactility/MountPoints.h>
|
#include <Tactility/MountPoints.h>
|
||||||
@ -10,28 +8,29 @@
|
|||||||
#include <Tactility/lvgl/Statusbar.h>
|
#include <Tactility/lvgl/Statusbar.h>
|
||||||
#include <Tactility/Mutex.h>
|
#include <Tactility/Mutex.h>
|
||||||
|
|
||||||
|
#include <tactility/check.h>
|
||||||
|
|
||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/app/AppRegistration.h>
|
#include <Tactility/app/AppRegistration.h>
|
||||||
#include <Tactility/app/AppManifest.h>
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include <Tactility/app/App.h>
|
#include <Tactility/app/App.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
#include <esp_wifi_default.h>
|
|
||||||
#include <Tactility/network/HttpdReq.h>
|
#include <Tactility/network/HttpdReq.h>
|
||||||
#include <Tactility/network/Url.h>
|
#include <Tactility/network/Url.h>
|
||||||
#include <Tactility/Paths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/lvgl/Lvgl.h>
|
#include <Tactility/lvgl/Lvgl.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
|
|
||||||
#include <ranges>
|
|
||||||
#include <tactility/filesystem/file_system.h>
|
#include <tactility/filesystem/file_system.h>
|
||||||
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
#include <lvgl/lvgl.h>
|
||||||
|
#include <lvgl/icons/statusbar.h>
|
||||||
|
|
||||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||||
#include <lv_screenshot.h>
|
#include <lv_screenshot.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <lvgl/icons/statusbar.h>
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
@ -42,16 +41,16 @@
|
|||||||
#include <esp_netif.h>
|
#include <esp_netif.h>
|
||||||
#include <esp_system.h>
|
#include <esp_system.h>
|
||||||
#include <esp_vfs_fat.h>
|
#include <esp_vfs_fat.h>
|
||||||
|
#include <esp_wifi_default.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <lwip/ip4_addr.h>
|
#include <lwip/ip4_addr.h>
|
||||||
#include <mbedtls/base64.h>
|
#include <mbedtls/base64.h>
|
||||||
|
#include <ranges>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
|
||||||
|
|
||||||
namespace tt::service::webserver {
|
namespace tt::service::webserver {
|
||||||
|
|
||||||
constexpr auto* TAG = "WebServerService";
|
constexpr auto* TAG = "WebServerService";
|
||||||
@ -1477,9 +1476,9 @@ esp_err_t WebServerService::handleApiScreenshot(httpd_req_t* request) {
|
|||||||
std::string lvgl_screenshot_path = lvgl::PATH_PREFIX + screenshot_path;
|
std::string lvgl_screenshot_path = lvgl::PATH_PREFIX + screenshot_path;
|
||||||
|
|
||||||
// Capture screenshot using LVGL
|
// Capture screenshot using LVGL
|
||||||
if (lvgl::lock(pdMS_TO_TICKS(100))) {
|
if (lvgl_try_lock(pdMS_TO_TICKS(100))) {
|
||||||
bool success = lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, lvgl_screenshot_path.c_str());
|
bool success = lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, lvgl_screenshot_path.c_str());
|
||||||
lvgl::unlock();
|
lvgl_unlock();
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
LOG_E(TAG, "lv_screenshot_create failed for path: %s", lvgl_screenshot_path.c_str());
|
LOG_E(TAG, "lv_screenshot_create failed for path: %s", lvgl_screenshot_path.c_str());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user