Skip to content

Commit c9e5ee4

Browse files
committed
core: frontend: add notification for uncalibrated sensors
1 parent 7045d2a commit c9e5ee4

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

core/frontend/src/App.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@
5050
Armed
5151
</v-card-title>
5252
</v-card>
53+
<v-card
54+
v-if="uncalibrated_sensors"
55+
v-tooltip="'One or more sensors are not calibrated'"
56+
class="d-flex align-center warning justify-center mr-5"
57+
height="40"
58+
>
59+
<v-icon class="ml-3">
60+
mdi-alert-outline
61+
</v-icon>
62+
<v-card-title>
63+
Uncalibrated sensors
64+
</v-card-title>
65+
</v-card>
5366
<draggable v-model="selected_widgets" class="d-flex align-center justify-center">
5467
<component
5568
:is="getWidget(widget_name).component"
@@ -531,6 +544,9 @@ export default Vue.extend({
531544
safe_mode(): boolean {
532545
return autopilot_data.is_safe
533546
},
547+
uncalibrated_sensors(): boolean {
548+
return autopilot_data.uncalibrated_sensors
549+
},
534550
wifi_connected(): boolean {
535551
return wifi.current_network != null
536552
},

core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,40 @@ export default Vue.extend({
293293
return results
294294
},
295295
},
296+
watch: {
297+
imu_is_calibrated: {
298+
handler() {
299+
this.updateUncalibratedSensorsStatus()
300+
},
301+
deep: true,
302+
immediate: true,
303+
},
304+
compass_is_calibrated: {
305+
handler() {
306+
this.updateUncalibratedSensorsStatus()
307+
},
308+
deep: true,
309+
immediate: true,
310+
},
311+
},
296312
mounted() {
297313
mavlink.setMessageRefreshRate({ messageName: 'SCALED_PRESSURE$', refreshRate: 1 })
298314
mavlink.setMessageRefreshRate({ messageName: 'SCALED_PRESSURE2$', refreshRate: 1 })
299315
mavlink.setMessageRefreshRate({ messageName: 'SCALED_PRESSURE3$', refreshRate: 1 })
300316
mavlink.setMessageRefreshRate({ messageName: 'VFR_HUD', refreshRate: 1 })
317+
318+
this.updateUncalibratedSensorsStatus()
301319
},
302320
methods: {
321+
updateUncalibratedSensorsStatus() {
322+
const imuUncalibrated = this.imu_is_calibrated &&
323+
Object.values(this.imu_is_calibrated).some((calibrated) => !calibrated)
324+
325+
const compassUncalibrated = this.compass_is_calibrated &&
326+
Object.values(this.compass_is_calibrated).some((calibrated) => !calibrated)
327+
328+
autopilot_data.setUncalibratedSensors(imuUncalibrated || compassUncalibrated)
329+
},
303330
print_bus(bus: BUS_TYPE): string {
304331
return BUS_TYPE[bus]
305332
},

core/frontend/src/store/autopilot.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class AutopilotStore extends VuexModule {
3838

3939
verhicle_armed = false
4040

41+
uncalibrated_sensors = false
42+
4143
get parameter() {
4244
return (name: string): Parameter | undefined => this.parameters.find((parameter) => parameter.name === name)
4345
}
@@ -112,6 +114,11 @@ class AutopilotStore extends VuexModule {
112114
setVehicleArmed(armed: boolean): void {
113115
this.verhicle_armed = armed
114116
}
117+
118+
@Mutation
119+
setUncalibratedSensors(uncalibrated: boolean): void {
120+
this.uncalibrated_sensors = uncalibrated
121+
}
115122
}
116123

117124
export { AutopilotStore }

0 commit comments

Comments
 (0)