mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-03 12:33:53 +00:00
another silly error
This commit is contained in:
parent
fb7a878d94
commit
cf65661c7c
@ -32,56 +32,42 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_NCP5623) || defined(UNPHONE) || defined(RGBLED_RED)
|
||||||
if (!moduleConfig.ambient_lighting.led_state) {
|
if (!moduleConfig.ambient_lighting.led_state) {
|
||||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
LOG_DEBUG("AmbientLightingThread initializing\n");
|
||||||
|
#ifdef HAS_NCP5623
|
||||||
if (_type == ScanI2C::NCP5623) {
|
if (_type == ScanI2C::NCP5623) {
|
||||||
rgb.begin();
|
rgb.begin();
|
||||||
setLighting();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef UNPHONE
|
|
||||||
if (!moduleConfig.ambient_lighting.led_state) {
|
|
||||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
|
||||||
disable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
|
||||||
setLighting();
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBLED_RED
|
#ifdef RGBLED_RED
|
||||||
if (!moduleConfig.ambient_lighting.led_state) {
|
pinMode(RGBLED_RED, OUTPUT);
|
||||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
pinMode(RGBLED_GREEN, OUTPUT);
|
||||||
disable();
|
pinMode(RGBLED_BLUE, OUTPUT);
|
||||||
return;
|
#endif
|
||||||
|
setLighting();
|
||||||
|
#endif
|
||||||
|
#ifdef HAS_NCP5623
|
||||||
}
|
}
|
||||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
|
||||||
pinMode(RGBLED_RED, OUTPUT);
|
|
||||||
pinMode(RGBLED_GREEN, OUTPUT);
|
|
||||||
pinMode(RGBLED_BLUE, OUTPUT);
|
|
||||||
setLighting();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce() override
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
|
#if defined(HAS_NCP5623) || defined(UNPHONE) || defined(RGBLED_RED)
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
|
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
|
||||||
|
#endif
|
||||||
setLighting();
|
setLighting();
|
||||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
||||||
|
#ifdef HAS_NCP5623
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNPHONE
|
|
||||||
setLighting();
|
|
||||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLED_RED
|
|
||||||
setLighting();
|
|
||||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
|
||||||
#endif
|
#endif
|
||||||
return disable();
|
return disable();
|
||||||
}
|
}
|
||||||
|
@ -151,35 +151,35 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
colorState = 1;
|
colorState = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef T_WATCH_S3
|
#ifdef T_WATCH_S3
|
||||||
drv.go();
|
drv.go();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play RTTTL over i2s audio interface if enabled as buzzer
|
// Play RTTTL over i2s audio interface if enabled as buzzer
|
||||||
#ifdef HAS_I2S
|
#ifdef HAS_I2S
|
||||||
if (moduleConfig.external_notification.use_i2s_as_buzzer) {
|
if (moduleConfig.external_notification.use_i2s_as_buzzer) {
|
||||||
if (audioThread->isPlaying()) {
|
if (audioThread->isPlaying()) {
|
||||||
// Continue playing
|
// Continue playing
|
||||||
} else if (isNagging && (nagCycleCutoff >= millis())) {
|
} else if (isNagging && (nagCycleCutoff >= millis())) {
|
||||||
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
// now let the PWM buzzer play
|
// now let the PWM buzzer play
|
||||||
if (moduleConfig.external_notification.use_pwm) {
|
if (moduleConfig.external_notification.use_pwm) {
|
||||||
if (rtttl::isPlaying()) {
|
if (rtttl::isPlaying()) {
|
||||||
rtttl::play();
|
rtttl::play();
|
||||||
} else if (isNagging && (nagCycleCutoff >= millis())) {
|
} else if (isNagging && (nagCycleCutoff >= millis())) {
|
||||||
// start the song again if we have time left
|
// start the song again if we have time left
|
||||||
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return EXT_NOTIFICATION_DEFAULT_THREAD_MS;
|
return EXT_NOTIFICATION_DEFAULT_THREAD_MS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExternalNotificationModule::wantPacket(const meshtastic_MeshPacket *p)
|
bool ExternalNotificationModule::wantPacket(const meshtastic_MeshPacket *p)
|
||||||
@ -228,9 +228,9 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
|
|||||||
analogWrite(RGBLED_GREEN, 255 - green);
|
analogWrite(RGBLED_GREEN, 255 - green);
|
||||||
analogWrite(RGBLED_BLUE, 255 - blue);
|
analogWrite(RGBLED_BLUE, 255 - blue);
|
||||||
#elif defined(RGBLED_RED)
|
#elif defined(RGBLED_RED)
|
||||||
analogWrite(RGBLED_RED, red);
|
analogWrite(RGBLED_RED, red);
|
||||||
analogWrite(RGBLED_GREEN, green);
|
analogWrite(RGBLED_GREEN, green);
|
||||||
analogWrite(RGBLED_BLUE, blue);
|
analogWrite(RGBLED_BLUE, blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef T_WATCH_S3
|
#ifdef T_WATCH_S3
|
||||||
drv.go();
|
drv.go();
|
||||||
@ -458,7 +458,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||||||
#ifdef HAS_I2S
|
#ifdef HAS_I2S
|
||||||
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
||||||
#else
|
#else
|
||||||
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (moduleConfig.external_notification.nag_timeout) {
|
if (moduleConfig.external_notification.nag_timeout) {
|
||||||
@ -502,7 +502,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||||||
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
audioThread->beginRttl(rtttlConfig.ringtone, strlen_P(rtttlConfig.ringtone));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (moduleConfig.external_notification.nag_timeout) {
|
if (moduleConfig.external_notification.nag_timeout) {
|
||||||
|
Loading…
Reference in New Issue
Block a user