Skip to content

Commit 31b8fb8

Browse files
Updates and fixes
1 parent 2284fb8 commit 31b8fb8

8 files changed

Lines changed: 48 additions & 39 deletions

File tree

Devices/cyd-4848s040c/Source/devices/St7701Display.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <Gt911Touch.h>
44
#include <PwmBacklight.h>
5-
#include <Tactility/Log.h>
5+
#include <Tactility/Logger.h>
66

77
#include <driver/gpio.h>
88
#include <esp_err.h>
@@ -11,7 +11,7 @@
1111
#include <esp_lcd_panel_io_additions.h>
1212
#include <esp_lcd_st7701.h>
1313

14-
constexpr auto TAG = "St7701Display";
14+
static const auto LOGGER = Logger("St7701Display");
1515

1616
static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
1717
// {cmd, { data }, data_size, delay_ms}
@@ -153,28 +153,28 @@ bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
153153
};
154154

155155
if (esp_lcd_new_panel_st7701(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
156-
TT_LOG_E(TAG, "Failed to create panel");
156+
LOGGER.error("Failed to create panel");
157157
return false;
158158
}
159159

160160
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
161-
TT_LOG_E(TAG, "Failed to reset panel");
161+
LOGGER.error("Failed to reset panel");
162162
return false;
163163
}
164164

165165
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
166-
TT_LOG_E(TAG, "Failed to init panel");
166+
LOGGER.error("Failed to init panel");
167167
return false;
168168
}
169169

170170
if (esp_lcd_panel_invert_color(panelHandle, false) != ESP_OK) {
171-
TT_LOG_E(TAG, "Failed to invert color");
171+
LOGGER.error("Failed to invert color");
172172
}
173173

174174
esp_lcd_panel_set_gap(panelHandle, 0, 0);
175175

176176
if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
177-
TT_LOG_E(TAG, "Failed to turn display on");
177+
LOGGER.error("Failed to turn display on");
178178
}
179179

180180
return true;

Devices/heltec-wifi-lora-32-v3/Source/Configuration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#include <Tactility/hal/Configuration.h>
66
#include <Tactility/lvgl/LvglSync.h>
7+
#include <Tactility/Logger.h>
78
#include <ButtonControl.h>
89

910
#include "driver/gpio.h"
1011
#include "driver/i2c.h"
11-
#include <Tactility/Log.h>
1212
#include "freertos/FreeRTOS.h"
1313
#include "freertos/task.h"
1414

@@ -24,7 +24,7 @@ static void enableOledPower() {
2424
gpio_set_level(DISPLAY_PIN_POWER, 0); // Active low
2525

2626
vTaskDelay(pdMS_TO_TICKS(500)); // Add a small delay for power to stabilize
27-
TT_LOG_I("OLED_POWER", "OLED power enabled");
27+
Logger("HeltecV3").info("OLED power enabled");
2828
}
2929

