chore: remove unused functions and imports

This commit is contained in:
Youwen Wu 2024-03-06 23:55:35 -08:00
parent eacc25f0b7
commit 986279ad08
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 3 additions and 35 deletions

View file

@ -12,25 +12,8 @@
import Loading from './lib/Loading/Loading.svelte' import Loading from './lib/Loading/Loading.svelte'
import { settingsStore } from './lib/stores/settingsStore' import { settingsStore } from './lib/stores/settingsStore'
import getSettings from './lib/utils/getSettings' import getSettings from './lib/utils/getSettings'
import { Canvas } from '@threlte/core'
import { emit } from '@tauri-apps/api/event'
let activeApp: App = 'camera' 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 loading = $settingsStore.fastStartup ? false : true
let unlistenAll: () => void let unlistenAll: () => void
@ -42,7 +25,7 @@
} }
window.ResizeObserver = ResizeObserver window.ResizeObserver = ResizeObserver
// disabled while migrating away from python // disabled while migrating away from python
initializeTelemetry(topics, 200).then((unsubFunction: () => void) => { initializeTelemetry().then((unsubFunction: () => void) => {
unlistenAll = unsubFunction unlistenAll = unsubFunction
}) })
setTimeout(() => { setTimeout(() => {
@ -50,7 +33,7 @@
initializationSequence() initializationSequence()
}, 3000) }, 3000)
settingsStore.subscribe(value => { settingsStore.subscribe((value) => {
localStorage.setItem('settings', JSON.stringify(value)) localStorage.setItem('settings', JSON.stringify(value))
}) })
}) })

View file

@ -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. * which will be called with the NetworkTable object every time an update is received from the backend.
*/ */
const onUpdate = (data: TelemetryData) => { export const initializeTelemetry = async () => {
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) => { const unlistenStatus = await listen('telemetry_status', (event) => {
if (event.payload === 'connected') { if (event.payload === 'connected') {
telemetryStore.set('connected', true) telemetryStore.set('connected', true)