From f3e01ea7f80f6ef72869d93a136a88e7a89e64c4 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Mon, 5 Jan 2026 23:31:59 +0100 Subject: [PATCH] Fixes --- Devices/lilygo-tlora-pager/Source/Init.cpp | 2 +- Drivers/DRV2605/Source/Drv2605.cpp | 11 +++++++++++ Drivers/DRV2605/Source/Drv2605.h | 13 +------------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Devices/lilygo-tlora-pager/Source/Init.cpp b/Devices/lilygo-tlora-pager/Source/Init.cpp index 8d2f44a6..3a98576f 100644 --- a/Devices/lilygo-tlora-pager/Source/Init.cpp +++ b/Devices/lilygo-tlora-pager/Source/Init.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include #include diff --git a/Drivers/DRV2605/Source/Drv2605.cpp b/Drivers/DRV2605/Source/Drv2605.cpp index 488a6f86..3957fe30 100644 --- a/Drivers/DRV2605/Source/Drv2605.cpp +++ b/Drivers/DRV2605/Source/Drv2605.cpp @@ -4,6 +4,17 @@ 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"); + } + + if (autoPlayStartupBuzz) { + setWaveFormForBuzz(); + startPlayback(); + } +} + bool Drv2605::init() { uint8_t status; if (!readRegister8(static_cast(Register::Status), status)) { diff --git a/Drivers/DRV2605/Source/Drv2605.h b/Drivers/DRV2605/Source/Drv2605.h index 3ec8e862..9bf93aa3 100644 --- a/Drivers/DRV2605/Source/Drv2605.h +++ b/Drivers/DRV2605/Source/Drv2605.h @@ -4,7 +4,6 @@ class Drv2605 : public tt::hal::i2c::I2cDevice { - const tt::Logger logger = tt::Logger("DRV2605"); static constexpr auto ADDRESS = 0x5A; bool autoPlayStartupBuzz; @@ -63,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()) { - logger.error("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"; } @@ -83,7 +73,6 @@ public: void setWaveFormForClick(); /** - * * @param slot a value from 0 to 7 * @param waveform */