This commit is contained in:
Ken Van Hoeylandt 2026-01-05 22:12:17 +01:00
parent c4f0c134b2
commit d695231cf6
16 changed files with 32 additions and 33 deletions

View File

@ -169,12 +169,14 @@ bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
if (esp_lcd_panel_invert_color(panelHandle, false) != ESP_OK) {
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) {
LOGGER.error("Failed to turn display on");
return false;
}
return true;

View File

@ -7,8 +7,6 @@
#include <Tactility/Logger.h>
#include <ButtonControl.h>
#include <Tactility/Logger.h>
#include "driver/gpio.h"
#include "driver/i2c.h"
#include "freertos/FreeRTOS.h"

View File

@ -53,7 +53,7 @@ void TpagerEncoder::initEncoder() {
};
if (pcnt_new_unit(&unit_config, &encPcntUnit) != ESP_OK) {
LOGGER.error("Pulsecounter intialization failed");
LOGGER.error("Pulsecounter initialization failed");
}
pcnt_glitch_filter_config_t filter_config = {

View File

@ -75,7 +75,7 @@ bool initGpioExpander() {
if (axp2101->isVBus()) {
float voltage = 0.0f;
axp2101->getVBusVoltage(voltage);
LOGGER.info("AXP2101: VBus at %.2f", voltage);
LOGGER.info("AXP2101: VBus at {:.2f}", voltage);
} else {
LOGGER.warn("AXP2101: VBus disabled");
}

View File

@ -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;
LOGGER.error("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

View File

@ -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
LOGGER.info("Pressed button %d", pinNumber);
LOGGER.info("Pressed button {}", pinNumber);
if (pinNumber == pin::BUTTON1) {
tt::app::stop();
}
@ -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";
LOGGER.info("Backlight: %s", backlight_power_state);
LOGGER.info("Backlight: {}", backlight_power_state);
}
bool UnPhoneFeatures::setRgbLed(bool red, bool green, bool blue) const {

View File

@ -1,8 +1,6 @@
#include "Bq24295.h"
#include <Tactility/Logger.h>
static const auto LOGGER = tt::Logger("BQ24295");
/** Reference:
* https://www.ti.com/lit/ds/symlink/bq24295.pdf
* https://gitlab.com/hamishcunningham/unphonelibrary/-/blob/main/unPhone.h?ref_type=heads
@ -49,8 +47,8 @@ bool Bq24295::setWatchDogTimer(WatchDogTimer in) const {
if (readChargeTermination(value)) {
uint8_t bits_to_set = 0b00110000 & static_cast<uint8_t>(in);
uint8_t value_cleared = value & 0b11001111;
uint8_t to_set = bits_to_set & value_cleared;
LOGGER.info("WatchDogTimer: {:02x} -> {:02x}", value, to_set);
uint8_t to_set = bits_to_set | value_cleared;
logger.info("WatchDogTimer: {:02x} -> {:02x}", value, to_set);
return writeRegister8(registers::CHARGE_TERMINATION, to_set);
}
@ -96,9 +94,9 @@ bool Bq24295::getVersion(uint8_t& value) const {
void Bq24295::printInfo() const {
uint8_t version, status, charge_termination;
if (getStatus(status) && getVersion(version) && readChargeTermination(charge_termination)) {
LOGGER.info("Version {}, status {:02x}, charge termination {:02x}", version, status, charge_termination);
logger.info("Version {}, status {:02x}, charge termination {:02x}", version, status, charge_termination);
} else {
LOGGER.error("Failed to retrieve version and/or status");
logger.error("Failed to retrieve version and/or status");
}
}

View File

@ -14,7 +14,7 @@ bool Drv2605::init() {
ChipId chip_id = static_cast<ChipId>(status);
if (chip_id != ChipId::DRV2604 && chip_id != ChipId::DRV2604L && chip_id != ChipId::DRV2605 && chip_id != ChipId::DRV2605L) {
LOGGER.error("Unknown chip id {:02x}", chip_id);
LOGGER.error("Unknown chip id {:02x}", static_cast<uint8_t>(chip_id));
return false;
}

View File

@ -89,7 +89,12 @@ bool Xpt2046SoftSpi::start() {
gpio_set_level(configuration->clkPin, 0); // CLK low
gpio_set_level(configuration->mosiPin, 0); // MOSI low
LOGGER.info("GPIO configured: MOSI={}, MISO={}, CLK={}, CS={}", configuration->mosiPin, configuration->misoPin, configuration->clkPin, configuration->csPin);
LOGGER.info("GPIO configured: MOSI={}, MISO={}, CLK={}, CS={}",
static_cast<int>(configuration->mosiPin),
static_cast<int>(configuration->misoPin),
static_cast<int>(configuration->clkPin),
static_cast<int>(configuration->csPin)
);
// Load or perform calibration
bool calibrationValid = true; //loadCalibration() && !RERUN_CALIBRATE;

View File

@ -1,12 +1,11 @@
#ifdef ESP_PLATFORM
#include "Tactility/hal/Device.h"
#include <Tactility/app/crashdiagnostics/QrHelpers.h>
#include <Tactility/app/crashdiagnostics/QrUrl.h>
#include <Tactility/app/launcher/Launcher.h>
#include <Tactility/lvgl/Statusbar.h>
#include <Tactility/hal/Device.h>
#include <Tactility/Logger.h>
#include <Tactility/lvgl/Statusbar.h>
#include <Tactility/service/loader/Loader.h>
#include <lvgl.h>
@ -66,7 +65,7 @@ public:
QRCode qrcode;
LOGGER.info("QR init text");
if (qrcode_initText(&qrcode, qrcodeData.get(), qr_version, ECC_LOW, url.c_str()) != 0) {
LOGGER.error("QR init text failed");
LOGGER.error("QR init text failed");
stop(manifest.appId);
return;
}
@ -101,7 +100,7 @@ public:
LOGGER.info("Create draw buffer");
auto* draw_buf = lv_draw_buf_create(pixel_size * qrcode.size, pixel_size * qrcode.size, LV_COLOR_FORMAT_RGB565, LV_STRIDE_AUTO);
if (draw_buf == nullptr) {
LOGGER.error("Draw buffer alloc");
LOGGER.error("Failed to allocate draw buffer");
stop(manifest.appId);
return;
}

View File

@ -94,7 +94,7 @@ class GpsSettingsApp final : public App {
auto gps_service = service::gps::findGpsService();
if (gps_service && gps_service->getGpsConfigurations(configurations)) {
Logger("GpsSettings").info("Found service and configs {} {}", index, configurations.size());
if (index <= configurations.size()) {
if (index < configurations.size()) {
if (gps_service->removeGpsConfiguration(configurations[index])) {
app->updateViews();
} else {

View File

@ -52,7 +52,7 @@ class NotesApp final : public App {
saveBuffer = lv_textarea_get_text(uiNoteText);
lvgl::getSyncLock()->unlock();
saveFileLaunchId = fileselection::startForExistingOrNewFile();
LOGGER.info("launched with id {}", loadFileLaunchId);
LOGGER.info("launched with id {}", saveFileLaunchId);
break;
case 3: // Load
loadFileLaunchId = fileselection::startForExistingFile();
@ -64,7 +64,7 @@ class NotesApp final : public App {
if (obj == cont) return;
if (lv_obj_get_child(cont, 1)) {
saveFileLaunchId = fileselection::startForExistingOrNewFile();
LOGGER.info("launched with id {}", loadFileLaunchId);
LOGGER.info("launched with id {}", saveFileLaunchId);
} else { //Reset
resetFileContent();
}
@ -91,7 +91,7 @@ class NotesApp final : public App {
lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
lv_label_set_text(uiCurrentFileName, path.c_str());
filePath = path;
LOGGER.info("Loaded from %s", path.c_str());
LOGGER.info("Loaded from {}", path);
}
});
}
@ -101,7 +101,7 @@ class NotesApp final : public App {
bool result = false;
file::getLock(path)->withLock([&result, this, path] {
if (file::writeString(path, saveBuffer.c_str())) {
LOGGER.info("Saved to %s", path.c_str());
LOGGER.info("Saved to {}", path);
filePath = path;
result = true;
}

View File

@ -112,7 +112,7 @@ GpsResponse getACKCas(uart::Uart& uart, uint8_t class_id, uint8_t msg_id, uint32
// Check for an ACK-ACK for the specified class and message id
if ((msg_cls == 0x05) && (msg_msg_id == 0x01) && payload_cls == class_id && payload_msg == msg_id) {
#ifdef GPS_DEBUG
LOGGER.info("Got ACK for class {:02X} message {:02X} in {} ms", class_id, msg_id, millis() - startTime);
LOGGER.info("Got ACK for class {:02X} message {:02X} in {} ms", class_id, msg_id, kernel::getMillis() - startTime);
#endif
return GpsResponse::Ok;
}

View File

@ -67,7 +67,7 @@ GpsResponse getAck(uart::Uart& uart, const char* message, uint32_t waitMillis) {
} else {
bytesRead = 0;
#ifdef GPS_DEBUG
LOGGER.debug(debugmsg);
LOGGER.debug("{}", debugmsg);
#endif
}
}
@ -134,7 +134,7 @@ GpsModel probe(uart::Uart& uart) {
if (ublox_result != GpsModel::Unknown) {
return ublox_result;
} else {
LOGGER.warn("No GNSS Module (baudrate %lu)", uart.getBaudRate());
LOGGER.warn("No GNSS Module (baud rate {})", uart.getBaudRate());
return GpsModel::Unknown;
}
}

View File

@ -129,7 +129,7 @@ std::unique_ptr<Uart> open(uart_port_t port) {
}
std::unique_ptr<Uart> open(std::string name) {
LOGGER.info("Open {}", name.c_str());
LOGGER.info("Open {}", name);
auto result = std::views::filter(uartEntries, [&name](auto& entry) {
return entry.configuration.name == name;

View File

@ -64,5 +64,4 @@ namespace tt {
* @param[in] condition to check
* @param[in] optional message (const char*)
*/
#define tt_check(x, ...) if (!(x)) { tt::Logger("Kernel").error("Check failed: {}", #x); tt::_crash(); }
#define tt_check(...) tt_check_internal(__VA_ARGS__)