boards: centralize optional external I2C sensor start

- configured with new parameter SENS_EXT_I2C_PRB
This commit is contained in:
Daniel Agar 2020-06-08 10:28:38 -04:00
parent 13d983d305
commit 6f6efd60b7
26 changed files with 63 additions and 217 deletions

View File

@ -21,31 +21,6 @@ fi
# Begin Optional drivers #
###############################################################################
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
then
if param compare CBRK_AIRSPD_CHK 0
then
sdp3x_airspeed start -X
sdp3x_airspeed start -X -a 0x22
# 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
else
ms5525_airspeed start -X
fi
ms4525_airspeed start -X
ets_airspeed start -X
fi
fi
if param compare -s SENS_EN_BATT 1
then
batt_smbus start -X
@ -120,10 +95,47 @@ then
paw3902 -S start
fi
# probe for optional external I2C devices
if param compare SENS_EXT_I2C_PRB 1
then
# compasses
ak09916 -X -R 6 start # external AK09916 (Here2) is rotated 270 degrees yaw
hmc5883 -T -X start
ist8308 -X start
ist8310 -X start
lis2mdl -X start
lis3mdl -X start
qmc5883 -X start
rm3100 -X start
# differential pressure sensors
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
then
if param compare CBRK_AIRSPD_CHK 0
then
sdp3x_airspeed start -X
sdp3x_airspeed start -X -a 0x22
# 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
else
ms5525_airspeed start -X
fi
ms4525_airspeed start -X
ets_airspeed start -X
fi
fi
fi
###############################################################################
# End Optional drivers #
###############################################################################
# Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire)
usleep 20000
sensors start