diff --git a/core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue b/core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue
index c5c8991dcf..48b2fcd7ba 100755
--- a/core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue
+++ b/core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue
@@ -110,16 +110,16 @@
{{ baro_status[baro.param] }} |
| {{ sensor.deviceName ?? 'UNKNOWN' }} |
-
+ |
Temperature
|
{{ print_bus(sensor.busType) }} {{ sensor.bus }} |
{{ `0x${sensor.address}` }} |
- {{ celsius_temperature }} ÂșC |
+ Detected |
@@ -137,33 +137,12 @@ import autopilot from '@/store/autopilot_manager'
import mavlink from '@/store/mavlink'
import { printParam } from '@/types/autopilot/parameter'
import { Dictionary } from '@/types/common'
-import { BUS_TYPE, deviceId } from '@/utils/deviceid_decoder'
+import { BUS_TYPE } from '@/utils/deviceid_decoder'
import mavlink_store_get from '@/utils/mavlink'
export default Vue.extend({
name: 'OnboardSensors',
computed: {
- // DEV_ID params do not exist yet for temperature sensors, so here we detect the incoming message instead
- celsius_temperature(): number | undefined {
- return mavlink_store_get(mavlink, 'SCALED_PRESSURE3.messageData.message.temperature') as number / 100.0
- },
- celsius(): deviceId[] {
- if (!this.celsius_temperature) {
- return []
- }
- return [
- {
- bus: 1,
- paramValue: 0,
- deviceIdNumber: 0,
- devtype: 0,
- busType: BUS_TYPE.I2C,
- address: '77',
- deviceName: 'Celsius',
- param: '-',
- },
- ]
- },
compass_description(): Dictionary {
const results = {} as Dictionary
for (const compass of ardupilot_sensors.compasses) {
diff --git a/core/frontend/src/store/ardupilot_sensors.ts b/core/frontend/src/store/ardupilot_sensors.ts
index 8aed47f329..d4eb6a64f6 100644
--- a/core/frontend/src/store/ardupilot_sensors.ts
+++ b/core/frontend/src/store/ardupilot_sensors.ts
@@ -36,6 +36,12 @@ class ArdupilotSensorsStore extends VuexModule {
.filter((param) => param.value !== 0)
.map((parameter) => decode(parameter.name, parameter.value))
}
+
+ get temperatures(): deviceId[] {
+ return autopilot_data.parameterRegex('^TEMP\\d+_DEV_ID')
+ .filter((param) => param.value !== 0)
+ .map((parameter) => decode(parameter.name, parameter.value))
+ }
get accelerometers_calibrated() {
const results = {} as Dictionary
diff --git a/core/frontend/src/utils/deviceid_decoder.ts b/core/frontend/src/utils/deviceid_decoder.ts
index 516a7a7d13..06572059f3 100755
--- a/core/frontend/src/utils/deviceid_decoder.ts
+++ b/core/frontend/src/utils/deviceid_decoder.ts
@@ -1,6 +1,7 @@
// based on https://github.com/ArduPilot/ardupilot/blob/master/Tools/scripts/decode_devid.py
export enum BUS_TYPE {
+ UNKNOWN = 0,
I2C = 1,
SPI = 2,
UAVCAN = 3,
@@ -121,6 +122,19 @@ enum AIRSPEED_TYPE {
AIRSPEED_ASP5033 = 0x0A,
}
+enum TEMP_TYPE {
+ UNKNOWN = 0x00,
+ TSYS01 = 0x01,
+ MCP9600 = 0x02,
+ MAX31865 = 0x03,
+ TSYS03 = 0x04,
+ ANALOG = 0x05,
+ DRONECAN = 0x06,
+ MLX90614 = 0x07,
+ SHT3x = 0x08,
+ TMP119 = 0x09,
+}
+
function toHex(value: number): string {
return Number(value).toString(16).padStart(2, '0')
}
@@ -172,6 +186,9 @@ export default function decode(device: string, devid: number): deviceId {
if (device.startsWith('ARSP')) {
decodedDevname = AIRSPEED_TYPE[devtype] || 'UNKNOWN'
}
+ if (device.startsWith('TEMP')) {
+ decodedDevname = TEMP_TYPE[devtype] || 'UNKNOWN'
+ }
return {
param: device,
deviceName: decodedDevname,