chore: remove unused functions and imports
This commit is contained in:
parent
3aaf3bd842
commit
db2819d89d
2 changed files with 5 additions and 37 deletions
|
@ -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))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -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.
|
* 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)
|
const unlistenStatus = await listen('telemetry_status', (event) => {
|
||||||
// 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 => {
|
|
||||||
if (event.payload === 'connected') {
|
if (event.payload === 'connected') {
|
||||||
telemetryStore.set('connected', true)
|
telemetryStore.set('connected', true)
|
||||||
} else if (event.payload === 'disconnected') {
|
} 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)
|
const data = JSON.parse(event.payload as string)
|
||||||
telemetryStore.set(data['topic_name'], data['data'])
|
telemetryStore.set(data['topic_name'], data['data'])
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue