Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix console warns #648

Merged
merged 9 commits into from
Dec 15, 2023
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<p v-if="store.missionName">{{ store.missionName }}</p>
<p v-else>
{{ randomMissionName }}
<FontAwesomeIcon icon="fa-pen-to-square" size="md" class="ml-2 text-slate-200/30" />
<FontAwesomeIcon icon="fa-pen-to-square" size="1x" class="ml-2 text-slate-200/30" />
</p>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Dialog.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<template>
<teleport to="body">
<dialog ref="dialogRef" class="modal">
<div ref="dialogContentRef" class="flex flex-col items-center justify-center w-full h-full p-5 backdrop-blur-sm">
<div
ref="dialogContentRef"
v-bind="$attrs"
class="flex flex-col items-center justify-center w-full h-full p-5 backdrop-blur-sm"
>
<slot></slot>
</div>
</dialog>
Expand Down
2 changes: 1 addition & 1 deletion src/components/mini-widgets/VeryGenericIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const updateVariableState = (): void => {
currentState.value = store.genericVariables[miniWidget.value.options.variableName as string]
}
watch(store.genericVariables, updateVariableState)
watch(miniWidget.value.options, updateVariableState)
watch(miniWidget, updateVariableState)
onMounted(() => updateVariableState())

let iconsNames: string[] = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/Attitude.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const angleY = (angle: number): number => {
const renderCanvas = (): void => {
if (canvasRef.value === undefined || canvasRef.value === null) return
if (canvasContext.value === undefined) {
console.warn('Canvas context undefined!')
console.debug('Canvas context undefined!')
canvasContext.value = canvasRef.value.getContext('2d')
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/CompassHUD.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const canvasContext = ref()
const renderCanvas = (): void => {
if (canvasRef.value === undefined || canvasRef.value === null) return
if (canvasContext.value === undefined) {
console.warn('Canvas context undefined!')
console.debug('Canvas context undefined!')
canvasContext.value = canvasRef.value.getContext('2d')
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/DepthHUD.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const canvasContext = ref()
const renderCanvas = (): void => {
if (canvasRef.value === undefined || canvasRef.value === null) return
if (canvasContext.value === undefined) {
console.warn('Canvas context undefined!')
console.debug('Canvas context undefined!')
canvasContext.value = canvasRef.value.getContext('2d')
return
}
Expand Down
3 changes: 1 addition & 2 deletions src/composables/webRTC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ export class WebRTCManager {
track.contentHint = 'motion'
})

console.groupCollapsed('[WebRTC] Track added')
console.debug('[WebRTC] Track added')
console.debug('Event:', event)
console.debug('Settings:', event.track.getSettings?.())
console.debug('Constraints:', event.track.getConstraints?.())
console.debug('Capabilities:', event.track.getCapabilities?.())
console.groupEnd()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libs/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ global!.assert = function (result: boolean, message?: string) {
}

global!.unimplemented = function (message?: string) {
console.warn(new Error(message ?? 'Not implemented'))
console.debug(new Error(message ?? 'Not implemented'))
}

// eslint-disable-next-line
Expand Down
14 changes: 7 additions & 7 deletions src/libs/sensors-logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ class DataLogger {

/* eslint-disable vue/max-len, prettier/prettier, max-len */
const variablesData = {
[DatalogVariable.roll]: { value: `${degrees(vehicleStore.attitude.roll).toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.pitch]: { value: `${degrees(vehicleStore.attitude.pitch).toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.heading]: { value: `${degrees(vehicleStore.attitude.yaw).toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.depth]: { value: `${vehicleStore.altitude.msl.toPrecision(4)} m`, ...timeNowObj },
[DatalogVariable.roll]: { value: `${degrees(vehicleStore.attitude.roll)?.toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.pitch]: { value: `${degrees(vehicleStore.attitude.pitch)?.toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.heading]: { value: `${degrees(vehicleStore.attitude.yaw)?.toFixed(1)} °`, ...timeNowObj },
[DatalogVariable.depth]: { value: `${vehicleStore.altitude.msl?.toPrecision(4)} m`, ...timeNowObj },
[DatalogVariable.mode]: { value: vehicleStore.mode || 'Unknown', ...timeNowObj },
[DatalogVariable.batteryVoltage]: { value: `${vehicleStore.powerSupply.voltage?.toFixed(2)} V` || 'Unknown', ...timeNowObj },
[DatalogVariable.batteryCurrent]: { value: `${vehicleStore.powerSupply.current?.toFixed(2)} A` || 'Unknown', ...timeNowObj },
[DatalogVariable.gpsVisibleSatellites]: { value: vehicleStore.statusGPS.visibleSatellites.toFixed(0) || 'Unknown', ...timeNowObj },
[DatalogVariable.gpsVisibleSatellites]: { value: vehicleStore.statusGPS.visibleSatellites?.toFixed(0) || 'Unknown', ...timeNowObj },
[DatalogVariable.gpsFixType]: { value: vehicleStore.statusGPS.fixType, ...timeNowObj },
[DatalogVariable.latitude]: { value: `${vehicleStore.coordinates.latitude.toFixed(6)} °` || 'Unknown', ...timeNowObj },
[DatalogVariable.longitude]: { value: `${vehicleStore.coordinates.longitude.toFixed(6)} °` || 'Unknown', ...timeNowObj },
[DatalogVariable.latitude]: { value: `${vehicleStore.coordinates.latitude?.toFixed(6)} °` || 'Unknown', ...timeNowObj },
[DatalogVariable.longitude]: { value: `${vehicleStore.coordinates.longitude?.toFixed(6)} °` || 'Unknown', ...timeNowObj },
}
/* eslint-enable vue/max-len, prettier/prettier, max-len */

Expand Down
1 change: 1 addition & 0 deletions src/libs/vehicle/vehicle-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function createVehicleFromMessage(message: Uint8Array): void {
}

const heartbeat = mavlink_message.message as Message.Heartbeat
if (heartbeat.autopilot.type === MavAutopilot.MAV_AUTOPILOT_INVALID) return
if (heartbeat.autopilot.type !== MavAutopilot.MAV_AUTOPILOT_ARDUPILOTMEGA) {
console.warn(`Vehicle not supported: ${system_id}/${component_id}: ${heartbeat.autopilot.type}`)
}
Expand Down
11 changes: 3 additions & 8 deletions src/stores/mainVehicle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useStorage, useTimestamp } from '@vueuse/core'
import { defineStore } from 'pinia'
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
import { computed, reactive, ref, watch } from 'vue'

import { defaultGlobalAddress } from '@/assets/defaults'
import * as Connection from '@/libs/connection/connection'
Expand All @@ -12,7 +12,6 @@ import {
availableCockpitActions,
CockpitActionsManager,
registerActionCallback,
unregisterActionCallback,
} from '@/libs/joystick/protocols/cockpit-actions'
import { MavlinkManualControlManager } from '@/libs/joystick/protocols/mavlink-manual-control'
import type { ArduPilot } from '@/libs/vehicle/ardupilot/ardupilot'
Expand Down Expand Up @@ -310,12 +309,8 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => {
},
setFlightMode: setFlightMode,
}
const mavlinkArmId = registerActionCallback(availableCockpitActions.mavlink_arm, arm)
const mavlinkDisarmId = registerActionCallback(availableCockpitActions.mavlink_disarm, disarm)
onBeforeUnmount(() => {
unregisterActionCallback(mavlinkArmId)
unregisterActionCallback(mavlinkDisarmId)
})
registerActionCallback(availableCockpitActions.mavlink_arm, arm)
registerActionCallback(availableCockpitActions.mavlink_disarm, disarm)
})

const controllerStore = useControllerStore()
Expand Down