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
@@ -1,9 +1,9 @@
#include "TpagerEncoder.h"
#include <Tactility/Logger.h>
#include <driver/gpio.h>
#include <tactility/log.h>
static const auto LOGGER = tt::Logger("TpagerEncoder");
constexpr auto* TAG = "TpagerEncoder";
constexpr auto ENCODER_A = GPIO_NUM_40;
constexpr auto ENCODER_B = GPIO_NUM_41;
@@ -58,7 +58,7 @@ bool TpagerEncoder::initEncoder() {
};
if (pcnt_new_unit(&unit_config, &encPcntUnit) != ESP_OK) {
LOGGER.error("Pulsecounter initialization failed");
LOG_E(TAG, "Pulsecounter initialization failed");
return false;
}
@@ -67,7 +67,7 @@ bool TpagerEncoder::initEncoder() {
};
if (pcnt_unit_set_glitch_filter(encPcntUnit, &filter_config) != ESP_OK) {
LOGGER.error("Pulsecounter glitch filter config failed");
LOG_E(TAG, "Pulsecounter glitch filter config failed");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
@@ -102,7 +102,7 @@ bool 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)) {
LOGGER.error("Pulsecounter channel config failed");
LOG_E(TAG, "Pulsecounter channel config failed");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
@@ -111,7 +111,7 @@ bool TpagerEncoder::initEncoder() {
// 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)) {
LOGGER.error("Pulsecounter edge action config failed");
LOG_E(TAG, "Pulsecounter edge action config failed");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
@@ -120,7 +120,7 @@ bool TpagerEncoder::initEncoder() {
// 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)) {
LOGGER.error("Pulsecounter level action config failed");
LOG_E(TAG, "Pulsecounter level action config failed");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
@@ -128,28 +128,28 @@ bool TpagerEncoder::initEncoder() {
if ((pcnt_unit_add_watch_point(encPcntUnit, LOW_LIMIT) != ESP_OK) ||
(pcnt_unit_add_watch_point(encPcntUnit, HIGH_LIMIT) != ESP_OK)) {
LOGGER.error("Pulsecounter watch point config failed");
LOG_E(TAG, "Pulsecounter watch point config failed");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
}
if (pcnt_unit_enable(encPcntUnit) != ESP_OK) {
LOGGER.error("Pulsecounter could not be enabled");
LOG_E(TAG, "Pulsecounter could not be enabled");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
}
if (pcnt_unit_clear_count(encPcntUnit) != ESP_OK) {
LOGGER.error("Pulsecounter could not be cleared");
LOG_E(TAG, "Pulsecounter could not be cleared");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
}
if (pcnt_unit_start(encPcntUnit) != ESP_OK) {
LOGGER.error("Pulsecounter could not be started");
LOG_E(TAG, "Pulsecounter could not be started");
pcnt_del_unit(encPcntUnit);
encPcntUnit = nullptr;
return false;
@@ -168,16 +168,16 @@ bool TpagerEncoder::deinitEncoder() {
assert(encPcntUnit != nullptr);
if (pcnt_unit_stop(encPcntUnit) != ESP_OK) {
LOGGER.warn("Failed to stop encoder");
LOG_W(TAG, "Failed to stop encoder");
}
if (pcnt_del_unit(encPcntUnit) != ESP_OK) {
LOGGER.warn("Failed to delete encoder");
LOG_W(TAG, "Failed to delete encoder");
encPcntUnit = nullptr;
return false;
}
LOGGER.info("Deinitialized");
LOG_I(TAG, "Deinitialized");
return true;
}
@@ -206,7 +206,7 @@ bool TpagerEncoder::stopLvgl() {
if (encPcntUnit != nullptr && !deinitEncoder()) {
// We're not returning false as LVGL as effectively deinitialized
LOGGER.warn("Deinitialization failed");
LOG_W(TAG, "Deinitialization failed");
}
return true;