-
Notifications
You must be signed in to change notification settings - Fork 13.5k
/
rc.board_sensors
111 lines (90 loc) · 2.16 KB
/
rc.board_sensors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
#
# board specific sensors init
#------------------------------------------------------------------------------
rgbled start -I
rgbled_ncp5623c start -I
board_adc start
# Internal I2C bus
hmc5883 -T -I -R 4 start
# Internal SPI (auto detect ms5611 or ms5607)
if ! ms5611 -T 5607 -q -s -b 1 start
then
ms5611 -s -b 1 start
fi
set BOARD_FMUV3 0
# V3 build hwtypecmp supports V2|V2M|V30
if ver hwtypecmp V30
then
# Check for Pixhawk 2.0 cube (isolated IMU on SPI4)
# mpu6000 on v2.0, mpu9250 on v2.1
if mpu6000 -s -b 4 -R 10 start
then
set BOARD_FMUV3 20
else
# Check for Pixhawk 2.1 cube
# isolated/external mpu9250 (SPI4)
if mpu9250 -s -b 4 -R 10 start
then
set BOARD_FMUV3 21
fi
fi
fi
# Check if a Pixhack (which reports as V2M) is present
if ver hwtypecmp V2M
then
# Internal SPI bus ICM-20608-G
icm20608g -s -b 1 -R 14 start
# Pixhawk Mini doesn't have these sensors,
# so if they are found we know its a Pixhack
# mppu6000 internal (SPI1)
if mpu6000 -s -b 1 -R 10 start
then
set BOARD_FMUV3 20
else
# Check for Pixhack 3.1
# mpu9250 external (SPI4)
if mpu9250 -s -b 1 -R 10 start
then
set BOARD_FMUV3 21
fi
fi
fi
if [ $BOARD_FMUV3 != 0 ]
then
# sensor heating is available, but we disable it for now
param set-default SENS_EN_THERMAL 0
# ms5611 (external/isolated SPI4)
ms5611 -s -b 4 start
if [ $BOARD_FMUV3 = 20 ]
then
# v2.0 internal mpu6000
mpu6000 -s -b 1 start
# v2.0 Has internal hmc5883 on SPI1
hmc5883 -T -s -b 1 -R 8 start
fi
if [ $BOARD_FMUV3 = 21 ]
then
# v2.1 mpu9250 on SPI1
mpu9250 -s -b 1 start
fi
# l3gd20 (external/isolated SPI4)
# low quality sensor disabled by default to save memory
#l3gd20 -s -b 4 -R 4 start
# lsm303d (external/isolated SPI4)
lsm303d -s -b 4 -R 6 start
else
# $BOARD_FMUV3 = 0 -> FMUv2
mpu6000 -s -b 1 -R 14 start
# As we will use the external mag and the ICM-20608-G
# V2 build hwtypecmp is always false
# V3 build hwtypecmp supports V2|V2M|V30
if ! ver hwtypecmp V2M
then
mpu9250 -s -b 1 -R 14 -q start
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata
fi
l3gd20 -s -b 1 start
lsm303d -s -b 1 start
fi
unset BOARD_FMUV3