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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user