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
@@ -3,7 +3,6 @@
|
||||
#include <Gt911Touch.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <RgbDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 41 and interrupt pin is 40
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <Gt911Touch.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <driver/gpio.h>
|
||||
#include <esp_err.h>
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <esp_lcd_panel_io_additions.h>
|
||||
#include <esp_lcd_st7701.h>
|
||||
|
||||
constexpr auto TAG = "St7701Display";
|
||||
static const auto LOGGER = tt::Logger("St7701Display");
|
||||
|
||||
static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
|
||||
// {cmd, { data }, data_size, delay_ms}
|
||||
@@ -153,28 +153,30 @@ bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
|
||||
};
|
||||
|
||||
if (esp_lcd_new_panel_st7701(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to create panel");
|
||||
LOGGER.error("Failed to create panel");
|
||||
return false;
|
||||
}
|
||||
|
||||
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, false) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to invert color");
|
||||
LOGGER.error("Failed to invert color");
|
||||
return false;
|
||||
}
|
||||
|
||||
esp_lcd_panel_set_gap(panelHandle, 0, 0);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <Gt911Touch.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <RgbDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <Gt911Touch.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <RgbDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <Gt911Touch.h>
|
||||
#include <RgbDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <Gt911Touch.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <RgbDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <ButtonControl.h>
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/i2c.h"
|
||||
#include <Tactility/Log.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
@@ -24,7 +24,7 @@ static void enableOledPower() {
|
||||
gpio_set_level(DISPLAY_PIN_POWER, 0); // Active low
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(500)); // Add a small delay for power to stabilize
|
||||
TT_LOG_I("OLED_POWER", "OLED power enabled");
|
||||
tt::Logger("HeltecV3").info("OLED power enabled");
|
||||
}
|
||||
|
||||
static bool initBoot() {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "Tactility/kernel/SystemEvents.h"
|
||||
#include "Tactility/service/gps/GpsService.h"
|
||||
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <Tactility/hal/gps/GpsConfiguration.h>
|
||||
#include <Tactility/settings/KeyboardSettings.h>
|
||||
|
||||
#include "devices/KeyboardBacklight.h"
|
||||
#include "devices/TrackballDevice.h"
|
||||
#include <KeyboardBacklight/KeyboardBacklight.h>
|
||||
|
||||
#include <Tactility/hal/gps/GpsConfiguration.h>
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
#include <Tactility/settings/KeyboardSettings.h>
|
||||
#include <Trackball/Trackball.h>
|
||||
|
||||
#define TAG "tdeck"
|
||||
#include <KeyboardBacklight/KeyboardBacklight.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("T-Deck");
|
||||
|
||||
// Power on
|
||||
#define TDECK_POWERON_GPIO GPIO_NUM_10
|
||||
constexpr auto TDECK_POWERON_GPIO = GPIO_NUM_10;
|
||||
|
||||
static bool powerOn() {
|
||||
gpio_config_t device_power_signal_config = {
|
||||
@@ -37,9 +38,9 @@ static bool powerOn() {
|
||||
}
|
||||
|
||||
bool initBoot() {
|
||||
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
|
||||
LOGGER.info(LOG_MESSAGE_POWER_ON_START);
|
||||
if (!powerOn()) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_POWER_ON_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_POWER_ON_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ bool initBoot() {
|
||||
* when moving the brightness slider rapidly from a lower setting to 100%.
|
||||
* This is not a slider bug (data was debug-traced) */
|
||||
if (!driver::pwmbacklight::init(GPIO_NUM_42, 30000)) {
|
||||
TT_LOG_E(TAG, "Backlight init failed");
|
||||
LOGGER.error("Backlight init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,9 +59,9 @@ bool initBoot() {
|
||||
gps_service->getGpsConfigurations(gps_configurations);
|
||||
if (gps_configurations.empty()) {
|
||||
if (gps_service->addGpsConfiguration(tt::hal::gps::GpsConfiguration {.uartName = "Grove", .baudRate = 38400, .model = tt::hal::gps::GpsModel::UBLOX10})) {
|
||||
TT_LOG_I(TAG, "Configured internal GPS");
|
||||
LOGGER.info("Configured internal GPS");
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to configure internal GPS");
|
||||
LOGGER.error("Failed to configure internal GPS");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,23 +70,23 @@ bool initBoot() {
|
||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent event) {
|
||||
auto kbBacklight = tt::hal::findDevice("Keyboard Backlight");
|
||||
if (kbBacklight != nullptr) {
|
||||
TT_LOG_I(TAG, "%s starting", kbBacklight->getName().c_str());
|
||||
LOGGER.info("{} starting", kbBacklight->getName());
|
||||
auto kbDevice = std::static_pointer_cast<KeyboardBacklightDevice>(kbBacklight);
|
||||
if (kbDevice->start()) {
|
||||
TT_LOG_I(TAG, "%s started", kbBacklight->getName().c_str());
|
||||
LOGGER.info("{} started", kbBacklight->getName());
|
||||
} else {
|
||||
TT_LOG_E(TAG, "%s start failed", kbBacklight->getName().c_str());
|
||||
LOGGER.error("{} start failed", kbBacklight->getName());
|
||||
}
|
||||
}
|
||||
|
||||
auto trackball = tt::hal::findDevice("Trackball");
|
||||
if (trackball != nullptr) {
|
||||
TT_LOG_I(TAG, "%s starting", trackball->getName().c_str());
|
||||
LOGGER.info("{} starting", trackball->getName());
|
||||
auto tbDevice = std::static_pointer_cast<TrackballDevice>(trackball);
|
||||
if (tbDevice->start()) {
|
||||
TT_LOG_I(TAG, "%s started", trackball->getName().c_str());
|
||||
LOGGER.info("{} started", trackball->getName());
|
||||
} else {
|
||||
TT_LOG_E(TAG, "%s start failed", trackball->getName().c_str());
|
||||
LOGGER.error("{} start failed", trackball->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ bool initBoot() {
|
||||
auto kbSettings = tt::settings::keyboard::loadOrGetDefault();
|
||||
bool result = keyboardbacklight::setBrightness(kbSettings.backlightEnabled ? kbSettings.backlightBrightness : 0);
|
||||
if (!result) {
|
||||
TT_LOG_W(TAG, "Failed to set keyboard backlight brightness");
|
||||
LOGGER.warn("Failed to set keyboard backlight brightness");
|
||||
}
|
||||
|
||||
trackball::setEnabled(kbSettings.trackballEnabled);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "KeyboardBacklight.h"
|
||||
#include <esp_log.h>
|
||||
#include <cstring>
|
||||
|
||||
static const char* TAG = "KeyboardBacklight";
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <esp_log.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("KeyboardBacklight");
|
||||
|
||||
namespace keyboardbacklight {
|
||||
|
||||
@@ -18,16 +21,16 @@ bool init(i2c_port_t i2cPort, uint8_t slaveAddress) {
|
||||
g_i2cPort = i2cPort;
|
||||
g_slaveAddress = slaveAddress;
|
||||
|
||||
ESP_LOGI(TAG, "Keyboard backlight initialized on I2C port %d, address 0x%02X", g_i2cPort, g_slaveAddress);
|
||||
LOGGER.info("Initialized on I2C port {}, address 0x{:02X}", static_cast<int>(g_i2cPort), g_slaveAddress);
|
||||
|
||||
// Set a reasonable default brightness
|
||||
if (!setDefaultBrightness(127)) {
|
||||
ESP_LOGE(TAG, "Failed to set default brightness");
|
||||
LOGGER.error("Failed to set default brightness");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!setBrightness(127)) {
|
||||
ESP_LOGE(TAG, "Failed to set brightness");
|
||||
LOGGER.error("Failed to set brightness");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,7 +39,7 @@ bool init(i2c_port_t i2cPort, uint8_t slaveAddress) {
|
||||
|
||||
bool setBrightness(uint8_t brightness) {
|
||||
if (g_i2cPort >= I2C_NUM_MAX) {
|
||||
ESP_LOGE(TAG, "Keyboard backlight not initialized");
|
||||
LOGGER.error("Not initialized");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +48,7 @@ bool setBrightness(uint8_t brightness) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Setting brightness to %d on I2C port %d, address 0x%02X", brightness, g_i2cPort, g_slaveAddress);
|
||||
LOGGER.info("Setting brightness to {} on I2C port {}, address 0x{:02X}", brightness, static_cast<int>(g_i2cPort), g_slaveAddress);
|
||||
|
||||
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
||||
i2c_master_start(cmd);
|
||||
@@ -59,17 +62,17 @@ bool setBrightness(uint8_t brightness) {
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
g_currentBrightness = brightness;
|
||||
ESP_LOGI(TAG, "Successfully set brightness to %d", brightness);
|
||||
LOGGER.info("Successfully set brightness to {}", brightness);
|
||||
return true;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to set brightness: %s (0x%x)", esp_err_to_name(ret), ret);
|
||||
LOGGER.error("Failed to set brightness: {} (0x{:02X})", esp_err_to_name(ret), ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool setDefaultBrightness(uint8_t brightness) {
|
||||
if (g_i2cPort >= I2C_NUM_MAX) {
|
||||
ESP_LOGE(TAG, "Keyboard backlight not initialized");
|
||||
LOGGER.error("Not initialized");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,17 +92,17 @@ bool setDefaultBrightness(uint8_t brightness) {
|
||||
i2c_cmd_link_delete(cmd);
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
ESP_LOGD(TAG, "Set default brightness to %d", brightness);
|
||||
LOGGER.debug("Set default brightness to {}", brightness);
|
||||
return true;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to set default brightness: %s", esp_err_to_name(ret));
|
||||
LOGGER.error("Failed to set default brightness: {}", esp_err_to_name(ret));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getBrightness() {
|
||||
if (g_i2cPort >= I2C_NUM_MAX) {
|
||||
ESP_LOGE(TAG, "Keyboard backlight not initialized");
|
||||
LOGGER.error("Not initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "Trackball.h"
|
||||
#include <esp_log.h>
|
||||
|
||||
static const char* TAG = "Trackball";
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("Trackball");
|
||||
|
||||
namespace trackball {
|
||||
|
||||
@@ -72,7 +73,7 @@ static void read_cb(lv_indev_t* indev, lv_indev_data_t* data) {
|
||||
|
||||
lv_indev_t* init(const TrackballConfig& config) {
|
||||
if (g_initialized) {
|
||||
ESP_LOGW(TAG, "Trackball already initialized");
|
||||
LOGGER.warn("Already initialized");
|
||||
return g_indev;
|
||||
}
|
||||
|
||||
@@ -109,16 +110,19 @@ lv_indev_t* init(const TrackballConfig& config) {
|
||||
lv_indev_set_type(g_indev, LV_INDEV_TYPE_ENCODER);
|
||||
lv_indev_set_read_cb(g_indev, read_cb);
|
||||
|
||||
if (g_indev) {
|
||||
if (g_indev != nullptr) {
|
||||
g_initialized = true;
|
||||
ESP_LOGI(TAG, "Trackball initialized as encoder (R:%d U:%d L:%d D:%d Click:%d)",
|
||||
config.pinRight, config.pinUp, config.pinLeft, config.pinDown,
|
||||
config.pinClick);
|
||||
return g_indev;
|
||||
LOGGER.info("Initialized as encoder (R:{} U:{} L:{} D:{} Click:{})",
|
||||
static_cast<int>(config.pinRight),
|
||||
static_cast<int>(config.pinUp),
|
||||
static_cast<int>(config.pinLeft),
|
||||
static_cast<int>(config.pinDown),
|
||||
static_cast<int>(config.pinClick));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to register LVGL input device");
|
||||
return nullptr;
|
||||
LOGGER.error("Failed to register LVGL input device");
|
||||
}
|
||||
|
||||
return g_indev;
|
||||
}
|
||||
|
||||
void deinit() {
|
||||
@@ -127,19 +131,19 @@ void deinit() {
|
||||
g_indev = nullptr;
|
||||
}
|
||||
g_initialized = false;
|
||||
ESP_LOGI(TAG, "Trackball deinitialized");
|
||||
LOGGER.info("Deinitialized");
|
||||
}
|
||||
|
||||
void setMovementStep(uint8_t step) {
|
||||
if (step > 0) {
|
||||
g_config.movementStep = step;
|
||||
ESP_LOGD(TAG, "Movement step set to %d", step);
|
||||
LOGGER.debug("Movement step set to {}", step);
|
||||
}
|
||||
}
|
||||
|
||||
void setEnabled(bool enabled) {
|
||||
g_enabled = enabled;
|
||||
ESP_LOGI(TAG, "Trackball %s", enabled ? "enabled" : "disabled");
|
||||
LOGGER.info("{}", enabled ? "Enabled" : "Disabled");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
#include <Tactility/settings/DisplaySettings.h>
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
#include <Tactility/hal/Device.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <KeyboardBacklight/KeyboardBacklight.h>
|
||||
|
||||
using tt::hal::findFirstDevice;
|
||||
|
||||
constexpr auto* TAG = "TdeckKeyboard";
|
||||
static const auto LOGGER = tt::Logger("TdeckKeyboard");
|
||||
|
||||
constexpr auto TDECK_KEYBOARD_I2C_BUS_HANDLE = I2C_NUM_0;
|
||||
constexpr auto TDECK_KEYBOARD_SLAVE_ADDRESS = 0x55;
|
||||
|
||||
@@ -37,11 +39,15 @@ static void keyboard_read_callback(TT_UNUSED lv_indev_t* indev, lv_indev_data_t*
|
||||
|
||||
if (keyboard_i2c_read(&read_buffer)) {
|
||||
if (read_buffer == 0 && read_buffer != last_buffer) {
|
||||
TT_LOG_D(TAG, "Released %d", last_buffer);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("Released {}", last_buffer);
|
||||
}
|
||||
data->key = last_buffer;
|
||||
data->state = LV_INDEV_STATE_RELEASED;
|
||||
} else if (read_buffer != 0) {
|
||||
TT_LOG_D(TAG, "Pressed %d", read_buffer);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("Pressed {}", read_buffer);
|
||||
}
|
||||
data->key = read_buffer;
|
||||
data->state = LV_INDEV_STATE_PRESSED;
|
||||
// TODO: Avoid performance hit by calling loadOrGetDefault() on each key press
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "Tactility/service/gps/GpsService.h"
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
#define TAG "T-Dongle"
|
||||
static const auto LOGGER = tt::Logger("T-Dongle S3");
|
||||
|
||||
bool initBoot() {
|
||||
if (!driver::pwmbacklight::init(GPIO_NUM_38, 12000)) {
|
||||
TT_LOG_E(TAG, "Backlight init failed");
|
||||
LOGGER.error("Backlight init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Bq27220.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
#include <Tactility/hal/gps/GpsConfiguration.h>
|
||||
@@ -8,16 +9,16 @@
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
constexpr auto* TAG = "TLoraPager";
|
||||
static const auto LOGGER = tt::Logger("T-Lora Pager");
|
||||
|
||||
bool tpagerInit() {
|
||||
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
|
||||
LOGGER.info(LOG_MESSAGE_POWER_ON_START);
|
||||
|
||||
/* 32 Khz and higher gives an issue where the screen starts dimming again above 80% brightness
|
||||
* when moving the brightness slider rapidly from a lower setting to 100%.
|
||||
* This is not a slider bug (data was debug-traced) */
|
||||
if (!driver::pwmbacklight::init(GPIO_NUM_42, 30000)) {
|
||||
TT_LOG_E(TAG, "Backlight init failed");
|
||||
LOGGER.error("Backlight init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,9 +45,9 @@ bool tpagerInit() {
|
||||
.baudRate = 38400,
|
||||
.model = tt::hal::gps::GpsModel::UBLOX10
|
||||
})) {
|
||||
TT_LOG_I(TAG, "Configured internal GPS");
|
||||
LOGGER.info("Configured internal GPS");
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to configure internal GPS");
|
||||
LOGGER.error("Failed to configure internal GPS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "TpagerEncoder.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
constexpr auto* TAG = "TpagerEncoder";
|
||||
static const auto LOGGER = tt::Logger("TpagerEncoder");
|
||||
|
||||
constexpr auto ENCODER_A = GPIO_NUM_40;
|
||||
constexpr auto ENCODER_B = GPIO_NUM_41;
|
||||
constexpr auto ENCODER_ENTER = GPIO_NUM_7;
|
||||
@@ -39,7 +40,9 @@ void TpagerEncoder::readCallback(lv_indev_t* indev, lv_indev_data_t* data) {
|
||||
}
|
||||
}
|
||||
|
||||
void TpagerEncoder::initEncoder() {
|
||||
bool TpagerEncoder::initEncoder() {
|
||||
assert(encPcntUnit == nullptr);
|
||||
|
||||
constexpr int LOW_LIMIT = -127;
|
||||
constexpr int HIGH_LIMIT = 126;
|
||||
|
||||
@@ -48,11 +51,15 @@ void TpagerEncoder::initEncoder() {
|
||||
pcnt_unit_config_t unit_config = {
|
||||
.low_limit = LOW_LIMIT,
|
||||
.high_limit = HIGH_LIMIT,
|
||||
.flags = {.accum_count = 1},
|
||||
.intr_priority = 0,
|
||||
.flags = {
|
||||
.accum_count = 1
|
||||
},
|
||||
};
|
||||
|
||||
if (pcnt_new_unit(&unit_config, &encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter intialization failed");
|
||||
LOGGER.error("Pulsecounter initialization failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
pcnt_glitch_filter_config_t filter_config = {
|
||||
@@ -60,17 +67,34 @@ void TpagerEncoder::initEncoder() {
|
||||
};
|
||||
|
||||
if (pcnt_unit_set_glitch_filter(encPcntUnit, &filter_config) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter glitch filter config failed");
|
||||
LOGGER.error("Pulsecounter glitch filter config failed");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
pcnt_chan_config_t chan_1_config = {
|
||||
.edge_gpio_num = ENCODER_B,
|
||||
.level_gpio_num = ENCODER_A,
|
||||
.flags {
|
||||
.invert_edge_input = 0,
|
||||
.invert_level_input = 0,
|
||||
.virt_edge_io_level = 0,
|
||||
.virt_level_io_level = 0,
|
||||
.io_loop_back = 0
|
||||
}
|
||||
};
|
||||
|
||||
pcnt_chan_config_t chan_2_config = {
|
||||
.edge_gpio_num = ENCODER_A,
|
||||
.level_gpio_num = ENCODER_B,
|
||||
.flags {
|
||||
.invert_edge_input = 0,
|
||||
.invert_level_input = 0,
|
||||
.virt_edge_io_level = 0,
|
||||
.virt_level_io_level = 0,
|
||||
.io_loop_back = 0
|
||||
}
|
||||
};
|
||||
|
||||
pcnt_channel_handle_t pcnt_chan_1 = nullptr;
|
||||
@@ -78,37 +102,60 @@ void TpagerEncoder::initEncoder() {
|
||||
|
||||
if ((pcnt_new_channel(encPcntUnit, &chan_1_config, &pcnt_chan_1) != ESP_OK) ||
|
||||
(pcnt_new_channel(encPcntUnit, &chan_2_config, &pcnt_chan_2) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter channel config failed");
|
||||
LOGGER.error("Pulsecounter channel config failed");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Second argument is rising edge, third argument is falling edge
|
||||
if ((pcnt_channel_set_edge_action(pcnt_chan_1, PCNT_CHANNEL_EDGE_ACTION_DECREASE, PCNT_CHANNEL_EDGE_ACTION_INCREASE) != ESP_OK) ||
|
||||
(pcnt_channel_set_edge_action(pcnt_chan_2, PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_DECREASE) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter edge action config failed");
|
||||
LOGGER.error("Pulsecounter edge action config failed");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Second argument is low level, third argument is high level
|
||||
if ((pcnt_channel_set_level_action(pcnt_chan_1, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK) ||
|
||||
(pcnt_channel_set_level_action(pcnt_chan_2, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter level action config failed");
|
||||
LOGGER.error("Pulsecounter level action config failed");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pcnt_unit_add_watch_point(encPcntUnit, LOW_LIMIT) != ESP_OK) ||
|
||||
(pcnt_unit_add_watch_point(encPcntUnit, HIGH_LIMIT) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter watch point config failed");
|
||||
LOGGER.error("Pulsecounter watch point config failed");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pcnt_unit_enable(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be enabled");
|
||||
LOGGER.error("Pulsecounter could not be enabled");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pcnt_unit_clear_count(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be cleared");
|
||||
LOGGER.error("Pulsecounter could not be cleared");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pcnt_unit_start(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be started");
|
||||
LOGGER.error("Pulsecounter could not be started");
|
||||
pcnt_del_unit(encPcntUnit);
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int TpagerEncoder::getEncoderPulses() const {
|
||||
@@ -117,9 +164,29 @@ int TpagerEncoder::getEncoderPulses() const {
|
||||
return pulses;
|
||||
}
|
||||
|
||||
bool TpagerEncoder::deinitEncoder() {
|
||||
assert(encPcntUnit != nullptr);
|
||||
|
||||
if (pcnt_unit_stop(encPcntUnit) != ESP_OK) {
|
||||
LOGGER.warn("Failed to stop encoder");
|
||||
}
|
||||
|
||||
if (pcnt_del_unit(encPcntUnit) != ESP_OK) {
|
||||
LOGGER.warn("Failed to delete encoder");
|
||||
encPcntUnit = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGGER.info("Deinitialized");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TpagerEncoder::startLvgl(lv_display_t* display) {
|
||||
initEncoder();
|
||||
if (encPcntUnit == nullptr && !initEncoder()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gpio_input_enable(ENCODER_ENTER);
|
||||
|
||||
@@ -137,5 +204,10 @@ bool TpagerEncoder::stopLvgl() {
|
||||
lv_indev_delete(encHandle);
|
||||
encHandle = nullptr;
|
||||
|
||||
if (encPcntUnit != nullptr && !deinitEncoder()) {
|
||||
// We're not returning false as LVGL as effectively deinitialized
|
||||
LOGGER.warn("Deinitialization failed");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ class TpagerEncoder final : public tt::hal::encoder::EncoderDevice {
|
||||
lv_indev_t* _Nullable encHandle = nullptr;
|
||||
pcnt_unit_handle_t encPcntUnit = nullptr;
|
||||
|
||||
void initEncoder();
|
||||
bool initEncoder();
|
||||
bool deinitEncoder();
|
||||
|
||||
static void readCallback(lv_indev_t* indev, lv_indev_data_t* data);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "TpagerKeyboard.h"
|
||||
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
constexpr auto* TAG = "TpagerKeyboard";
|
||||
static const auto LOGGER = tt::Logger("TpagerKeyboard");
|
||||
|
||||
constexpr auto BACKLIGHT = GPIO_NUM_46;
|
||||
|
||||
@@ -174,7 +174,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
};
|
||||
|
||||
if (ledc_timer_config(&ledc_timer) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Backlight timer config failed");
|
||||
LOGGER.error("Backlight timer config failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
};
|
||||
|
||||
if (ledc_channel_config(&ledc_channel) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Backlight channel config failed");
|
||||
LOGGER.error("Backlight channel config failed");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -201,7 +201,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
|
||||
bool TpagerKeyboard::setBacklightDuty(uint8_t duty) {
|
||||
if (!backlightOkay) {
|
||||
TT_LOG_E(TAG, "Backlight not ready");
|
||||
LOGGER.error("Backlight not ready");
|
||||
return false;
|
||||
}
|
||||
return (ledc_set_duty(LEDC_LOW_SPEED_MODE, backlightChannel, duty) == ESP_OK) &&
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "TpagerPower.h"
|
||||
|
||||
#include <Bq25896.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
constexpr auto* TAG = "TpagerPower";
|
||||
static const auto LOGGER = tt::Logger("TpagerPower");
|
||||
|
||||
constexpr auto TPAGER_GAUGE_I2C_BUS_HANDLE = I2C_NUM_0;
|
||||
|
||||
@@ -68,7 +68,7 @@ void TpagerPower::powerOff() {
|
||||
});
|
||||
|
||||
if (device == nullptr) {
|
||||
TT_LOG_E(TAG, "BQ25896 not found");
|
||||
LOGGER.error("BQ25896 not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
#include "CardputerPower.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <driver/adc.h>
|
||||
|
||||
constexpr auto* TAG = "CardputerPower";
|
||||
static const auto LOGGER = tt::Logger("CardputerPower");
|
||||
|
||||
bool CardputerPower::adcInitCalibration() {
|
||||
bool calibrated = false;
|
||||
|
||||
esp_err_t efuse_read_result = esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP_FIT);
|
||||
if (efuse_read_result == ESP_ERR_NOT_SUPPORTED) {
|
||||
TT_LOG_W(TAG, "Calibration scheme not supported, skip software calibration");
|
||||
LOGGER.warn("Calibration scheme not supported, skip software calibration");
|
||||
} else if (efuse_read_result == ESP_ERR_INVALID_VERSION) {
|
||||
TT_LOG_W(TAG, "eFuse not burnt, skip software calibration");
|
||||
LOGGER.warn("eFuse not burnt, skip software calibration");
|
||||
} else if (efuse_read_result == ESP_OK) {
|
||||
calibrated = true;
|
||||
TT_LOG_I(TAG, "Calibration success");
|
||||
LOGGER.info("Calibration success");
|
||||
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, static_cast<adc_bits_width_t>(ADC_WIDTH_BIT_DEFAULT), 0, &adcCharacteristics);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "eFuse read failed, skipping calibration");
|
||||
LOGGER.warn("eFuse read failed, skipping calibration");
|
||||
}
|
||||
|
||||
return calibrated;
|
||||
@@ -26,11 +26,11 @@ bool CardputerPower::adcInitCalibration() {
|
||||
|
||||
uint32_t CardputerPower::adcReadValue() const {
|
||||
int adc_raw = adc1_get_raw(ADC1_CHANNEL_9);
|
||||
TT_LOG_D(TAG, "Raw data: %d", adc_raw);
|
||||
LOGGER.debug("Raw data: {}", adc_raw);
|
||||
float voltage;
|
||||
if (calibrated) {
|
||||
voltage = esp_adc_cal_raw_to_voltage(adc_raw, &adcCharacteristics);
|
||||
TT_LOG_D(TAG, "Calibrated data: %d mV", voltage);
|
||||
LOGGER.debug("Calibrated data: {} mV", voltage);
|
||||
} else {
|
||||
voltage = 0.0f;
|
||||
}
|
||||
@@ -42,11 +42,11 @@ bool CardputerPower::ensureInitialized() {
|
||||
calibrated = adcInitCalibration();
|
||||
|
||||
if (adc1_config_width(static_cast<adc_bits_width_t>(ADC_WIDTH_BIT_DEFAULT)) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "ADC1 config width failed");
|
||||
LOGGER.error("ADC1 config width failed");
|
||||
return false;
|
||||
}
|
||||
if (adc1_config_channel_atten(ADC1_CHANNEL_9, ADC_ATTEN_DB_11) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "ADC1 config attenuation failed");
|
||||
LOGGER.error("ADC1 config attenuation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "CardputerKeyboard.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
constexpr auto* TAG = "Keyboard";
|
||||
static const auto LOGGER = tt::Logger("Keyboard");
|
||||
|
||||
bool CardputerKeyboard::startLvgl(lv_display_t* display) {
|
||||
keyboard.init();
|
||||
@@ -56,7 +56,7 @@ void CardputerKeyboard::readCallback(lv_indev_t* indev, lv_indev_data_t* data) {
|
||||
}
|
||||
} else {
|
||||
if (self->keyboard.keysState().del) {
|
||||
TT_LOG_I(TAG, "del");
|
||||
LOGGER.info("del");
|
||||
data->key = LV_KEY_DEL;
|
||||
data->state = LV_INDEV_STATE_PRESSED;
|
||||
} else {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
#include "CardputerPower.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <driver/adc.h>
|
||||
|
||||
constexpr auto* TAG = "CardputerPower";
|
||||
static const auto LOGGER = tt::Logger("CardputerPower");
|
||||
|
||||
bool CardputerPower::adcInitCalibration() {
|
||||
bool calibrated = false;
|
||||
|
||||
esp_err_t efuse_read_result = esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP_FIT);
|
||||
if (efuse_read_result == ESP_ERR_NOT_SUPPORTED) {
|
||||
TT_LOG_W(TAG, "Calibration scheme not supported, skip software calibration");
|
||||
LOGGER.warn("Calibration scheme not supported, skip software calibration");
|
||||
} else if (efuse_read_result == ESP_ERR_INVALID_VERSION) {
|
||||
TT_LOG_W(TAG, "eFuse not burnt, skip software calibration");
|
||||
LOGGER.warn("eFuse not burnt, skip software calibration");
|
||||
} else if (efuse_read_result == ESP_OK) {
|
||||
calibrated = true;
|
||||
TT_LOG_I(TAG, "Calibration success");
|
||||
LOGGER.info("Calibration success");
|
||||
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, static_cast<adc_bits_width_t>(ADC_WIDTH_BIT_DEFAULT), 0, &adcCharacteristics);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "eFuse read failed, skipping calibration");
|
||||
LOGGER.warn("eFuse read failed, skipping calibration");
|
||||
}
|
||||
|
||||
return calibrated;
|
||||
@@ -26,11 +26,11 @@ bool CardputerPower::adcInitCalibration() {
|
||||
|
||||
uint32_t CardputerPower::adcReadValue() const {
|
||||
int adc_raw = adc1_get_raw(ADC1_CHANNEL_9);
|
||||
TT_LOG_D(TAG, "Raw data: %d", adc_raw);
|
||||
LOGGER.debug("Raw data: {}", adc_raw);
|
||||
float voltage;
|
||||
if (calibrated) {
|
||||
voltage = esp_adc_cal_raw_to_voltage(adc_raw, &adcCharacteristics);
|
||||
TT_LOG_D(TAG, "Calibrated data: %d mV", voltage);
|
||||
LOGGER.debug("Calibrated data: {} mV", voltage);
|
||||
} else {
|
||||
voltage = 0.0f;
|
||||
}
|
||||
@@ -42,11 +42,11 @@ bool CardputerPower::ensureInitialized() {
|
||||
calibrated = adcInitCalibration();
|
||||
|
||||
if (adc1_config_width(static_cast<adc_bits_width_t>(ADC_WIDTH_BIT_DEFAULT)) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "ADC1 config width failed");
|
||||
LOGGER.error("ADC1 config width failed");
|
||||
return false;
|
||||
}
|
||||
if (adc1_config_channel_atten(ADC1_CHANNEL_9, ADC_ATTEN_DB_11) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "ADC1 config attenuation failed");
|
||||
LOGGER.error("ADC1 config attenuation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "InitBoot.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
|
||||
constexpr auto* TAG = "CoreS3";
|
||||
static const auto LOGGER = tt::Logger("CoreS3");
|
||||
|
||||
std::shared_ptr<Axp2101> axp2101;
|
||||
std::shared_ptr<Aw9523> aw9523;
|
||||
@@ -13,7 +13,7 @@ std::shared_ptr<Aw9523> aw9523;
|
||||
* and schematic: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/K128%20CoreS3/Sch_M5_CoreS3_v1.0.pdf
|
||||
*/
|
||||
bool initGpioExpander() {
|
||||
TT_LOG_I(TAG, "AW9523 init");
|
||||
LOGGER.info("AW9523 init");
|
||||
|
||||
/**
|
||||
* P0 pins:
|
||||
@@ -58,33 +58,33 @@ bool initGpioExpander() {
|
||||
|
||||
/* AW9523 P0 is in push-pull mode */
|
||||
if (!aw9523->writeCTL(0x10)) {
|
||||
TT_LOG_E(TAG, "AW9523: Failed to set CTL");
|
||||
LOGGER.error("AW9523: Failed to set CTL");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aw9523->writeP0(p0_state)) {
|
||||
TT_LOG_E(TAG, "AW9523: Failed to set P0");
|
||||
LOGGER.error("AW9523: Failed to set P0");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aw9523->writeP1(p1_state)) {
|
||||
TT_LOG_E(TAG, "AW9523: Failed to set P1");
|
||||
LOGGER.error("AW9523: Failed to set P1");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (axp2101->isVBus()) {
|
||||
float voltage = 0.0f;
|
||||
axp2101->getVBusVoltage(voltage);
|
||||
TT_LOG_I(TAG, "AXP2101: VBus at %.2f", voltage);
|
||||
LOGGER.info("AXP2101: VBus at {:.2f}", voltage);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "AXP2101: VBus disabled");
|
||||
LOGGER.warn("AXP2101: VBus disabled");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool initPowerControl() {
|
||||
TT_LOG_I(TAG, "Init power control (AXP2101)");
|
||||
LOGGER.info("Init power control (AXP2101)");
|
||||
|
||||
// Source: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/Power_Class.cpp#L61
|
||||
aw9523->bitOnP1(0b10000000); // SY7088 boost enable
|
||||
@@ -135,16 +135,16 @@ bool initPowerControl() {
|
||||
};
|
||||
|
||||
if (axp2101->setRegisters((uint8_t*)reg_data_array, sizeof(reg_data_array))) {
|
||||
TT_LOG_I(TAG, "AXP2101 initialized with %d registers", sizeof(reg_data_array) / 2);
|
||||
LOGGER.info("AXP2101 initialized with {} registers", sizeof(reg_data_array) / 2);
|
||||
return true;
|
||||
} else {
|
||||
TT_LOG_E(TAG, "AXP2101: Failed to set registers");
|
||||
LOGGER.error("AXP2101: Failed to set registers");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool initBoot() {
|
||||
TT_LOG_I(TAG, "initBoot()");
|
||||
LOGGER.info("initBoot()");
|
||||
|
||||
axp2101 = std::make_shared<Axp2101>(I2C_NUM_0);
|
||||
aw9523 = std::make_shared<Aw9523>(I2C_NUM_0);
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
#include <Axp2101.h>
|
||||
#include <Ft5x06Touch.h>
|
||||
#include <Ili934xDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
|
||||
constexpr auto* TAG = "CoreS3Display";
|
||||
static const auto LOGGER = tt::Logger("CoreS3Display");
|
||||
|
||||
static void setBacklightDuty(uint8_t backlightDuty) {
|
||||
const uint8_t voltage = 20 + ((8 * backlightDuty) / 255); // [0b00000, 0b11100] - under 20 is too dark
|
||||
// TODO: Refactor to use Axp2102 driver subproject. Reference: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/AXP2101_Class.cpp#L42
|
||||
if (!tt::hal::i2c::masterWriteRegister(I2C_NUM_0, AXP2101_ADDRESS, 0x99, &voltage, 1, 1000)) { // Sets DLD01
|
||||
TT_LOG_E(TAG, "Failed to set display backlight voltage");
|
||||
LOGGER.error("Failed to set display backlight voltage");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include "Power.h"
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <St7789Display.h>
|
||||
#include <bitset>
|
||||
|
||||
constexpr auto* TAG = "StickCPlus";
|
||||
static const auto LOGGER = tt::Logger("StickCPlus");
|
||||
|
||||
static void setBacklightOn(bool on) {
|
||||
const auto axp = getAxp192();
|
||||
const auto* driver = axp->getAxp192();
|
||||
uint8_t state;
|
||||
if (axp192_read(driver, AXP192_DCDC13_LDO23_CONTROL, &state) != AXP192_OK) {
|
||||
TT_LOG_I(TAG, "Failed to read LCD brightness state");
|
||||
LOGGER.info("Failed to read LCD brightness state");
|
||||
return;
|
||||
}
|
||||
std::bitset<8> new_state = state;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "LvglTask.h"
|
||||
|
||||
#include <Tactility/Check.h>
|
||||
#include <Tactility/Thread.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#include <Tactility/Check.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
constexpr auto TAG = "lvgl_task";
|
||||
static const auto LOGGER = tt::Logger("LvglTask");
|
||||
|
||||
// Mutex for LVGL drawing
|
||||
static tt::RecursiveMutex lvgl_mutex;
|
||||
@@ -58,7 +58,7 @@ void lvgl_task_interrupt() {
|
||||
}
|
||||
|
||||
void lvgl_task_start() {
|
||||
TT_LOG_I(TAG, "lvgl task starting");
|
||||
LOGGER.info("LVGL task starting");
|
||||
|
||||
tt::lvgl::syncSet(&lvgl_lock, &lvgl_unlock);
|
||||
|
||||
@@ -76,7 +76,7 @@ void lvgl_task_start() {
|
||||
}
|
||||
|
||||
static void lvgl_task(TT_UNUSED void* arg) {
|
||||
TT_LOG_I(TAG, "lvgl task started");
|
||||
LOGGER.info("LVGL task started");
|
||||
|
||||
/** Ideally. the display handle would be created during Simulator.start(),
|
||||
* but somehow that doesn't work. Waiting here from a ThreadFlag when that happens
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#define TAG "freertos"
|
||||
static const auto LOGGER = tt::Logger("FreeRTOS");
|
||||
|
||||
namespace simulator {
|
||||
|
||||
@@ -16,10 +16,10 @@ void setMain(MainFunction newMainFunction) {
|
||||
}
|
||||
|
||||
static void freertosMainTask(TT_UNUSED void* parameter) {
|
||||
TT_LOG_I(TAG, "starting app_main()");
|
||||
LOGGER.info("starting app_main()");
|
||||
assert(simulator::mainFunction);
|
||||
mainFunction();
|
||||
TT_LOG_I(TAG, "returned from app_main()");
|
||||
LOGGER.info("returned from app_main()");
|
||||
vTaskDelete(nullptr);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,8 @@ void freertosMain() {
|
||||
* It allows you to set breakpoints and debug asserts.
|
||||
*/
|
||||
void vAssertCalled(unsigned long line, const char* const file) {
|
||||
static portBASE_TYPE xPrinted = pdFALSE;
|
||||
volatile uint32_t set_to_nonzero_in_debugger_to_continue = 0;
|
||||
|
||||
TT_LOG_E(TAG, "assert triggered at %s:%d", file, line);
|
||||
LOGGER.error("Assert triggered at {}:{}", file, line);
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
// Step out by attaching a debugger and setting set_to_nonzero_in_debugger_to_continue
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "UnPhoneFeatures.h"
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/Preferences.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <esp_sleep.h>
|
||||
|
||||
constexpr auto* TAG = "unPhone";
|
||||
static const auto LOGGER = tt::Logger("unPhone");
|
||||
|
||||
std::shared_ptr<UnPhoneFeatures> unPhoneFeatures;
|
||||
static std::unique_ptr<tt::Thread> powerThread;
|
||||
@@ -46,10 +48,10 @@ public:
|
||||
}
|
||||
|
||||
void printInfo() {
|
||||
TT_LOG_I("TAG", "Device stats:");
|
||||
TT_LOG_I("TAG", " boot: %ld", getValue(bootCountKey));
|
||||
TT_LOG_I("TAG", " power off: %ld", getValue(powerOffCountKey));
|
||||
TT_LOG_I("TAG", " power sleep: %ld", getValue(powerSleepKey));
|
||||
LOGGER.info("Device stats:");
|
||||
LOGGER.info(" boot: {}", getValue(bootCountKey));
|
||||
LOGGER.info(" power off: {}", getValue(powerOffCountKey));
|
||||
LOGGER.info(" power sleep: {}", getValue(powerSleepKey));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,11 +91,11 @@ static void updatePowerSwitch() {
|
||||
if (!unPhoneFeatures->isPowerSwitchOn()) {
|
||||
if (last_state != PowerState::Off) {
|
||||
last_state = PowerState::Off;
|
||||
TT_LOG_W(TAG, "Power off");
|
||||
LOGGER.warn("Power off");
|
||||
}
|
||||
|
||||
if (!unPhoneFeatures->isUsbPowerConnected()) { // and usb unplugged we go into shipping mode
|
||||
TT_LOG_W(TAG, "Shipping mode until USB connects");
|
||||
LOGGER.warn("Shipping mode until USB connects");
|
||||
|
||||
#if DEBUG_POWER_STATES
|
||||
unPhoneFeatures.setExpanderPower(true);
|
||||
@@ -107,7 +109,7 @@ static void updatePowerSwitch() {
|
||||
|
||||
unPhoneFeatures->setShipping(true); // tell BM to stop supplying power until USB connects
|
||||
} else { // When power switch is off, but USB is plugged in, we wait (deep sleep) until USB is unplugged.
|
||||
TT_LOG_W(TAG, "Waiting for USB disconnect to power off");
|
||||
LOGGER.warn("Waiting for USB disconnect to power off");
|
||||
|
||||
#if DEBUG_POWER_STATES
|
||||
powerInfoBuzz(2);
|
||||
@@ -126,7 +128,7 @@ static void updatePowerSwitch() {
|
||||
} else {
|
||||
if (last_state != PowerState::On) {
|
||||
last_state = PowerState::On;
|
||||
TT_LOG_W(TAG, "Power on");
|
||||
LOGGER.warn("Power on");
|
||||
|
||||
#if DEBUG_POWER_STATES
|
||||
powerInfoBuzz(1);
|
||||
@@ -163,7 +165,7 @@ static bool unPhonePowerOn() {
|
||||
unPhoneFeatures = std::make_shared<UnPhoneFeatures>(bq24295);
|
||||
|
||||
if (!unPhoneFeatures->init()) {
|
||||
TT_LOG_E(TAG, "UnPhoneFeatures init failed");
|
||||
LOGGER.error("UnPhoneFeatures init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -183,10 +185,10 @@ static bool unPhonePowerOn() {
|
||||
}
|
||||
|
||||
bool initBoot() {
|
||||
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
|
||||
LOGGER.info(LOG_MESSAGE_POWER_ON_START);
|
||||
|
||||
if (!unPhonePowerOn()) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_POWER_ON_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_POWER_ON_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "UnPhoneFeatures.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/app/App.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <esp_io_expander.h>
|
||||
#include <esp_sleep.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("unPhoneFeatures");
|
||||
|
||||
namespace pin {
|
||||
static const gpio_num_t BUTTON1 = GPIO_NUM_45; // left button
|
||||
static const gpio_num_t BUTTON2 = GPIO_NUM_0; // middle button
|
||||
@@ -27,8 +29,6 @@ namespace expanderpin {
|
||||
static const esp_io_expander_pin_num_t VIBE = IO_EXPANDER_PIN_NUM_7;
|
||||
} // namespace expanderpin
|
||||
|
||||
#define TAG "unhpone_features"
|
||||
|
||||
// TODO: Make part of a new type of UnPhoneFeatures data struct that holds all the thread-related data
|
||||
QueueHandle_t interruptQueue;
|
||||
|
||||
@@ -42,7 +42,7 @@ static int32_t buttonHandlingThreadMain(const bool* interrupted) {
|
||||
while (!*interrupted) {
|
||||
if (xQueueReceive(interruptQueue, &pinNumber, portMAX_DELAY)) {
|
||||
// The buttons might generate more than 1 click because of how they are built
|
||||
TT_LOG_I(TAG, "Pressed button %d", pinNumber);
|
||||
LOGGER.info("Pressed button {}", pinNumber);
|
||||
if (pinNumber == pin::BUTTON1) {
|
||||
tt::app::stop();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ bool UnPhoneFeatures::initPowerSwitch() {
|
||||
};
|
||||
|
||||
if (gpio_config(&config) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Power pin init failed");
|
||||
LOGGER.error("Power pin init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,14 +83,14 @@ bool UnPhoneFeatures::initPowerSwitch() {
|
||||
rtc_gpio_pulldown_en(pin::POWER_SWITCH) == ESP_OK) {
|
||||
return true;
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to set RTC for power switch");
|
||||
LOGGER.error("Failed to set RTC for power switch");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool UnPhoneFeatures::initNavButtons() {
|
||||
if (!initGpioExpander()) {
|
||||
TT_LOG_E(TAG, "GPIO expander init failed");
|
||||
LOGGER.error("GPIO expander init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,17 +125,17 @@ bool UnPhoneFeatures::initNavButtons() {
|
||||
};
|
||||
|
||||
if (gpio_config(&config) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Nav button pin init failed");
|
||||
LOGGER.error("Nav button pin init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
gpio_install_isr_service(0) != ESP_OK ||
|
||||
gpio_isr_handler_add(pin::BUTTON1, navButtonInterruptHandler, (void*)pin::BUTTON1) != ESP_OK ||
|
||||
gpio_isr_handler_add(pin::BUTTON2, navButtonInterruptHandler, (void*)pin::BUTTON2) != ESP_OK ||
|
||||
gpio_isr_handler_add(pin::BUTTON3, navButtonInterruptHandler, (void*)pin::BUTTON3) != ESP_OK
|
||||
gpio_isr_handler_add(pin::BUTTON1, navButtonInterruptHandler, reinterpret_cast<void*>(pin::BUTTON1)) != ESP_OK ||
|
||||
gpio_isr_handler_add(pin::BUTTON2, navButtonInterruptHandler, reinterpret_cast<void*>(pin::BUTTON2)) != ESP_OK ||
|
||||
gpio_isr_handler_add(pin::BUTTON3, navButtonInterruptHandler, reinterpret_cast<void*>(pin::BUTTON3)) != ESP_OK
|
||||
) {
|
||||
TT_LOG_E(TAG, "Nav buttons ISR init failed");
|
||||
LOGGER.error("Nav buttons ISR init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ bool UnPhoneFeatures::initOutputPins() {
|
||||
};
|
||||
|
||||
if (gpio_config(&config) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Output pin init failed");
|
||||
LOGGER.error("Output pin init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ bool UnPhoneFeatures::initGpioExpander() {
|
||||
// ESP_IO_EXPANDER_I2C_TCA9555_ADDRESS_110 corresponds with 0x26 from the docs at
|
||||
// https://gitlab.com/hamishcunningham/unphonelibrary/-/blob/main/unPhone.h?ref_type=heads#L206
|
||||
if (esp_io_expander_new_i2c_tca95xx_16bit(I2C_NUM_0, ESP_IO_EXPANDER_I2C_TCA9555_ADDRESS_110, &ioExpander) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "IO expander init failed");
|
||||
LOGGER.error("IO expander init failed");
|
||||
return false;
|
||||
}
|
||||
assert(ioExpander != nullptr);
|
||||
@@ -201,25 +201,25 @@ bool UnPhoneFeatures::initGpioExpander() {
|
||||
}
|
||||
|
||||
bool UnPhoneFeatures::init() {
|
||||
TT_LOG_I(TAG, "init");
|
||||
LOGGER.info("init");
|
||||
|
||||
if (!initGpioExpander()) {
|
||||
TT_LOG_E(TAG, "GPIO expander init failed");
|
||||
LOGGER.error("GPIO expander init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initNavButtons()) {
|
||||
TT_LOG_E(TAG, "Input pin init failed");
|
||||
LOGGER.error("Input pin init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initOutputPins()) {
|
||||
TT_LOG_E(TAG, "Output pin init failed");
|
||||
LOGGER.error("Output pin init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initPowerSwitch()) {
|
||||
TT_LOG_E(TAG, "Power button init failed");
|
||||
LOGGER.error("Power button init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ void UnPhoneFeatures::printInfo() const {
|
||||
batteryManagement->printInfo();
|
||||
bool backlight_power;
|
||||
const char* backlight_power_state = getBacklightPower(backlight_power) && backlight_power ? "on" : "off";
|
||||
TT_LOG_I(TAG, "Backlight: %s", backlight_power_state);
|
||||
LOGGER.info("Backlight: {}", backlight_power_state);
|
||||
}
|
||||
|
||||
bool UnPhoneFeatures::setRgbLed(bool red, bool green, bool blue) const {
|
||||
@@ -286,11 +286,11 @@ void UnPhoneFeatures::turnPeripheralsOff() const {
|
||||
|
||||
bool UnPhoneFeatures::setShipping(bool on) const {
|
||||
if (on) {
|
||||
TT_LOG_W(TAG, "setShipping: on");
|
||||
LOGGER.warn("setShipping: on");
|
||||
batteryManagement->setWatchDogTimer(Bq24295::WatchDogTimer::Disabled);
|
||||
batteryManagement->setBatFetOn(false);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "setShipping: off");
|
||||
LOGGER.warn("setShipping: off");
|
||||
batteryManagement->setWatchDogTimer(Bq24295::WatchDogTimer::Enabled40s);
|
||||
batteryManagement->setBatFetOn(true);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,19 @@
|
||||
#include "Touch.h"
|
||||
|
||||
#include <UnPhoneFeatures.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <hx8357/disp_spi.h>
|
||||
#include <hx8357/hx8357.h>
|
||||
|
||||
constexpr auto TAG = "Hx8357Display";
|
||||
static const auto LOGGER = tt::Logger("Hx8357Display");
|
||||
|
||||
constexpr auto BUFFER_SIZE = (UNPHONE_LCD_HORIZONTAL_RESOLUTION * UNPHONE_LCD_DRAW_BUFFER_HEIGHT * LV_COLOR_DEPTH / 8);
|
||||
|
||||
extern std::shared_ptr<UnPhoneFeatures> unPhoneFeatures;
|
||||
|
||||
bool Hx8357Display::start() {
|
||||
TT_LOG_I(TAG, "start");
|
||||
LOGGER.info("start");
|
||||
|
||||
disp_spi_add_device(SPI2_HOST);
|
||||
|
||||
@@ -26,16 +27,16 @@ bool Hx8357Display::start() {
|
||||
}
|
||||
|
||||
bool Hx8357Display::stop() {
|
||||
TT_LOG_I(TAG, "stop");
|
||||
LOGGER.info("stop");
|
||||
disp_spi_remove_device();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Hx8357Display::startLvgl() {
|
||||
TT_LOG_I(TAG, "startLvgl");
|
||||
LOGGER.info("startLvgl");
|
||||
|
||||
if (lvglDisplay != nullptr) {
|
||||
TT_LOG_W(TAG, "LVGL was already started");
|
||||
LOGGER.warn("LVGL was already started");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ bool Hx8357Display::startLvgl() {
|
||||
lv_display_set_flush_cb(lvglDisplay, hx8357_flush);
|
||||
|
||||
if (lvglDisplay == nullptr) {
|
||||
TT_LOG_I(TAG, "Failed");
|
||||
LOGGER.info("Failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,10 +74,10 @@ bool Hx8357Display::startLvgl() {
|
||||
}
|
||||
|
||||
bool Hx8357Display::stopLvgl() {
|
||||
TT_LOG_I(TAG, "stopLvgl");
|
||||
LOGGER.info("stopLvgl");
|
||||
|
||||
if (lvglDisplay == nullptr) {
|
||||
TT_LOG_W(TAG, "LVGL was already stopped");
|
||||
LOGGER.warn("LVGL was already stopped");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ bool Hx8357Display::stopLvgl() {
|
||||
|
||||
auto touch_device = getTouchDevice();
|
||||
if (touch_device != nullptr && touch_device->getLvglIndev() != nullptr) {
|
||||
TT_LOG_I(TAG, "Stopping touch device");
|
||||
LOGGER.info("Stopping touch device");
|
||||
touch_device->stopLvgl();
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ bool Hx8357Display::stopLvgl() {
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable Hx8357Display::getTouchDevice() {
|
||||
if (touchDevice == nullptr) {
|
||||
touchDevice = std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(createTouch());
|
||||
TT_LOG_I(TAG, "Created touch device");
|
||||
LOGGER.info("Created touch device");
|
||||
}
|
||||
|
||||
return touchDevice;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "Touch.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
std::shared_ptr<Xpt2046Touch> createTouch() {
|
||||
auto configuration = std::make_unique<Xpt2046Touch::Configuration>(
|
||||
SPI2_HOST,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <driver/ledc.h>
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "Jd9853Display.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <esp_lcd_jd9853.h>
|
||||
#include <esp_lcd_panel_commands.h>
|
||||
#include <esp_lvgl_port.h>
|
||||
|
||||
constexpr const char* TAG = "JD9853";
|
||||
static const auto LOGGER = tt::Logger("JD9853");
|
||||
|
||||
bool Jd9853Display::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
|
||||
const esp_lcd_panel_io_spi_config_t panel_io_config = {
|
||||
@@ -54,42 +54,42 @@ bool Jd9853Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
|
||||
};
|
||||
|
||||
if (esp_lcd_new_panel_jd9853(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to create panel");
|
||||
LOGGER.error("Failed to create panel");
|
||||
return false;
|
||||
}
|
||||
|
||||
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_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;
|
||||
}
|
||||
|
||||
if (esp_lcd_panel_set_gap(panelHandle, 34, 0) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to set panel gap");
|
||||
LOGGER.error("Failed to set panel gap");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,6 +157,6 @@ void Jd9853Display::setGammaCurve(uint8_t index) {
|
||||
};
|
||||
|
||||
if (esp_lcd_panel_io_tx_param(getIoHandle() , LCD_CMD_GAMSET, param, 1) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to set gamma");
|
||||
LOGGER.error("Failed to set gamma");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user