Skip to content

Commit

Permalink
AutopilotSerialConfiguration: update port mapping to use numeric ports
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Jan 24, 2025
1 parent 78a9660 commit 66529a2
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
class="v-card v-sheet theme--light mt-5"
>
<v-combobox
v-for="port in Object.keys(port_map)"
v-for="port in range(1, 9)"
:key="port"
v-model="ports[port]"
:items="available_ports"
:label="`${port_map[port]}`"
:label="`Serial ${port}`"
:rules="[isValidEndpoint]"
:loading="current_serial_ports.isEmpty()"
outlined
Expand Down Expand Up @@ -65,6 +65,7 @@
</template>

<script lang="ts">
import { range } from 'lodash'
import Vue from 'vue'
import * as AutopilotManager from '@/components/autopilot/AutopilotManagerUpdater'
Expand All @@ -86,19 +87,6 @@ export default Vue.extend({
},
data() {
return {
// Portmap is used to deal with ardupilots weird mapping situation
// Note that the mapping is not linear
port_map: {
// A (Serial 0) is reserved
C: 'Serial 1',
D: 'Serial 2',
B: 'Serial 3',
E: 'Serial 4',
F: 'Serial 5',
G: 'Serial 6',
H: 'Serial 7',
I: 'Serial 8',
},
ports: {} as Dictionary<string | undefined>,
fetch_autopilot_serial_config_task: new OneMoreTime({ delay: 10000, disposeWith: this }),
fetch_serial_task: new OneMoreTime({ delay: 10000, disposeWith: this }),
Expand Down Expand Up @@ -144,6 +132,7 @@ export default Vue.extend({
}
}
},
range,
async saveAndRestart(): Promise<void> {
await back_axios({
method: 'put',
Expand Down

0 comments on commit 66529a2

Please sign in to comment.