feat: add gpws detection
This commit is contained in:
parent
9c4cf32b73
commit
8dd6edc60a
2 changed files with 23 additions and 4 deletions
|
@ -217,7 +217,7 @@ export const infotainmentBootupSequence = async () => {
|
|||
}
|
||||
|
||||
if (!get(sequenceStore).initializationComplete) {
|
||||
const unsubscribe = sequenceStore.subscribe(data => {
|
||||
const unsubscribe = sequenceStore.subscribe((data) => {
|
||||
if (data.initializationComplete) {
|
||||
sequence()
|
||||
unsubscribe()
|
||||
|
@ -237,7 +237,7 @@ export const infotainmentBootupSequence = async () => {
|
|||
*/
|
||||
const waitForInfotainmentBootup = (sequence: () => void) => {
|
||||
if (!get(sequenceStore).infotainmentStartedFirstTime) {
|
||||
const unsubscribe = sequenceStore.subscribe(data => {
|
||||
const unsubscribe = sequenceStore.subscribe((data) => {
|
||||
if (data.infotainmentStartedFirstTime) {
|
||||
sequence()
|
||||
unsubscribe()
|
||||
|
@ -430,3 +430,13 @@ export const modeLudicrousSequence = async () => {
|
|||
|
||||
Notifications.playAudio(getVoicePath('set-acceleration-profile-ludicrous'))
|
||||
}
|
||||
|
||||
export const gpwsTriggeredSequence = async () => {
|
||||
if (get(settingsStore).disableAnnoyances) return
|
||||
await tick()
|
||||
|
||||
Notifications.error('Terrain, pull up!', {
|
||||
withAudio: true,
|
||||
src: getVoicePath('terrain-pull-up'),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { gpwsTriggeredSequence } from '../Sequences/sequences'
|
||||
import { telemetryStore } from '../stores/telemetryStore'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
|
||||
|
@ -25,7 +26,7 @@ export const initializeTelemetry = async (
|
|||
)
|
||||
}
|
||||
|
||||
const unlistenStatus = await listen('telemetry_status', event => {
|
||||
const unlistenStatus = await listen('telemetry_status', (event) => {
|
||||
if (event.payload === 'connected') {
|
||||
telemetryStore.set('connected', true)
|
||||
} else if (event.payload === 'disconnected') {
|
||||
|
@ -33,14 +34,22 @@ export const initializeTelemetry = async (
|
|||
}
|
||||
})
|
||||
|
||||
const unlistenTelemetry = await listen('telemetry_data', event => {
|
||||
const unlistenTelemetry = await listen('telemetry_data', (event) => {
|
||||
const data = JSON.parse(event.payload as string)
|
||||
telemetryStore.set(data['topic_name'], data['data'])
|
||||
})
|
||||
|
||||
const unlistenGpws = await listen('telemetry_gpws', (event) => {
|
||||
const data = JSON.parse(event.payload as string) as boolean
|
||||
if (data) {
|
||||
gpwsTriggeredSequence()
|
||||
}
|
||||
})
|
||||
|
||||
const unlistenAll = () => {
|
||||
unlistenStatus()
|
||||
unlistenTelemetry()
|
||||
unlistenGpws()
|
||||
}
|
||||
|
||||
return unlistenAll
|
||||
|
|
Loading…
Reference in a new issue