Skip to content

Commit 4b97af5

Browse files
nicoschmdtpatrickelectric
authored andcommitted
frontend: wizard: check if there is a board available before running wizard customization step
1 parent 26defb7 commit 4b97af5

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

core/frontend/src/components/wizard/Wizard.vue

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@
8383
</v-row>
8484
</v-stepper-content>
8585
<v-stepper-content step="2">
86+
<v-alert
87+
v-if="board_not_detected"
88+
type="warning"
89+
class="ma-2"
90+
dense
91+
>
92+
No flight controller detected.
93+
</v-alert>
8694
<div class="d-flex justify-space-between">
8795
<model-viewer
8896
v-if="model_viewer_supported && model_viewer_ready"
@@ -300,6 +308,7 @@ import Vue from 'vue'
300308
301309
import {
302310
availableFirmwares,
311+
fetchCurrentBoard,
303312
fetchFirmwareInfo,
304313
installFirmwareFromUrl,
305314
} from '@/components/autopilot/AutopilotManagerUpdater'
@@ -386,6 +395,7 @@ export default Vue.extend({
386395
configuration_page_index: 0,
387396
model_viewer_supported: MODEL_VIEWER_SUPPORTED,
388397
model_viewer_ready: false,
398+
board_not_detected: false,
389399
}
390400
},
391401
computed: {
@@ -526,7 +536,13 @@ export default Vue.extend({
526536
? ApplyStatus.Done : ApplyStatus.Failed
527537
this.retry_count += 1
528538
},
529-
setupBoat() {
539+
async setupBoat() {
540+
await fetchCurrentBoard()
541+
if (!autopilot.current_board) {
542+
this.board_not_detected = true
543+
return
544+
}
545+
this.board_not_detected = false
530546
this.vehicle_type = Vehicle.Rover
531547
this.vehicle_name = 'BlueBoat'
532548
this.vehicle_image = '/assets/vehicles/images/bb120.png'
@@ -586,7 +602,13 @@ export default Vue.extend({
586602
this.finalConfigurations()
587603
}
588604
},
589-
setupROV() {
605+
async setupROV() {
606+
await fetchCurrentBoard()
607+
if (!autopilot.current_board) {
608+
this.board_not_detected = true
609+
return
610+
}
611+
this.board_not_detected = false
590612
this.vehicle_type = Vehicle.Sub
591613
this.vehicle_name = 'BlueROV'
592614
this.vehicle_image = '/assets/vehicles/images/bluerov2.png'
@@ -661,6 +683,11 @@ export default Vue.extend({
661683
.catch((error) => `Failed to disable smart wifi hotspot: ${error.message ?? error.response?.data}.`)
662684
},
663685
async installLatestStableFirmware(vehicle: Vehicle): Promise<ConfigurationStatus> {
686+
await fetchCurrentBoard()
687+
if (!autopilot.current_board) {
688+
return 'No flight controller board detected.'
689+
}
690+
664691
if (this.retry_count) {
665692
console.debug('Going to reboot flight controller on retry.')
666693
mavlink2rest.sendMessage(

0 commit comments

Comments
 (0)