Replaced Logger usage with LOG_x (#548)

This commit is contained in:
Ken Van Hoeylandt
2026-07-04 23:49:19 +02:00
committed by GitHub
parent ecad2248d9
commit 9d5993930d
162 changed files with 1776 additions and 1842 deletions
+23 -23
View File
@@ -3,13 +3,13 @@
#include <Tactility/hal/display/DisplayDevice.h>
#include <Tactility/hal/keyboard/KeyboardDevice.h>
#include <Tactility/hal/touch/TouchDevice.h>
#include <Tactility/Logger.h>
#include <Tactility/lvgl/Keyboard.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/service/ServiceRegistration.h>
#include <Tactility/settings/DisplaySettings.h>
#include <tactility/log.h>
#include <tactility/lvgl_module.h>
#include <tactility/module.h>
@@ -17,26 +17,26 @@
namespace tt::lvgl {
static const auto LOGGER = Logger("LVGL");
constexpr auto* TAG = "LVGL";
bool isStarted() {
return module_is_started(&lvgl_module);
}
void attachDevices() {
LOGGER.info("Adding devices");
LOG_I(TAG, "Adding devices");
auto lock = getSyncLock()->asScopedLock();
lock.lock();
// Start displays (their related touch devices start automatically within)
LOGGER.info("Start displays");
LOG_I(TAG, "Start displays");
auto displays = hal::findDevices<hal::display::DisplayDevice>(hal::Device::Type::Display);
for (const auto& display: displays) {
if (display->supportsLvgl()) {
if (display->startLvgl()) {
LOGGER.info("Started {}", display->getName());
LOG_I(TAG, "Started %s", display->getName().c_str());
auto lvgl_display = display->getLvglDisplay();
assert(lvgl_display != nullptr);
auto settings = settings::display::loadOrGetDefault();
@@ -45,7 +45,7 @@ void attachDevices() {
lv_display_set_rotation(lvgl_display, rotation);
}
} else {
LOGGER.error("Start failed for {}", display->getName());
LOG_E(TAG, "Start failed for %s", display->getName().c_str());
}
}
}
@@ -57,42 +57,42 @@ void attachDevices() {
// Start display-related peripherals
if (primary_display != nullptr) {
LOGGER.info("Start touch devices");
LOG_I(TAG, "Start touch devices");
auto touch_devices = hal::findDevices<hal::touch::TouchDevice>(hal::Device::Type::Touch);
for (const auto& touch_device: touch_devices) {
// Start any touch devices that haven't been started yet
if (touch_device->supportsLvgl() && touch_device->getLvglIndev() == nullptr) {
if (touch_device->startLvgl(primary_display->getLvglDisplay())) {
LOGGER.info("Started {}", touch_device->getName());
LOG_I(TAG, "Started %s", touch_device->getName().c_str());
} else {
LOGGER.error("Start failed for {}", touch_device->getName());
LOG_E(TAG, "Start failed for %s", touch_device->getName().c_str());
}
}
}
// Start keyboards
LOGGER.info("Start keyboards");
LOG_I(TAG, "Start keyboards");
auto keyboards = hal::findDevices<hal::keyboard::KeyboardDevice>(hal::Device::Type::Keyboard);
for (const auto& keyboard: keyboards) {
if (keyboard->isAttached()) {
if (keyboard->startLvgl(primary_display->getLvglDisplay())) {
lv_indev_t* keyboard_indev = keyboard->getLvglIndev();
hardware_keyboard_set_indev(keyboard_indev);
LOGGER.info("Started {}", keyboard->getName());
LOG_I(TAG, "Started %s", keyboard->getName().c_str());
} else {
LOGGER.error("Start failed for {}", keyboard->getName());
LOG_E(TAG, "Start failed for %s", keyboard->getName().c_str());
}
}
}
// Start encoders
LOGGER.info("Start encoders");
LOG_I(TAG, "Start encoders");
auto encoders = hal::findDevices<hal::encoder::EncoderDevice>(hal::Device::Type::Encoder);
for (const auto& encoder: encoders) {
if (encoder->startLvgl(primary_display->getLvglDisplay())) {
LOGGER.info("Started {}", encoder->getName());
LOG_I(TAG, "Started %s", encoder->getName().c_str());
} else {
LOGGER.error("Start failed for {}", encoder->getName());
LOG_E(TAG, "Start failed for %s", encoder->getName().c_str());
}
}
}
@@ -105,7 +105,7 @@ void attachDevices() {
if (service::getState("Gui") == service::State::Stopped) {
service::startService("Gui");
} else {
LOGGER.error("Gui service is not in Stopped state");
LOG_E(TAG, "Gui service is not in Stopped state");
}
}
@@ -115,13 +115,13 @@ void attachDevices() {
if (service::getState("Statusbar") == service::State::Stopped) {
service::startService("Statusbar");
} else {
LOGGER.error("Statusbar service is not in Stopped state");
LOG_E(TAG, "Statusbar service is not in Stopped state");
}
}
}
void detachDevices() {
LOGGER.info("Removing devices");
LOG_I(TAG, "Removing devices");
auto lock = getSyncLock()->asScopedLock();
lock.lock();
@@ -133,7 +133,7 @@ void detachDevices() {
// Stop keyboards
LOGGER.info("Stopping keyboards");
LOG_I(TAG, "Stopping keyboards");
auto keyboards = hal::findDevices<hal::keyboard::KeyboardDevice>(hal::Device::Type::Keyboard);
for (auto keyboard: keyboards) {
if (keyboard->getLvglIndev() != nullptr) {
@@ -143,7 +143,7 @@ void detachDevices() {
// Stop touch
LOGGER.info("Stopping touch");
LOG_I(TAG, "Stopping touch");
// The display generally stops their own touch devices, but we'll clean up anything that didn't
auto touch_devices = hal::findDevices<hal::touch::TouchDevice>(hal::Device::Type::Touch);
for (auto touch_device: touch_devices) {
@@ -154,7 +154,7 @@ void detachDevices() {
// Stop encoders
LOGGER.info("Stopping encoders");
LOG_I(TAG, "Stopping encoders");
// The display generally stops their own touch devices, but we'll clean up anything that didn't
auto encoder_devices = hal::findDevices<hal::encoder::EncoderDevice>(hal::Device::Type::Encoder);
for (auto encoder_device: encoder_devices) {
@@ -164,11 +164,11 @@ void detachDevices() {
}
// Stop displays (and their touch devices)
LOGGER.info("Stopping displays");
LOG_I(TAG, "Stopping displays");
auto displays = hal::findDevices<hal::display::DisplayDevice>(hal::Device::Type::Display);
for (auto display: displays) {
if (display->supportsLvgl() && display->getLvglDisplay() != nullptr && !display->stopLvgl()) {
LOGGER.error("Failed to detach display from LVGL");
LOG_E(TAG, "Failed to detach display from LVGL");
}
}
}