diff --git a/src/input/TLoraPagerKeyboard.cpp b/src/input/TLoraPagerKeyboard.cpp index 4efa5d6e2..0d20b4b57 100644 --- a/src/input/TLoraPagerKeyboard.cpp +++ b/src/input/TLoraPagerKeyboard.cpp @@ -190,9 +190,9 @@ void TLoraPagerKeyboard::released() void TLoraPagerKeyboard::hapticFeedback() { - drv.setWaveform(0, 14); // strong buzz 100% - drv.setWaveform(1, 0); // end waveform - drv.go(); + hapticDriver.setWaveform(0, 14); // strong buzz 100% + hapticDriver.setWaveform(1, 0); // end waveform + hapticDriver.go(); } // toggle brightness of the backlight in three steps diff --git a/src/input/TouchScreenBase.cpp b/src/input/TouchScreenBase.cpp index fceac74ba..c29ed3ece 100644 --- a/src/input/TouchScreenBase.cpp +++ b/src/input/TouchScreenBase.cpp @@ -152,8 +152,8 @@ int32_t TouchScreenBase::runOnce() void TouchScreenBase::hapticFeedback() { #ifdef T_WATCH_S3 - drv.setWaveform(0, 75); - drv.setWaveform(1, 0); // end waveform - drv.go(); + hapticDriver.setWaveform(0, 75); + hapticDriver.setWaveform(1, 0); // end waveform + hapticDriver.go(); #endif } diff --git a/src/main.cpp b/src/main.cpp index 6f78c0b96..f5fd7de63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -203,7 +203,7 @@ ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::DeviceAddress aqi_found = ScanI2C::ADDRESS_NONE; #ifdef HAS_DRV2605 -Adafruit_DRV2605 drv; +Adafruit_DRV2605 hapticDriver; #endif bool isVibrating = false; @@ -758,10 +758,10 @@ void setup() digitalWrite(PIN_DRV_EN, HIGH); delay(10); #endif - drv.begin(); - drv.selectLibrary(1); + hapticDriver.begin(); + hapticDriver.selectLibrary(1); // I2C trigger by sending 'go' command - drv.setMode(DRV2605_MODE_INTTRIG); + hapticDriver.setMode(DRV2605_MODE_INTTRIG); #endif // Init our SPI controller (must be before screen and lora) diff --git a/src/main.h b/src/main.h index 56f048134..f26440941 100644 --- a/src/main.h +++ b/src/main.h @@ -44,7 +44,7 @@ extern bool isUSBPowered; #ifdef HAS_DRV2605 #include -extern Adafruit_DRV2605 drv; +extern Adafruit_DRV2605 hapticDriver; #endif #ifdef HAS_PCA9557 diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 16ccdd744..c214a6a7c 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -127,7 +127,7 @@ int32_t ExternalNotificationModule::runOnce() #endif #ifdef HAS_DRV2605 - drv.go(); + hapticDriver.go(); #endif } @@ -222,9 +222,9 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on) #ifdef HAS_DRV2605 if (on) { - drv.go(); + hapticDriver.go(); } else { - drv.stop(); + hapticDriver.stop(); } #endif } @@ -257,7 +257,7 @@ void ExternalNotificationModule::stopNow() } setIntervalFromNow(0); #ifdef HAS_DRV2605 - drv.stop(); + hapticDriver.stop(); #endif // Prevent the state machine from immediately re-triggering outputs after a manual stop. @@ -422,15 +422,15 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP } else { // Buzz if buzzer mode is not in DIRECT_MSG_ONLY or is DM to us #ifdef HAS_DRV2605 - drv.setWaveform(0, 16); // Long buzzer 100% - drv.setWaveform(1, 0); // Pause - drv.setWaveform(2, 16); - drv.setWaveform(3, 0); - drv.setWaveform(4, 16); - drv.setWaveform(5, 0); - drv.setWaveform(6, 16); - drv.setWaveform(7, 0); - drv.go(); + hapticDriver.setWaveform(0, 16); // Long buzzer 100% + hapticDriver.setWaveform(1, 0); // Pause + hapticDriver.setWaveform(2, 16); + hapticDriver.setWaveform(3, 0); + hapticDriver.setWaveform(4, 16); + hapticDriver.setWaveform(5, 0); + hapticDriver.setWaveform(6, 16); + hapticDriver.setWaveform(7, 0); + hapticDriver.go(); #endif if (moduleConfig.external_notification.use_i2s_as_buzzer) {