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,5 +1,5 @@
#include "St7796i8080Display.h"
#include <Tactility/Log.h>
#include <Tactility/Logger.h>
#include <driver/gpio.h>
#include <esp_lcd_panel_io.h>
#include <esp_lcd_panel_ops.h>
@@ -8,7 +8,7 @@
#include <freertos/task.h>
#include <lvgl.h>
constexpr auto TAG = "St7796i8080Display";
static const auto LOGGER = tt::Logger("St7796i8080Display");
static St7796i8080Display* g_display_instance = nullptr;
St7796i8080Display::St7796i8080Display(const Configuration& config)
@@ -16,13 +16,13 @@ St7796i8080Display::St7796i8080Display(const Configuration& config)
// Validate configuration
if (!configuration.isValid()) {
TT_LOG_E(TAG, "Invalid configuration: resolution must be set");
LOGGER.error("Invalid configuration: resolution must be set");
return;
}
}
bool St7796i8080Display::createI80Bus() {
TT_LOG_I(TAG, "Creating I80 bus");
LOGGER.info("Creating I80 bus");
// Create I80 bus configuration
esp_lcd_i80_bus_config_t bus_cfg = {
@@ -42,7 +42,7 @@ bool St7796i8080Display::createI80Bus() {
};
if (esp_lcd_new_i80_bus(&bus_cfg, &i80BusHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to create I80 bus");
LOGGER.error("Failed to create I80 bus");
return false;
}
@@ -50,7 +50,7 @@ bool St7796i8080Display::createI80Bus() {
}
bool St7796i8080Display::createPanelIO() {
TT_LOG_I(TAG, "Creating panel IO");
LOGGER.info("Creating panel IO");
// Create panel IO
esp_lcd_panel_io_i80_config_t io_cfg = {
@@ -77,7 +77,7 @@ bool St7796i8080Display::createPanelIO() {
};
if (esp_lcd_new_panel_io_i80(i80BusHandle, &io_cfg, &ioHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to create panel");
LOGGER.error("Failed to create panel");
return false;
}
@@ -85,7 +85,7 @@ bool St7796i8080Display::createPanelIO() {
}
bool St7796i8080Display::createPanel() {
TT_LOG_I(TAG, "Configuring panel");
LOGGER.info("Configuring panel");
// Create ST7796 panel
esp_lcd_panel_dev_config_t panel_config = {
@@ -100,43 +100,43 @@ bool St7796i8080Display::createPanel() {
};
if (esp_lcd_new_panel_st7796(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to create panel");
LOGGER.error("Failed to create panel");
return false;
}
// Reset panel
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to reset panel");
LOGGER.error("Failed to reset panel");
return false;
}
// Initialize panel
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
TT_LOG_E(TAG, "Failed to init panel");
LOGGER.error("Failed to init panel");
return false;
}
// Set swap XY
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;
}
// Set mirror
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;
}
// Set inversion
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;
}
// Turn on display
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;
}
@@ -144,7 +144,7 @@ bool St7796i8080Display::createPanel() {
}
bool St7796i8080Display::start() {
TT_LOG_I(TAG, "Initializing I8080 ST7796 Display hardware...");
LOGGER.info("Initializing I8080 ST7796 Display hardware...");
// Calculate buffer size if needed
configuration.calculateBufferSize();
@@ -153,7 +153,7 @@ bool St7796i8080Display::start() {
size_t buffer_size = configuration.bufferSize * LV_COLOR_FORMAT_GET_SIZE(LV_COLOR_FORMAT_RGB565);
displayBuffer = (uint8_t*)heap_caps_malloc(buffer_size, MALLOC_CAP_DMA);
if (!displayBuffer) {
TT_LOG_E(TAG, "Failed to allocate display buffer");
LOGGER.error("Failed to allocate display buffer");
return false;
}
@@ -175,7 +175,7 @@ bool St7796i8080Display::start() {
return false;
}
TT_LOG_I(TAG, "Display hardware initialized");
LOGGER.info("Display hardware initialized");
return true;
}
@@ -214,17 +214,17 @@ bool St7796i8080Display::stop() {
}
bool St7796i8080Display::startLvgl() {
TT_LOG_I(TAG, "Initializing LVGL for ST7796 display");
LOGGER.info("Initializing LVGL for ST7796 display");
// Don't reinitialize hardware if it's already done
if (!ioHandle) {
TT_LOG_I(TAG, "Hardware not initialized, calling start()");
LOGGER.info("Hardware not initialized, calling start()");
if (!start()) {
TT_LOG_E(TAG, "Hardware initialization failed");
LOGGER.error("Hardware initialization failed");
return false;
}
} else {
TT_LOG_I(TAG, "Hardware already initialized, skipping");
LOGGER.info("Hardware already initialized, skipping");
}
// Create LVGL display using lvgl_port
@@ -257,12 +257,12 @@ bool St7796i8080Display::startLvgl() {
// Create the LVGL display
lvglDisplay = lvgl_port_add_disp(&display_cfg);
if (!lvglDisplay) {
TT_LOG_E(TAG, "Failed to create LVGL display");
LOGGER.error("Failed to create LVGL display");
return false;
}
g_display_instance = this;
TT_LOG_I(TAG, "LVGL display created successfully");
LOGGER.info("LVGL display created successfully");
return true;
}