From 463f8f83c21faab328a43b09a36934ea43af65e0 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Fri, 8 Nov 2024 14:08:53 -0300 Subject: [PATCH] core: frontend: tweak compass configuration pages --- .../InlineParameterEditor.vue | 12 ++ .../compass/ArdupilotMavlinkCompassSetup.vue | 86 ++++++++++---- .../compass/AutoCoordinateDetector.vue | 111 +++++++++++------- .../configuration/compass/CompassDisplay.vue | 1 + .../compass/FullCompassCalibrator.vue | 3 +- .../compass/LargeVehicleCompassCalibrator.vue | 1 + 6 files changed, 150 insertions(+), 64 deletions(-) diff --git a/core/frontend/src/components/parameter-editor/InlineParameterEditor.vue b/core/frontend/src/components/parameter-editor/InlineParameterEditor.vue index 0e9ceec851..2666a62e05 100644 --- a/core/frontend/src/components/parameter-editor/InlineParameterEditor.vue +++ b/core/frontend/src/components/parameter-editor/InlineParameterEditor.vue @@ -67,6 +67,7 @@ import Vue, { PropType } from 'vue' import mavlink2rest from '@/libs/MAVLink2Rest' import autopilot_data from '@/store/autopilot' import Parameter from '@/types/autopilot/parameter' +import { Dictionary } from '@/types/common' export default Vue.extend({ name: 'InlineParameterEditor', @@ -95,6 +96,10 @@ export default Vue.extend({ type: Boolean, default: false, }, + metadataOverrides: { + type: Object as PropType>, + default: () => ({}), + }, }, data() { return { @@ -111,6 +116,13 @@ export default Vue.extend({ const entries = Object.entries(this.param?.options ?? []) const value_is_known = Object.keys(this.param?.options ?? []).map(parseFloat).includes(this.param?.value) const options = entries.map(([value, name]) => ({ text: name, value: parseFloat(value), disabled: false })) + // replace entries in metadataOverrides + for (const [value, _name] of entries) { + if (value in this.metadataOverrides) { + const index = options.findIndex((option) => option.value === parseFloat(value)) + options[index].text = this.metadataOverrides[value] + } + } if (!value_is_known) { options.push({ text: `Custom: ${this.param?.value}`, value: this.param?.value, disabled: false }) } diff --git a/core/frontend/src/components/vehiclesetup/configuration/compass/ArdupilotMavlinkCompassSetup.vue b/core/frontend/src/components/vehiclesetup/configuration/compass/ArdupilotMavlinkCompassSetup.vue index 7bd442b135..acd00d09df 100644 --- a/core/frontend/src/components/vehiclesetup/configuration/compass/ArdupilotMavlinkCompassSetup.vue +++ b/core/frontend/src/components/vehiclesetup/configuration/compass/ArdupilotMavlinkCompassSetup.vue @@ -1,30 +1,13 @@