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 155636f..bd7f70a 100644 --- a/client/src/lib/utils/initializeTelemetry.ts +++ b/client/src/lib/utils/initializeTelemetry.ts @@ -10,22 +10,7 @@ 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.' - ) - } - +export const initializeTelemetry = async () => { const unlistenStatus = await listen('telemetry_status', (event) => { if (event.payload === 'connected') { telemetryStore.set('connected', true)