Skip to content

Commit 66529a2

Browse files
AutopilotSerialConfiguration: update port mapping to use numeric ports
1 parent 78a9660 commit 66529a2

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

core/frontend/src/components/autopilot/AutopilotSerialConfiguration.vue

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
class="v-card v-sheet theme--light mt-5"
44
>
55
<v-combobox
6-
v-for="port in Object.keys(port_map)"
6+
v-for="port in range(1, 9)"
77
:key="port"
88
v-model="ports[port]"
99
:items="available_ports"
10-
:label="`${port_map[port]}`"
10+
:label="`Serial ${port}`"
1111
:rules="[isValidEndpoint]"
1212
:loading="current_serial_ports.isEmpty()"
1313
outlined
@@ -65,6 +65,7 @@
6565
</template>
6666

6767
<script lang="ts">
68+
import { range } from 'lodash'
6869
import Vue from 'vue'
6970
7071
import * as AutopilotManager from '@/components/autopilot/AutopilotManagerUpdater'
@@ -86,19 +87,6 @@ export default Vue.extend({
8687
},
8788
data() {
8889
return {
89-
// Portmap is used to deal with ardupilots weird mapping situation
90-
// Note that the mapping is not linear
91-
port_map: {
92-
// A (Serial 0) is reserved
93-
C: 'Serial 1',
94-
D: 'Serial 2',
95-
B: 'Serial 3',
96-
E: 'Serial 4',
97-
F: 'Serial 5',
98-
G: 'Serial 6',
99-
H: 'Serial 7',
100-
I: 'Serial 8',
101-
},
10290
ports: {} as Dictionary<string | undefined>,
10391
fetch_autopilot_serial_config_task: new OneMoreTime({ delay: 10000, disposeWith: this }),
10492
fetch_serial_task: new OneMoreTime({ delay: 10000, disposeWith: this }),
@@ -144,6 +132,7 @@ export default Vue.extend({
144132
}
145133
}
146134
},
135+
range,
147136
async saveAndRestart(): Promise<void> {
148137
await back_axios({
149138
method: 'put',

0 commit comments

Comments
 (0)