diff --git a/client/src/App.svelte b/client/src/App.svelte index 8c9aa48..2bd309b 100644 --- a/client/src/App.svelte +++ b/client/src/App.svelte @@ -12,25 +12,8 @@ import Loading from './lib/Loading/Loading.svelte' import { settingsStore } from './lib/stores/settingsStore' import getSettings from './lib/utils/getSettings' - import { Canvas } from '@threlte/core' - import { emit } from '@tauri-apps/api/event' let activeApp: App = 'camera' - let topics: TelemetryTopics = { - doubles: [ - 'orientation', - 'chassis-x-speed', - 'chassis-y-speed', - 'accx', - 'accy', - 'accz', - 'jerk-x', - 'jerk-y', - 'voltage', - ], - strings: ['acc-profile', 'gear'], - booleans: ['ebrake', 'reorient', 'gpws'], - } let loading = $settingsStore.fastStartup ? false : true let unlistenAll: () => void @@ -42,7 +25,7 @@ } window.ResizeObserver = ResizeObserver // disabled while migrating away from python - initializeTelemetry(topics, 200).then((unsubFunction: () => void) => { + initializeTelemetry().then((unsubFunction: () => void) => { unlistenAll = unsubFunction }) setTimeout(() => { @@ -50,7 +33,7 @@ initializationSequence() }, 3000) - settingsStore.subscribe(value => { + settingsStore.subscribe((value) => { localStorage.setItem('settings', JSON.stringify(value)) }) }) diff --git a/client/src/lib/utils/initializeTelemetry.ts b/client/src/lib/utils/initializeTelemetry.ts index 06ba0cc..d98ed08 100644 --- a/client/src/lib/utils/initializeTelemetry.ts +++ b/client/src/lib/utils/initializeTelemetry.ts @@ -9,23 +9,8 @@ import { listen } from '@tauri-apps/api/event' * which will be called with the NetworkTable object every time an update is received from the backend. */ -const onUpdate = (data: TelemetryData) => { - telemetryStore.update(data) - // console.log(data) -} - -export const initializeTelemetry = async ( - topics: TelemetryTopics, - refreshRate: number -) => { - // Make sure refreshRate is valid - if (!Number.isInteger(refreshRate) || refreshRate < 1) { - throw new Error( - 'refreshRate must be an integer greater than or equal to 1.' - ) - } - - const unlistenStatus = await listen('telemetry_status', event => { +export const initializeTelemetry = async () => { + const unlistenStatus = await listen('telemetry_status', (event) => { if (event.payload === 'connected') { telemetryStore.set('connected', true) } else if (event.payload === 'disconnected') { @@ -33,7 +18,7 @@ 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']) })