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 23, 2025
1 parent 1dd49da commit e3eb785
Showing 1 changed file with 5 additions and 16 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 @@ -78,6 +78,7 @@ import back_axios from '@/utils/api'
import { isIpAddress } from '@/utils/pattern_validators'
import { fetchAutopilotSerialConfiguration } from './AutopilotManagerUpdater'
import { range } from 'lodash'
export default Vue.extend({
name: 'AutopilotSerialConfiguration',
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 All @@ -122,7 +110,7 @@ export default Vue.extend({
}
}
return new_list
},
}
},
watch: {
current_serial_ports: {
Expand All @@ -144,6 +132,7 @@ export default Vue.extend({
}
}
},
range,
async saveAndRestart(): Promise<void> {
await back_axios({
method: 'put',
Expand Down

0 comments on commit e3eb785

Please sign in to comment.