chore: remove unused functions and imports

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

View file

@ -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))
})
})

View file

@ -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'])
})