rc.sensors
3.23 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/sh
#
# Standard startup script for sensor drivers.
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#
if ! ver hwcmp OMNIBUS_F4SD
then
if ! ver hwcmp BITCRAZE_CRAZYFLIE
then
# Configure all I2C buses to 100 KHz as they
# are all external or slow
# TODO: move this
pwm_out i2c 1 100000
pwm_out i2c 2 100000
fi
fi
###############################################################################
# Begin Optional drivers #
###############################################################################
if param compare -s SENS_EN_BATT 1
then
batt_smbus start -X
fi
# Sensors on the PWM interface bank
if param compare -s SENS_EN_LL40LS 1
then
if pwm_input start
then
ll40ls_pwm start
fi
fi
# External automatic trigger system
if param compare FD_EXT_ATS_EN 1
then
pwm_input start
fi
# Lidar-Lite on I2C
if param compare -s SENS_EN_LL40LS 2
then
ll40ls start -X
fi
# mappydot lidar sensor
if param compare -s SENS_EN_MPDT 1
then
mappydot start -X
fi
# mb12xx sonar sensor
if param greater -s SENS_EN_MB12XX 0
then
mb12xx start -X
fi
# pga460 sonar sensor
if param greater -s SENS_EN_PGA460 0
then
pga460 start
fi
# Lightware i2c lidar sensor
if param greater -s SENS_EN_SF1XX 0
then
lightware_laser_i2c start -X
fi
# Sensor HY-SRF05 or HC-SR05 ultrasonic sensor
if param compare -s SENS_EN_SR05 1
then
srf05 start
fi
# Heater driver for temperature regulated IMUs.
if param compare -s SENS_EN_THERMAL 1
then
heater start
fi
# Teraranger one tof sensor
if param greater -s SENS_EN_TRANGER 0
then
teraranger start -X
fi
# Possible external pmw3901 optical flow sensor
if param greater -s SENS_EN_PMW3901 0
then
pmw3901 -S start
fi
# Possible external paw3902 optical flow sensor
if param greater -s SENS_EN_PAW3902 0
then
paw3902 -S start
fi
# vl53l1x i2c distance sensor
if param compare -s SENS_EN_VL53L1X 1
then
vl53l1x start -X
fi
# ADIS16448 spi external IMU
if param compare -s SENS_EN_ADIS164X 1
then
adis16448 -S start
fi
# probe for optional external I2C devices
if param compare SENS_EXT_I2C_PRB 1
then
icm20948_i2c_passthrough -X -q start
# compasses
hmc5883 -T -X -q start
ist8308 -X -q start
ist8310 -X -q start
lis2mdl -X -q start
lis3mdl -X -q start
qmc5883l -X -q start
rm3100 -X -q start
# start last (wait for possible icm20948 passthrough mode)
ak09916 -X -q start
# differential pressure sensors
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
then
# Always try to start the airspeed sensors
# even if their usage might be disabled
sdp3x_airspeed start -X -q
sdp3x_airspeed start -X -a 0x22 -q
# Pixhawk 2.1 has a MS5611 on I2C which gets wrongly
# detected as MS5525 because the chip manufacturer was so
# clever to assign the same I2C address and skip a WHO_AM_I
# register.
if [ $BOARD_FMUV3 = 21 ]
then
ms5525_airspeed start -X -b 2 -q
else
ms5525_airspeed start -X -q
fi
ms4525_airspeed start -X -q
ets_airspeed start -X -q
fi
fi
###############################################################################
# End Optional drivers #
###############################################################################
sensors start