@@ -89,11 +89,12 @@ int32_t ExternalNotificationModule::runOnce()
8989 return INT32_MAX; // we don't need this thread here...
9090 } else {
9191 uint32_t delay = EXT_NOTIFICATION_MODULE_OUTPUT_MS;
92- bool isPlaying = rtttl::isPlaying ();
92+ bool isRtttlPlaying = rtttl::isPlaying ();
9393#ifdef HAS_I2S
94- isPlaying = rtttl::isPlaying () || audioThread->isPlaying ();
94+ // audioThread->isPlaying() also handles actually playing the RTTTL, needs to be called in loop
95+ isRtttlPlaying = isRtttlPlaying || audioThread->isPlaying ();
9596#endif
96- if ((nagCycleCutoff < millis ()) && !isPlaying ) {
97+ if ((nagCycleCutoff < millis ()) && !isRtttlPlaying ) {
9798 // let the song finish if we reach timeout
9899 nagCycleCutoff = UINT32_MAX;
99100 LOG_INFO (" Turning off external notification: " );
@@ -187,12 +188,14 @@ int32_t ExternalNotificationModule::runOnce()
187188
188189 // Play RTTTL over i2s audio interface if enabled as buzzer
189190#ifdef HAS_I2S
190- if (moduleConfig.external_notification .use_i2s_as_buzzer && canBuzz () ) {
191+ if (moduleConfig.external_notification .use_i2s_as_buzzer ) {
191192 if (audioThread->isPlaying ()) {
192193 // Continue playing
193194 } else if (isNagging && (nagCycleCutoff >= millis ())) {
194195 audioThread->beginRttl (rtttlConfig.ringtone , strlen_P (rtttlConfig.ringtone ));
195196 }
197+ // we need fast updates to play the RTTTL
198+ delay = EXT_NOTIFICATION_FAST_THREAD_MS;
196199 }
197200#endif
198201 // now let the PWM buzzer play
0 commit comments