mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 17:32:18 +00:00
fix master too
This commit is contained in:
parent
63cf01223c
commit
6ea0963f4b
@ -37,7 +37,11 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
if (!moduleConfig.external_notification.enabled) {
|
if (!moduleConfig.external_notification.enabled) {
|
||||||
return INT32_MAX; // we don't need this thread here...
|
return INT32_MAX; // we don't need this thread here...
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
if ((nagCycleCutoff < millis()) && !rtttl::isPlaying()) {
|
if ((nagCycleCutoff < millis()) && !rtttl::isPlaying()) {
|
||||||
|
#else
|
||||||
|
if (nagCycleCutoff < millis()) {
|
||||||
|
#endif
|
||||||
nagCycleCutoff = UINT32_MAX;
|
nagCycleCutoff = UINT32_MAX;
|
||||||
DEBUG_MSG("Turning off external notification: ");
|
DEBUG_MSG("Turning off external notification: ");
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
@ -71,6 +75,7 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now let the PWM buzzer play
|
// now let the PWM buzzer play
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
if (moduleConfig.external_notification.use_pwm) {
|
if (moduleConfig.external_notification.use_pwm) {
|
||||||
if (rtttl::isPlaying()) {
|
if (rtttl::isPlaying()) {
|
||||||
rtttl::play();
|
rtttl::play();
|
||||||
@ -79,6 +84,7 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +135,9 @@ bool ExternalNotificationModule::getExternal(uint8_t index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExternalNotificationModule::stopNow() {
|
void ExternalNotificationModule::stopNow() {
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
rtttl::stop();
|
rtttl::stop();
|
||||||
|
#endif
|
||||||
nagCycleCutoff = 1; // small value
|
nagCycleCutoff = 1; // small value
|
||||||
setIntervalFromNow(0);
|
setIntervalFromNow(0);
|
||||||
}
|
}
|
||||||
@ -240,7 +248,9 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
|||||||
if (!moduleConfig.external_notification.use_pwm) {
|
if (!moduleConfig.external_notification.use_pwm) {
|
||||||
setExternalOn(2);
|
setExternalOn(2);
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (moduleConfig.external_notification.nag_timeout) {
|
if (moduleConfig.external_notification.nag_timeout) {
|
||||||
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
|
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
|
||||||
@ -276,7 +286,9 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
|||||||
if (!moduleConfig.external_notification.use_pwm) {
|
if (!moduleConfig.external_notification.use_pwm) {
|
||||||
setExternalOn(2);
|
setExternalOn(2);
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
rtttl::begin(config.device.buzzer_gpio, pwmRingtone);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (moduleConfig.external_notification.nag_timeout) {
|
if (moduleConfig.external_notification.nag_timeout) {
|
||||||
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
|
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
#include "SinglePortModule.h"
|
#include "SinglePortModule.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#ifndef ARCH_PORTDUINO
|
||||||
#include <NonBlockingRtttl.h>
|
#include <NonBlockingRtttl.h>
|
||||||
|
#endif
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user