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:
Ken Van Hoeylandt
2026-01-06 22:35:39 +01:00
committed by GitHub
parent 719f7bcece
commit f620255c41
188 changed files with 1973 additions and 1755 deletions
@@ -1,13 +1,13 @@
#include "EspLcdDisplay.h"
#include "EspLcdDisplayDriver.h"
#include <assert.h>
#include <cassert>
#include <esp_lvgl_port_disp.h>
#include <Tactility/Check.h>
#include <Tactility/LogEsp.h>
#include <Tactility/Logger.h>
#include <Tactility/hal/touch/TouchDevice.h>
constexpr const char* TAG = "EspLcdDispDrv";
static const auto LOGGER = tt::Logger("EspLcdDisplay");
EspLcdDisplay::~EspLcdDisplay() {
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
@@ -17,12 +17,12 @@ EspLcdDisplay::~EspLcdDisplay() {
bool EspLcdDisplay::start() {
if (!createIoHandle(ioHandle)) {
TT_LOG_E(TAG, "Failed to create IO handle");
LOGGER.error("Failed to create IO handle");
return false;
}
if (!createPanelHandle(ioHandle, panelHandle)) {
TT_LOG_E(TAG, "Failed to create panel handle");
LOGGER.error("Failed to create panel handle");
esp_lcd_panel_io_del(ioHandle);
return false;
}
@@ -45,7 +45,7 @@ bool EspLcdDisplay::stop() {
}
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
TT_LOG_W(TAG, "DisplayDriver is still in use.");
LOGGER.warn("DisplayDriver is still in use.");
}
return true;
@@ -55,7 +55,7 @@ bool EspLcdDisplay::startLvgl() {
assert(lvglDisplay == nullptr);
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
TT_LOG_W(TAG, "DisplayDriver is still in use.");
LOGGER.warn("DisplayDriver is still in use.");
}
auto lvgl_port_config = getLvglPortDisplayConfig(ioHandle, panelHandle);
+15 -15
View File
@@ -1,13 +1,13 @@
#include "EspLcdDisplayV2.h"
#include "EspLcdDisplayDriver.h"
#include <assert.h>
#include <cassert>
#include <esp_lvgl_port_disp.h>
#include <Tactility/Check.h>
#include <Tactility/LogEsp.h>
#include <Tactility/Logger.h>
#include <Tactility/hal/touch/TouchDevice.h>
constexpr auto* TAG = "EspLcdDispV2";
static const auto LOGGER = tt::Logger("EspLcdDispV2");
inline unsigned int getBufferSize(const std::shared_ptr<EspLcdConfiguration>& configuration) {
if (configuration->bufferSize != DEFAULT_BUFFER_SIZE) {
@@ -25,17 +25,17 @@ EspLcdDisplayV2::~EspLcdDisplayV2() {
bool EspLcdDisplayV2::applyConfiguration() const {
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to reset panel");
LOGGER.error("Failed to reset panel");
return false;
}
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to init panel");
LOGGER.error("Failed to init panel");
return false;
}
if (esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel to invert");
LOGGER.error("Failed to set panel to invert");
return false;
}
@@ -43,27 +43,27 @@ bool EspLcdDisplayV2::applyConfiguration() const {
int gap_x = configuration->swapXY ? configuration->gapY : configuration->gapX;
int gap_y = configuration->swapXY ? configuration->gapX : configuration->gapY;
if (esp_lcd_panel_set_gap(panelHandle, gap_x, gap_y) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel gap");
LOGGER.error("Failed to set panel gap");
return false;
}
if (esp_lcd_panel_swap_xy(panelHandle, configuration->swapXY) != ESP_OK) {
TT_LOG_E(TAG, "Failed to swap XY ");
LOGGER.error("Failed to swap XY ");
return false;
}
if (esp_lcd_panel_mirror(panelHandle, configuration->mirrorX, configuration->mirrorY) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel to mirror");
LOGGER.error("Failed to set panel to mirror");
return false;
}
if (esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel to invert");
LOGGER.error("Failed to set panel to invert");
return false;
}
if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
TT_LOG_E(TAG, "Failed to turn display on");
LOGGER.error("Failed to turn display on");
return false;
}
@@ -72,14 +72,14 @@ bool EspLcdDisplayV2::applyConfiguration() const {
bool EspLcdDisplayV2::start() {
if (!createIoHandle(ioHandle)) {
TT_LOG_E(TAG, "Failed to create IO handle");
LOGGER.error("Failed to create IO handle");
return false;
}
esp_lcd_panel_dev_config_t panel_config = createPanelConfig(configuration, configuration->resetPin);
if (!createPanelHandle(ioHandle, panel_config, panelHandle)) {
TT_LOG_E(TAG, "Failed to create panel handle");
LOGGER.error("Failed to create panel handle");
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
return false;
@@ -111,7 +111,7 @@ bool EspLcdDisplayV2::stop() {
}
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
TT_LOG_W(TAG, "DisplayDriver is still in use.");
LOGGER.warn("DisplayDriver is still in use.");
}
return true;
@@ -121,7 +121,7 @@ bool EspLcdDisplayV2::startLvgl() {
assert(lvglDisplay == nullptr);
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
TT_LOG_W(TAG, "DisplayDriver is still in use.");
LOGGER.warn("DisplayDriver is still in use.");
}
auto lvgl_port_config = getLvglPortDisplayConfig(configuration, ioHandle, panelHandle);
@@ -1,12 +1,12 @@
#include "EspLcdSpiDisplay.h"
#include <esp_lcd_panel_commands.h>
#include <Tactility/LogEsp.h>
#include <Tactility/Logger.h>
constexpr auto* TAG = "EspLcdSpiDsp";
static const auto LOGGER = tt::Logger("EspLcdSpiDisplay");
bool EspLcdSpiDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
TT_LOG_I(TAG, "createIoHandle");
LOGGER.info("createIoHandle");
const esp_lcd_panel_io_spi_config_t panel_io_config = {
.cs_gpio_num = spiConfiguration->csPin,
@@ -33,7 +33,7 @@ bool EspLcdSpiDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
};
if (esp_lcd_new_panel_io_spi(spiConfiguration->spiHostDevice, &panel_io_config, &outHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to create panel");
LOGGER.error("Failed to create panel");
return false;
}
@@ -65,6 +65,6 @@ void EspLcdSpiDisplay::setGammaCurve(uint8_t index) {
auto io_handle = getIoHandle();
assert(io_handle != nullptr);
if (esp_lcd_panel_io_tx_param(io_handle, LCD_CMD_GAMSET, param, 1) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set gamma");
LOGGER.error("Failed to set gamma");
}
}
+10 -9
View File
@@ -1,21 +1,22 @@
#include "EspLcdTouch.h"
#include <EspLcdTouchDriver.h>
#include <esp_lvgl_port_touch.h>
#include <Tactility/LogEsp.h>
constexpr const char* TAG = "EspLcdTouch";
#include <EspLcdTouchDriver.h>
#include <Tactility/Logger.h>
#include <esp_lvgl_port_touch.h>
static const auto LOGGER = tt::Logger("EspLcdTouch");
bool EspLcdTouch::start() {
if (!createIoHandle(ioHandle) != ESP_OK) {
TT_LOG_E(TAG, "Touch IO failed");
LOGGER.error("Touch IO failed");
return false;
}
config = createEspLcdTouchConfig();
if (!createTouchHandle(ioHandle, config, touchHandle)) {
TT_LOG_E(TAG, "Driver init failed");
LOGGER.error("Driver init failed");
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
return false;
@@ -48,7 +49,7 @@ bool EspLcdTouch::startLvgl(lv_disp_t* display) {
}
if (touchDriver != nullptr && touchDriver.use_count() > 1) {
TT_LOG_W(TAG, "TouchDriver is still in use.");
LOGGER.warn("TouchDriver is still in use.");
}
const lvgl_port_touch_cfg_t touch_cfg = {
@@ -56,10 +57,10 @@ bool EspLcdTouch::startLvgl(lv_disp_t* display) {
.handle = touchHandle,
};
TT_LOG_I(TAG, "Adding touch to LVGL");
LOGGER.info("Adding touch to LVGL");
lvglDevice = lvgl_port_add_touch(&touch_cfg);
if (lvglDevice == nullptr) {
TT_LOG_E(TAG, "Adding touch failed");
LOGGER.error("Adding touch failed");
return false;
}
@@ -1,12 +1,12 @@
#include "EspLcdTouchDriver.h"
#include <Tactility/LogEsp.h>
#include <Tactility/Logger.h>
constexpr const char* TAG = "EspLcdTouchDriver";
static const auto LOGGER = tt::Logger("EspLcdTouchDriver");
bool EspLcdTouchDriver::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) {
if (esp_lcd_touch_read_data(handle) != ESP_OK) {
TT_LOG_E(TAG, "Read data failed");
LOGGER.error("Read data failed");
return false;
}
return esp_lcd_touch_get_coordinates(handle, x, y, strength, pointCount, maxPointCount);