Skip to content

Commit

Permalink
alerter: Ignore level and vocalize alerts that start with #
Browse files Browse the repository at this point in the history
Those are used by ArduPilot to enforce that the alert should be vocalized.
  • Loading branch information
rafaellehmkuhl committed Jul 25, 2023
1 parent d3af5f9 commit 92be52c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stores/alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export const useAlertStore = defineStore('alert', () => {
watch(alerts, () => {
const lastAlert = alerts.slice(-1)[0]
const alertLevelEnabled = enabledAlertLevels.value.find((enabledAlert) => enabledAlert.level === lastAlert.level)
if (alertLevelEnabled === undefined || !enableVoiceAlerts.value || !alertLevelEnabled.enabled) return
if (
!enableVoiceAlerts.value ||
((alertLevelEnabled === undefined || !alertLevelEnabled.enabled) && !lastAlert.message.startsWith('#'))
)
return
speak(lastAlert.level)
speak(lastAlert.message)
})
Expand Down

0 comments on commit 92be52c

Please sign in to comment.