Replaced Logger usage with LOG_x (#548)
This commit is contained in:
committed by
GitHub
parent
ecad2248d9
commit
9d5993930d
@@ -1,5 +1,4 @@
|
||||
#include <Bq27220.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
@@ -8,17 +7,18 @@
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("T-Lora Pager");
|
||||
constexpr auto* TAG = "T-Lora Pager";
|
||||
|
||||
bool tpagerInit() {
|
||||
LOGGER.info(LOG_MESSAGE_POWER_ON_START);
|
||||
LOG_I(TAG, 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)) {
|
||||
LOGGER.error("Backlight init failed");
|
||||
LOG_E(TAG, "Backlight init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ bool tpagerInit() {
|
||||
.baudRate = 38400,
|
||||
.model = tt::hal::gps::GpsModel::UBLOX10
|
||||
})) {
|
||||
LOGGER.info("Configured internal GPS");
|
||||
LOG_I(TAG, "Configured internal GPS");
|
||||
} else {
|
||||
LOGGER.error("Failed to configure internal GPS");
|
||||
LOG_E(TAG, "Failed to configure internal GPS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "TpagerKeyboard.h"
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/gpio.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("TpagerKeyboard");
|
||||
constexpr auto* TAG = "TpagerKeyboard";
|
||||
|
||||
constexpr auto BACKLIGHT = GPIO_NUM_46;
|
||||
|
||||
@@ -173,7 +172,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
};
|
||||
|
||||
if (ledc_timer_config(&ledc_timer) != ESP_OK) {
|
||||
LOGGER.error("Backlight timer config failed");
|
||||
LOG_E(TAG, "Backlight timer config failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,7 +191,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
};
|
||||
|
||||
if (ledc_channel_config(&ledc_channel) != ESP_OK) {
|
||||
LOGGER.error("Backlight channel config failed");
|
||||
LOG_E(TAG, "Backlight channel config failed");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -200,7 +199,7 @@ bool TpagerKeyboard::initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_ti
|
||||
|
||||
bool TpagerKeyboard::setBacklightDuty(uint8_t duty) {
|
||||
if (!backlightOkay) {
|
||||
LOGGER.error("Backlight not ready");
|
||||
LOG_E(TAG, "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/Logger.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("TpagerPower");
|
||||
constexpr auto* TAG = "TpagerPower";
|
||||
|
||||
TpagerPower::~TpagerPower() {}
|
||||
|
||||
@@ -66,7 +66,7 @@ void TpagerPower::powerOff() {
|
||||
});
|
||||
|
||||
if (device == nullptr) {
|
||||
LOGGER.error("BQ25896 not found");
|
||||
LOG_E(TAG, "BQ25896 not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user