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:
Ken Van Hoeylandt
2026-01-06 22:35:39 +01:00
committed by GitHub
parent 719f7bcece
commit f620255c41
188 changed files with 1973 additions and 1755 deletions
+20 -3
View File
@@ -1,16 +1,33 @@
#include "Drv2605.h"
#include <Tactility/Check.h>
#include <Tactility/Logger.h>
static const auto LOGGER = tt::Logger("DRV2605");
Drv2605::Drv2605(i2c_port_t port, bool autoPlayStartupBuzz) : I2cDevice(port, ADDRESS), autoPlayStartupBuzz(autoPlayStartupBuzz) {
if (!init()) {
LOGGER.error("Failed to initialize DRV2605");
tt_crash();
}
if (autoPlayStartupBuzz) {
setWaveFormForBuzz();
startPlayback();
}
}
bool Drv2605::init() {
uint8_t status;
if (!readRegister8(static_cast<uint8_t>(Register::Status), status)) {
TT_LOG_E(TAG, "Failed to read status");
LOGGER.error("Failed to read status");
return false;
}
status >>= 5;
ChipId chip_id = static_cast<ChipId>(status);
if (chip_id != ChipId::DRV2604 && chip_id != ChipId::DRV2604L && chip_id != ChipId::DRV2605 && chip_id != ChipId::DRV2605L) {
TT_LOG_E(TAG, "Unknown chip id %02x", chip_id);
LOGGER.error("Unknown chip id {:02x}", static_cast<uint8_t>(chip_id));
return false;
}
@@ -25,7 +42,7 @@ bool Drv2605::init() {
uint8_t feedback;
if (!readRegister(Register::Feedback, feedback)) {
TT_LOG_E(TAG, "Failed to read feedback");
LOGGER.error("Failed to read feedback");
return false;
}
+1 -13
View File
@@ -1,11 +1,9 @@
#pragma once
#include <Tactility/hal/i2c/I2cDevice.h>
#include <Tactility/Log.h>
class Drv2605 : public tt::hal::i2c::I2cDevice {
static constexpr auto* TAG = "DRV2605";
static constexpr auto ADDRESS = 0x5A;
bool autoPlayStartupBuzz;
@@ -64,16 +62,7 @@ class Drv2605 : public tt::hal::i2c::I2cDevice {
public:
explicit Drv2605(i2c_port_t port, bool autoPlayStartupBuzz = true) : I2cDevice(port, ADDRESS), autoPlayStartupBuzz(autoPlayStartupBuzz) {
if (!init()) {
TT_LOG_E(TAG, "Failed to initialize DRV2605");
}
if (autoPlayStartupBuzz) {
setWaveFormForBuzz();
startPlayback();
}
}
explicit Drv2605(i2c_port_t port, bool autoPlayStartupBuzz = true);
std::string getName() const final { return "DRV2605"; }
std::string getDescription() const final { return "Haptic driver for ERM/LRA with waveform library & auto-resonance tracking"; }
@@ -84,7 +73,6 @@ public:
void setWaveFormForClick();
/**
*
* @param slot a value from 0 to 7
* @param waveform
*/