Compare commits

...

2 Commits

Author SHA1 Message Date
Igor Danilov
94aedff6ae Resolve #8887 (T-LoRaPager Vibration on New Message Delivery) (#8888)
* Resolve #8887

* Update src/modules/ExternalNotificationModule.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/ExternalNotificationModule.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* use canBuzz method

* trunk fmt

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-07 20:29:18 -06:00
Igor Danilov
2ae391197f Fix #8883 (lora-Pager fter playing the notification, voltage does not disappear from the speaker) (#8884)
* Fix #8883

* Fix crash when delete not inicialized rtttlFile
2025-12-07 15:50:53 -06:00
2 changed files with 22 additions and 7 deletions

View File

@@ -50,8 +50,11 @@ class AudioThread : public concurrency::OSThread
delete i2sRtttl;
i2sRtttl = nullptr;
}
delete rtttlFile;
rtttlFile = nullptr;
if (rtttlFile != nullptr) {
delete rtttlFile;
rtttlFile = nullptr;
}
setCPUFast(false);
#ifdef T_LORA_PAGER
@@ -99,9 +102,9 @@ class AudioThread : public concurrency::OSThread
};
AudioGeneratorRTTTL *i2sRtttl = nullptr;
AudioOutputI2S *audioOut;
AudioOutputI2S *audioOut = nullptr;
AudioFileSourcePROGMEM *rtttlFile;
AudioFileSourcePROGMEM *rtttlFile = nullptr;
};
#endif

View File

@@ -168,7 +168,7 @@ int32_t ExternalNotificationModule::runOnce()
delay = EXT_NOTIFICATION_FAST_THREAD_MS;
#endif
#ifdef T_WATCH_S3
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
drv.go();
#endif
}
@@ -310,8 +310,7 @@ void ExternalNotificationModule::stopNow()
rtttl::stop();
#ifdef HAS_I2S
LOG_INFO("Stop audioThread playback");
if (audioThread->isPlaying())
audioThread->stop();
audioThread->stop();
#endif
// Turn off all outputs
LOG_INFO("Turning off setExternalStates");
@@ -542,6 +541,19 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
(!isBroadcast(mp.to) && isToUs(&mp))) {
// Buzz if buzzer mode is not in DIRECT_MSG_ONLY or is DM to us
isNagging = true;
#ifdef T_LORA_PAGER
if (canBuzz()) {
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();
}
#endif
if (!moduleConfig.external_notification.use_pwm && !moduleConfig.external_notification.use_i2s_as_buzzer) {
setExternalState(2, true);
} else {