3030
static bool initBoot() {

Devices/lilygo-tdeck/Source/devices/TdeckKeyboard.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
#include <Tactility/settings/DisplaySettings.h>
77
#include <Tactility/hal/display/DisplayDevice.h>
88
#include <Tactility/hal/Device.h>
9+
#include <Tactility/Logger.h>
910
#include <KeyboardBacklight/KeyboardBacklight.h>
1011

1112
using tt::hal::findFirstDevice;
1213

13-
constexpr auto* TAG = "TdeckKeyboard";
14+
static const auto LOGGER = tt::Logger("TdeckKeyboard");
15+
1416
constexpr auto TDECK_KEYBOARD_I2C_BUS_HANDLE = I2C_NUM_0;
1517
constexpr auto TDECK_KEYBOARD_SLAVE_ADDRESS = 0x55;
1618

@@ -37,11 +39,15 @@ static void keyboard_read_callback(TT_UNUSED lv_indev_t* indev, lv_indev_data_t*
3739

3840
if (keyboard_i2c_read(&read_buffer)) {
3941
if (read_buffer == 0 && read_buffer != last_buffer) {
40-
TT_LOG_D(TAG, "Released %d", last_buffer);
42+
if (LOGGER.isLoggingDebug()) {
43+
LOGGER.debug("Released {}", last_buffer);
44+
}
4145
data->key = last_buffer;
4246
data->state = LV_INDEV_STATE_RELEASED;
4347
} else if (read_buffer != 0) {
44-
TT_LOG_D(TAG, "Pressed %d", read_buffer);
48+
if (LOGGER.isLoggingDebug()) {
49+
LOGGER.debug("Pressed {}", read_buffer);
50+
}
4551
data->key = read_buffer;
4652
data->state = LV_INDEV_STATE_PRESSED;
4753
// TODO: Avoid performance hit by calling loadOrGetDefault() on each key press

Devices/lilygo-tdongle-s3/Source/Init.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include "PwmBacklight.h"
2-
#include "Tactility/service/gps/GpsService.h"
32

3+
#include <Tactility/Logger.h>
4+
#include <Tactility/service/gps/GpsService.h>
45
#include <Tactility/TactilityCore.h>
56

6-
#define TAG "T-Dongle"
7+
static const auto LOGGER = tt::Logger("T-Dongle S3");
78

89
bool initBoot() {
910
if (!driver::pwmbacklight::init(GPIO_NUM_38, 12000)) {
10-
TT_LOG_E(TAG, "Backlight init failed");
11+
LOGGER.error("Backlight init failed");
1112
return false;
1213
}
1314

Devices/lilygo-tlora-pager/Source/Init.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <Bq27220.h>
22
#include <Tactility/TactilityCore.h>
3+
#include <Tactility/Logger.h>
34
#include <Tactility/kernel/SystemEvents.h>
45
#include <Tactility/service/gps/GpsService.h>
56
#include <Tactility/hal/gps/GpsConfiguration.h>
@@ -8,16 +9,16 @@
89

910
#include <PwmBacklight.h>
1011

11-
constexpr auto* TAG = "TLoraPager";
12+
static const auto LOGGER = tt::Logger("T-Lora Pager");
1213

1314
bool tpagerInit() {
14-
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
15+
LOGGER.info(LOG_MESSAGE_POWER_ON_START);
1516

1617
/* 32 Khz and higher gives an issue where the screen starts dimming again above 80% brightness
1718
* when moving the brightness slider rapidly from a lower setting to 100%.
1819
* This is not a slider bug (data was debug-traced) */
1920
if (!driver::pwmbacklight::init(GPIO_NUM_42, 30000)) {
20-
TT_LOG_E(TAG, "Backlight init failed");
21+
LOGGER.error("Backlight init failed");
2122
return false;
2223
}
2324

@@ -44,9 +45,9 @@ bool tpagerInit() {
4445
.baudRate = 38400,
4546
.model = tt::hal::gps::GpsModel::UBLOX10
4647
})) {
47-
TT_LOG_I(TAG, "Configured internal GPS");
48+
LOGGER.info("Configured internal GPS");
4849
} else {
49-
TT_LOG_E(TAG, "Failed to configure internal GPS");
50+
LOGGER.error("Failed to configure internal GPS");
5051
}
5152
}
5253
}

Devices/lilygo-tlora-pager/Source/devices/TpagerEncoder.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#include "TpagerEncoder.h"
22

3-
#include <Tactility/Log.h>
3+
#include <Tactility/Logger.h>
44
#include <driver/gpio.h>
55

6-
constexpr auto* TAG = "TpagerEncoder";
6+
static const auto LOGGER = tt::Logger("TpagerEncoder");
7+
78
constexpr auto ENCODER_A = GPIO_NUM_40;
89
constexpr auto ENCODER_B = GPIO_NUM_41;
910
constexpr auto ENCODER_ENTER = GPIO_NUM_7;
@@ -52,15 +53,15 @@ void TpagerEncoder::initEncoder() {
5253
};
5354

5455
if (pcnt_new_unit(&unit_config, &encPcntUnit) != ESP_OK) {
55-
TT_LOG_E(TAG, "Pulsecounter intialization failed");
56+
LOGGER.error("Pulsecounter intialization failed");
5657
}
5758

5859
pcnt_glitch_filter_config_t filter_config = {
5960
.max_glitch_ns = 1000,
6061
};
6162

6263
if (pcnt_unit_set_glitch_filter(encPcntUnit, &filter_config) != ESP_OK) {
63-
TT_LOG_E(TAG, "Pulsecounter glitch filter config failed");
64+
LOGGER.error("Pulsecounter glitch filter config failed");
6465
}
6566

6667
pcnt_chan_config_t chan_1_config = {
@@ -78,36 +79,36 @@ void TpagerEncoder::initEncoder() {
7879

7980
if ((pcnt_new_channel(encPcntUnit, &chan_1_config, &pcnt_chan_1) != ESP_OK) ||
8081
(pcnt_new_channel(encPcntUnit, &chan_2_config, &pcnt_chan_2) != ESP_OK)) {
81-
TT_LOG_E(TAG, "Pulsecounter channel config failed");
82+
LOGGER.error("Pulsecounter channel config failed");
8283
}
8384

8485
// Second argument is rising edge, third argument is falling edge
8586
if ((pcnt_channel_set_edge_action(pcnt_chan_1, PCNT_CHANNEL_EDGE_ACTION_DECREASE, PCNT_CHANNEL_EDGE_ACTION_INCREASE) != ESP_OK) ||
8687
(pcnt_channel_set_edge_action(pcnt_chan_2, PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_DECREASE) != ESP_OK)) {
87-
TT_LOG_E(TAG, "Pulsecounter edge action config failed");
88+
LOGGER.error("Pulsecounter edge action config failed");
8889
}
8990

9091
// Second argument is low level, third argument is high level
9192
if ((pcnt_channel_set_level_action(pcnt_chan_1, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK) ||
9293
(pcnt_channel_set_level_action(pcnt_chan_2, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK)) {
93-
TT_LOG_E(TAG, "Pulsecounter level action config failed");
94+
LOGGER.error("Pulsecounter level action config failed");
9495
}
9596

9697
if ((pcnt_unit_add_watch_point(encPcntUnit, LOW_LIMIT) != ESP_OK) ||
9798
(pcnt_unit_add_watch_point(encPcntUnit, HIGH_LIMIT) != ESP_OK)) {
98-
TT_LOG_E(TAG, "Pulsecounter watch point config failed");
99+
LOGGER.error("Pulsecounter watch point config failed");
99100
}
100101

101102
if (pcnt_unit_enable(encPcntUnit) != ESP_OK) {
102-
TT_LOG_E(TAG, "Pulsecounter could not be enabled");
103+
LOGGER.error("Pulsecounter could not be enabled");
103104
}
104105

105106
if (pcnt_unit_clear_count(encPcntUnit) != ESP_OK) {
106-
TT_LOG_E(TAG, "Pulsecounter could not be cleared");
107+
LOGGER.error("Pulsecounter could not be cleared");
107108
}
108109

109110
if (pcnt_unit_start(encPcntUnit) != ESP_OK) {
110-
TT_LOG_E(TAG, "Pulsecounter could not be started");
111+
LOGGER.error("Pulsecounter could not be started");
111112
}
112113
}
113114

Devices/lilygo-tlora-pager/Source/devices/TpagerKeyboard.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "TpagerKeyboard.h"
22

33
#include <Tactility/hal/i2c/I2c.h>
4-
#include <Tactility/Log.h>
4+
#include <Tactility/Logger.h>
55

66
#include <driver/i2c.h>
77
#include <driver/gpio.h>
88

9-
constexpr auto* TAG = "TpagerKeyboard";
9+
static const auto LOGGER = tt::Logger("TpagerKeyboard");
1010

1111
constexpr auto BACKLIGHT = GPIO_NUM_46;
1212

@@ -174,7 +174,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
174174
};
175175

176176
if (ledc_timer_config(&ledc_timer) != ESP_OK) {
177-
TT_LOG_E(TAG, "Backlight timer config failed");
177+
LOGGER.error("Backlight timer config failed");
178178
return false;
179179
}
180180

@@ -193,15 +193,15 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
193193
};
194194

195195
if (ledc_channel_config(&ledc_channel) != ESP_OK) {
196-
TT_LOG_E(TAG, "Backlight channel config failed");
196+
LOGGER.error("Backlight channel config failed");
197197
}
198198

199199
return true;
200200
}
201201

202202
bool TpagerKeyboard::setBacklightDuty(uint8_t duty) {
203203
if (!backlightOkay) {
204-
TT_LOG_E(TAG, "Backlight not ready");
204+
LOGGER.error("Backlight not ready");
205205
return false;
206206
}
207207
return (ledc_set_duty(LEDC_LOW_SPEED_MODE, backlightChannel, duty) == ESP_OK) &&

Devices/lilygo-tlora-pager/Source/devices/TpagerPower.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "TpagerPower.h"
22

33
#include <Bq25896.h>
4-
#include <Tactility/Log.h>
4+
#include <Tactility/Logger.h>
55

6-
constexpr auto* TAG = "TpagerPower";
6+
static const auto LOGGER = tt::Logger("TpagerPower");
77

88
constexpr auto TPAGER_GAUGE_I2C_BUS_HANDLE = I2C_NUM_0;
99

@@ -68,7 +68,7 @@ void TpagerPower::powerOff() {
6868
});
6969

7070
if (device == nullptr) {
71-
TT_LOG_E(TAG, "BQ25896 not found");
71+
LOGGER.error("BQ25896 not found");
7272
return;
7373
}
7474

0 commit comments

Comments
 (0)