Sensor startup: Simplify and fix Pixhawk 2.1

This change simplifies the sensor startup and fixes the detection of airspeed sensors on Pixhawk 2.1
This commit is contained in:
Lorenz Meier
2017-08-06 20:52:23 +02:00
parent c81dd46b02
commit 45f2a52a7d
+82 -231
View File
@@ -5,9 +5,7 @@
if ver hwcmp PX4FMU_V1 if ver hwcmp PX4FMU_V1
then then
if ms5611 start ms5611 start
then
fi
else else
if ver hwcmp AEROFC_V1 if ver hwcmp AEROFC_V1
then then
@@ -35,19 +33,13 @@ else
fi fi
# External SPI # External SPI
if ms5611 -S start ms5611 -S start
then
fi
# Internal SPI # Internal SPI
if ms5611 -s start ms5611 -s start
then
fi
# Blacksheep telemetry # Blacksheep telemetry
if bst start bst start
then
fi
fi fi
fi fi
@@ -55,50 +47,34 @@ if ver hwcmp AEROFC_V1
then then
# Aero FC uses separate driver # Aero FC uses separate driver
else else
if adc start adc start
then
fi
fi fi
if ver hwcmp AUAV_X21 if ver hwcmp AUAV_X21
then then
# External I2C bus # External I2C bus
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
# Internal SPI bus ICM-20608-G is rotated 90 deg yaw # Internal SPI bus ICM-20608-G is rotated 90 deg yaw
if mpu6000 -R 2 -T 20608 start mpu6000 -R 2 -T 20608 start
then
fi
# Internal SPI bus mpu9250 is rotated 90 deg yaw # Internal SPI bus mpu9250 is rotated 90 deg yaw
if mpu9250 -R 2 start mpu9250 -R 2 start
then
fi
fi fi
if ver hwcmp PX4FMU_V2 if ver hwcmp PX4FMU_V2
then then
# External I2C bus # External I2C bus
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
# External I2C bus # External I2C bus
if lis3mdl -X start lis3mdl -X start
then
fi
# Internal I2C bus # Internal I2C bus
if hmc5883 -C -T -I -R 4 start hmc5883 -C -T -I -R 4 start
then
fi
# Internal SPI bus ICM-20608-G # Internal SPI bus ICM-20608-G
if mpu6000 -T 20608 start mpu6000 -T 20608 start
then
fi
# V2 build hwtypecmp is always false # V2 build hwtypecmp is always false
set BOARD_FMUV3 0 set BOARD_FMUV3 0
@@ -126,41 +102,29 @@ then
param set SENS_EN_THERMAL 0 param set SENS_EN_THERMAL 0
# external L3GD20H is rotated 180 degrees yaw # external L3GD20H is rotated 180 degrees yaw
if l3gd20 -X -R 4 start l3gd20 -X -R 4 start
then
fi
# external LSM303D is rotated 270 degrees yaw # external LSM303D is rotated 270 degrees yaw
if lsm303d -X -R 6 start lsm303d -X -R 6 start
then
fi
if [ $BOARD_FMUV3 == 20 ] if [ $BOARD_FMUV3 == 20 ]
then then
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw # v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw
if mpu6000 -R 14 start mpu6000 -R 14 start
then
fi
# v2.0 Has internal hmc5883 on SPI1 # v2.0 Has internal hmc5883 on SPI1
if hmc5883 -C -T -S -R 8 start hmc5883 -C -T -S -R 8 start
then
fi
fi fi
if [ $BOARD_FMUV3 == 21 ] if [ $BOARD_FMUV3 == 21 ]
then then
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw # v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw
if mpu9250 -R 14 start mpu9250 -R 14 start
then
fi
fi fi
else else
# $BOARD_FMUV3 == 0 -> FMUv2 # $BOARD_FMUV3 == 0 -> FMUv2
if mpu6000 start mpu6000 start
then
fi
# As we will use the external mag and the ICM-20608-G # As we will use the external mag and the ICM-20608-G
# V2 build hwtypecmp is always false # V2 build hwtypecmp is always false
@@ -169,115 +133,75 @@ then
then then
# On the PixhawkMini the mpu9250 has been disabled due to HW errata # On the PixhawkMini the mpu9250 has been disabled due to HW errata
else else
if mpu9250 start mpu9250 start
then
fi
fi fi
if l3gd20 start l3gd20 start
then lsm303d start
fi
if lsm303d start
then
fi
fi fi
fi fi
if ver hwcmp PX4FMU_V4 if ver hwcmp PX4FMU_V4
then then
# External I2C bus # External I2C bus
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
if lis3mdl -R 2 start lis3mdl -R 2 start
then
fi
# Internal SPI bus is rotated 90 deg yaw # Internal SPI bus is rotated 90 deg yaw
if hmc5883 -C -T -S -R 2 start hmc5883 -C -T -S -R 2 start
then
fi
# Internal SPI bus ICM-20608-G is rotated 90 deg yaw # Internal SPI bus ICM-20608-G is rotated 90 deg yaw
if mpu6000 -R 2 -T 20608 start mpu6000 -R 2 -T 20608 start
then
fi
# Internal SPI bus ICM-20602-G is rotated 90 deg yaw # Internal SPI bus ICM-20602-G is rotated 90 deg yaw
if mpu6000 -R 2 -T 20602 start mpu6000 -R 2 -T 20602 start
then
fi
# Start either MPU9250 or BMI160. They are both connected to the same SPI bus and use the same # Start either MPU9250 or BMI160. They are both connected to the same SPI bus and use the same
# chip select pin. There are different boards with either one of them and the WHO_AM_I register # chip select pin. There are different boards with either one of them and the WHO_AM_I register
# will prevent the incorrect driver from a successful initialization. # will prevent the incorrect driver from a successful initialization.
# Internal SPI bus mpu9250 is rotated 90 deg yaw # Internal SPI bus mpu9250 is rotated 90 deg yaw
if mpu9250 -R 2 start mpu9250 -R 2 start
then
fi
# Internal SPI bus BMI160 # Internal SPI bus BMI160
if bmi160 start bmi160 start
then
fi
# Start either ICM2060X or BMI055. They are both connected to the same SPI bus and use the same # Start either ICM2060X or BMI055. They are both connected to the same SPI bus and use the same
# chip select pin. There are different boards with either one of them and the WHO_AM_I register # chip select pin. There are different boards with either one of them and the WHO_AM_I register
# will prevent the incorrect driver from a successful initialization. # will prevent the incorrect driver from a successful initialization.
# Internal SPI bus BMI055_ACC # Internal SPI bus BMI055_ACC
if bmi055 -A start bmi055 -A start
then
fi
# Internal SPI bus BMI055_GYR # Internal SPI bus BMI055_GYR
if bmi055 -G start bmi055 -G start
then
fi
# expansion i2c used for BMM150 rotated by 90deg # expansion i2c used for BMM150 rotated by 90deg
if bmm150 -R 2 start bmm150 -R 2 start
then
fi
# expansion i2c used for BMP280 # expansion i2c used for BMP280
if bmp280 -I start bmp280 -I start
then
fi
fi fi
if ver hwcmp PX4FMU_V1 if ver hwcmp PX4FMU_V1
then then
# FMUv1 # FMUv1
if mpu6000 start mpu6000 start
then l3gd20 start
fi
if l3gd20 start
then
fi
# MAG selection # MAG selection
if param compare SENS_EXT_MAG 2 if param compare SENS_EXT_MAG 2
then then
if hmc5883 -C -I start hmc5883 -C -I start
then
fi
else else
# Use only external as primary # Use only external as primary
if param compare SENS_EXT_MAG 1 if param compare SENS_EXT_MAG 1
then then
if hmc5883 -C -X start hmc5883 -C -X start
then
fi
else else
# auto-detect the primary, prefer external # auto-detect the primary, prefer external
if hmc5883 start hmc5883 start
then
fi
fi fi
fi fi
fi fi
@@ -285,128 +209,75 @@ fi
if ver hwcmp MINDPX_V2 if ver hwcmp MINDPX_V2
then then
# External I2C bus # External I2C bus
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
# Internal I2C bus # Internal I2C bus
if hmc5883 -C -T -I -R 12 start hmc5883 -C -T -I -R 12 start
then mpu6000 -s -R 8 start
fi mpu9250 -s -R 8 start
lsm303d -R 10 start
if mpu6000 -s -R 8 start l3gd20 -R 14 start
then
fi
if mpu9250 -s -R 8 start
then
fi
if lsm303d -R 10 start
then
fi
if l3gd20 -R 14 start
then
fi
fi fi
if ver hwcmp CRAZYFLIE if ver hwcmp CRAZYFLIE
then then
# Onboard I2C # Onboard I2C
if mpu9250 -R 12 start mpu9250 -R 12 start
then
fi
# I2C bypass of mpu # I2C bypass of mpu
if lps25h start lps25h start
then
fi
fi fi
if ver hwcmp AEROFC_V1 if ver hwcmp AEROFC_V1
then then
if ms5611 -T 0 start ms5611 -T 0 start
then
fi
if mpu9250 -s -R 14 start mpu9250 -s -R 14 start
then
fi
# Possible external compasses # Possible external compasses
if hmc5883 -X start hmc5883 -X start
then
fi
if ist8310 -C -b 1 -R 4 start ist8310 -C -b 1 -R 4 start
then
fi
if aerofc_adc start aerofc_adc start
then
fi
if ll40ls start i2c ll40ls start i2c
then
fi
fi fi
if ver hwcmp PX4FMU_V4PRO if ver hwcmp PX4FMU_V4PRO
then then
# Internal SPI bus ICM-20608-G # Internal SPI bus ICM-20608-G
if mpu6000 -R 2 -T 20608 start mpu6000 -R 2 -T 20608 start
then
fi
# Internal SPI bus ICM-20602 # Internal SPI bus ICM-20602
if mpu6000 -R 2 -T 20602 start mpu6000 -R 2 -T 20602 start
then
fi
# Internal SPI bus mpu9250 # Internal SPI bus mpu9250
if mpu9250 -R 2 start mpu9250 -R 2 start
then
fi
# Internal SPI bus # Internal SPI bus
if lis3mdl -R 0 start lis3mdl -R 0 start
then
fi
# Possible external compasses # Possible external compasses
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
fi fi
if ver hwcmp PX4FMU_V5 if ver hwcmp PX4FMU_V5
then then
# Internal SPI bus ICM-20602 # Internal SPI bus ICM-20602
if mpu6000 -R 8 -s -T 20602 start mpu6000 -R 8 -s -T 20602 start
then
fi
# Internal SPI bus ICM-20689 # Internal SPI bus ICM-20689
if mpu6000 -R 8 -z -T 20689 start mpu6000 -R 8 -z -T 20689 start
then
fi
# Internal SPI bus BMI055 accel # Internal SPI bus BMI055 accel
if bmi055 -A -R 10 start bmi055 -A -R 10 start
then
fi
# Internal SPI bus BMI055 gyro # Internal SPI bus BMI055 gyro
if bmi055 -G -R 10 start bmi055 -G -R 10 start
then
fi
# Possible external compasses # Possible external compasses
if hmc5883 -C -T -X start hmc5883 -C -T -X start
then
fi
fi fi
if ver hwcmp AEROCORE2 if ver hwcmp AEROCORE2
@@ -419,85 +290,65 @@ fi
# Optional drivers # Optional drivers
# #
if sdp3x_airspeed start sdp3x_airspeed start
sdp3x_airspeed start -b 2
# 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 then
ms5525_airspeed start -b 2
else
ms5525_airspeed start
fi fi
if ms5525_airspeed start ms4525_airspeed start
then ms4525_airspeed start -b 2
fi
if ms5525_airspeed start -b 2 ets_airspeed start
then ets_airspeed start -b 1
fi
if ms4525_airspeed start
then
fi
if ms4525_airspeed start -b 2
then
fi
if ets_airspeed start
then
fi
if ets_airspeed start -b 1
then
fi
# Sensors on the PWM interface bank # Sensors on the PWM interface bank
if param compare SENS_EN_LL40LS 1 if param compare SENS_EN_LL40LS 1
then then
if pwm_input start if pwm_input start
then then
if ll40ls start pwm ll40ls start pwm
then
fi
fi fi
fi fi
# Lidar-Lite on I2C # Lidar-Lite on I2C
if param compare SENS_EN_LL40LS 2 if param compare SENS_EN_LL40LS 2
then then
if ll40ls start i2c ll40ls start i2c
then
fi
fi fi
# lightware serial lidar sensor # lightware serial lidar sensor
if param compare SENS_EN_SF0X 0 if param compare SENS_EN_SF0X 0
then then
else else
if sf0x start sf0x start
then
fi
fi fi
# lightware i2c lidar sensor # lightware i2c lidar sensor
if param compare SENS_EN_SF1XX 0 if param compare SENS_EN_SF1XX 0
then then
else else
if sf1xx start sf1xx start
then
fi
fi fi
# mb12xx sonar sensor # mb12xx sonar sensor
if param compare SENS_EN_MB12XX 1 if param compare SENS_EN_MB12XX 1
then then
if mb12xx start mb12xx start
then
fi
fi fi
# teraranger one tof sensor # teraranger one tof sensor
if param compare SENS_EN_TRONE 1 if param compare SENS_EN_TRONE 1
then then
if trone start trone start
then
fi
fi fi
# Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire) # Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire)