New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
This commit is contained in:
committed by
GitHub
parent
719f7bcece
commit
f620255c41
@@ -2,7 +2,7 @@
|
||||
|
||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/service/screenshot/Screenshot.h>
|
||||
#include <Tactility/service/ServiceRegistration.h>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace tt::service::screenshot {
|
||||
|
||||
constexpr auto* TAG = "ScreenshotService";
|
||||
static const auto LOGGER = Logger("ScreenshotService");
|
||||
|
||||
extern const ServiceManifest manifest;
|
||||
|
||||
@@ -23,7 +23,7 @@ std::shared_ptr<ScreenshotService> _Nullable optScreenshotService() {
|
||||
void ScreenshotService::startApps(const std::string& path) {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ void ScreenshotService::startApps(const std::string& path) {
|
||||
mode = Mode::Apps;
|
||||
task->startApps(path);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "Screenshot task already running");
|
||||
LOGGER.warn("Screenshot task already running");
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenshotService::startTimed(const std::string& path, uint8_t delayInSeconds, uint8_t amount) {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ void ScreenshotService::startTimed(const std::string& path, uint8_t delayInSecon
|
||||
mode = Mode::Timed;
|
||||
task->startTimed(path, delayInSeconds, amount);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "Screenshot task already running");
|
||||
LOGGER.warn("Screenshot task already running");
|
||||
}
|
||||
}
|
||||
|
||||
bool ScreenshotService::onStart(ServiceContext& serviceContext) {
|
||||
if (lv_screen_active() == nullptr) {
|
||||
TT_LOG_E(TAG, "No display found");
|
||||
LOGGER.error("No display found");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ bool ScreenshotService::onStart(ServiceContext& serviceContext) {
|
||||
void ScreenshotService::stop() {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,14 +72,14 @@ void ScreenshotService::stop() {
|
||||
task = nullptr;
|
||||
mode = Mode::None;
|
||||
} else {
|
||||
TT_LOG_W(TAG, "Screenshot task not running");
|
||||
LOGGER.warn("Screenshot task not running");
|
||||
}
|
||||
}
|
||||
|
||||
Mode ScreenshotService::getMode() const {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return Mode::None;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
#include "Tactility/TactilityConfig.h"
|
||||
#include <Tactility/TactilityConfig.h>
|
||||
|
||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||
|
||||
#include "Tactility/service/screenshot/ScreenshotTask.h"
|
||||
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
#include "Tactility/lvgl/LvglSync.h"
|
||||
|
||||
#include <lv_screenshot.h>
|
||||
#include <Tactility/CpuAffinity.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/service/screenshot/ScreenshotTask.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
#include <lv_screenshot.h>
|
||||
|
||||
#include <format>
|
||||
#include <Tactility/CpuAffinity.h>
|
||||
|
||||
namespace tt::service::screenshot {
|
||||
|
||||
#define TAG "screenshot_task"
|
||||
static const auto LOGGER = Logger("ScreenshotTask");
|
||||
|
||||
ScreenshotTask::~ScreenshotTask() {
|
||||
if (thread) {
|
||||
@@ -26,7 +27,7 @@ ScreenshotTask::~ScreenshotTask() {
|
||||
bool ScreenshotTask::isInterrupted() {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return true;
|
||||
}
|
||||
return interrupted;
|
||||
@@ -35,7 +36,7 @@ bool ScreenshotTask::isInterrupted() {
|
||||
bool ScreenshotTask::isFinished() {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return false;
|
||||
}
|
||||
return finished;
|
||||
@@ -50,13 +51,13 @@ void ScreenshotTask::setFinished() {
|
||||
static void makeScreenshot(const std::string& filename) {
|
||||
if (lvgl::lock(50 / portTICK_PERIOD_MS)) {
|
||||
if (lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, filename.c_str())) {
|
||||
TT_LOG_I(TAG, "Screenshot saved to %s", filename.c_str());
|
||||
LOGGER.info("Screenshot saved to {}", filename);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Screenshot not saved to %s", filename.c_str());
|
||||
LOGGER.error("Screenshot not saved to {}", filename);
|
||||
}
|
||||
lvgl::unlock();
|
||||
} else {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ void ScreenshotTask::taskMain() {
|
||||
void ScreenshotTask::taskStart() {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ void ScreenshotTask::taskStart() {
|
||||
void ScreenshotTask::startApps(const std::string& path) {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,14 +133,14 @@ void ScreenshotTask::startApps(const std::string& path) {
|
||||
work.path = path;
|
||||
taskStart();
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Task was already running");
|
||||
LOGGER.error("Task was already running");
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenshotTask::startTimed(const std::string& path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(50 / portTICK_PERIOD_MS)) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ void ScreenshotTask::startTimed(const std::string& path, uint8_t delay_in_second
|
||||
work.path = path;
|
||||
taskStart();
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Task was already running");
|
||||
LOGGER.error("Task was already running");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user