90
90
<v-icon
91
91
v-if =" heartbeat_age() < time_limit_heartbeat"
92
92
class =" px-1"
93
- :color =" `rgba(255,255,255,${0.4 + (1000 - heartbeat_age()) / 1000}` "
94
- title =" MAVLink heartbeats arriving as expected "
93
+ :color =" heartbeat_color() "
94
+ : title =" heartbeat_message() "
95
95
>
96
96
mdi-heart-pulse
97
97
</v-icon >
125
125
<td >Current:</td >
126
126
<td > {{ battery_current }} A</td >
127
127
</tr >
128
+ <tr v-for =" (calibrated, sensor_name,) in ardupilot_sensors.sensors" :key =" sensor_name" >
129
+ <td class =" sensor-type" >
130
+ {{ sensor_name }}:
131
+ </td >
132
+ <td v-if =" !calibrated" >
133
+ <v-btn
134
+ x-small
135
+ :to =" { name: 'Vehicle Setup', params: { tab: 'configure', subtab: sensor_name } }"
136
+ >
137
+ Calibrate
138
+ </v-btn >
139
+ </td >
140
+ <td v-else >
141
+ Calibrated
142
+ </td >
143
+ </tr >
128
144
</table >
129
145
</div >
130
146
</v-container >
136
152
<script lang="ts">
137
153
import Vue from ' vue'
138
154
155
+ import { convertHexToRgbd } from ' @/cosmos'
139
156
import mavlink2rest from ' @/libs/MAVLink2Rest'
140
157
import { MavModeFlag , MavType } from ' @/libs/MAVLink2Rest/mavlink2rest-ts/messages/mavlink2rest-enum'
158
+ import ardupilot_sensors from ' @/store/ardupilot_sensors'
141
159
import autopilot_data from ' @/store/autopilot'
142
160
import mavlink from ' @/store/mavlink'
143
161
import system_information from ' @/store/system-information'
162
+ import * as DEFAULT_COLORS from ' @/style/colors/default'
144
163
import { RaspberryEventType } from ' @/types/system-information/platform'
145
164
import { Disk } from ' @/types/system-information/system'
146
165
import mavlink_store_get from ' @/utils/mavlink'
@@ -206,6 +225,9 @@ export default Vue.extend({
206
225
disk_usage_high(): boolean {
207
226
return this .disk_usage_percent > 85
208
227
},
228
+ ardupilot_sensors() {
229
+ return ardupilot_sensors
230
+ },
209
231
},
210
232
mounted() {
211
233
mavlink2rest .startListening (' HEARTBEAT' ).setCallback ((message ) => {
@@ -244,6 +266,20 @@ export default Vue.extend({
244
266
' MAV_TYPE_VTOL_TAILSITTER' ,
245
267
].includes (type )
246
268
},
269
+ heartbeat_color() : string {
270
+ const selected_color = ardupilot_sensors .all_sensors_calibrated
271
+ ? DEFAULT_COLORS .SHEET_LIGHT_BG : DEFAULT_COLORS .WARNING
272
+ const [r, g, b] = convertHexToRgbd (selected_color )
273
+ const opacity = Math .max (0.4 , 1.4 - this .heartbeat_age () / 1000 )
274
+
275
+ return ` rgba(${r }, ${g }, ${b }, ${opacity }) `
276
+ },
277
+ heartbeat_message() : string {
278
+ if (ardupilot_sensors .all_sensors_calibrated ) {
279
+ return ' MAVLink heartbeats arriving as expected'
280
+ }
281
+ return ' One or more sensors are not calibrated'
282
+ },
247
283
},
248
284
})
249
285
</script >
@@ -261,4 +297,8 @@ export default Vue.extend({
261
297
.white-shadow {
262
298
text-shadow : 0 0 3px #FFF ;
263
299
}
300
+
301
+ .sensor-type {
302
+ text-transform : capitalize ;
303
+ }
264
304
</style >
0 commit comments