px4-firmware/ROMFS/px4fmu_common/init.d/rc.sensors

113 lines
2.3 KiB
Plaintext
Raw Normal View History

#!nsh
#
# Standard startup script for sensor drivers.
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#
if ! ver hwcmp AEROFC_V1 OMNIBUS_F4SD
then
if ! ver hwcmp BITCRAZE_CRAZYFLIE
2016-11-08 16:58:32 -04:00
then
2017-08-10 15:31:54 -03:00
# Configure all I2C buses to 100 KHz as they
# are all external or slow
fmu i2c 1 100000
fmu i2c 2 100000
fi
2016-12-04 00:53:50 -04:00
2017-08-10 15:31:54 -03:00
# External SPI
ms5611 -S start
2016-12-04 00:53:50 -04:00
# Internal SPI (auto detect ms5611 or ms5607)
ms5611 -T 0 -s start
2016-12-04 00:53:50 -04:00
2017-08-10 15:31:54 -03:00
# Blacksheep telemetry
bst start
adc start
fi
###############################################################################
# Begin Optional drivers #
###############################################################################
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
2017-05-22 11:06:29 -03:00
then
if param compare CBRK_AIRSPD_CHK 0
then
sdp3x_airspeed start -a
2017-05-22 11:06:29 -03:00
# 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 -b 2
else
ms5525_airspeed start -a
fi
2017-05-22 11:06:29 -03:00
ms4525_airspeed start -a
ets_airspeed start -a
fi
fi
# Sensors on the PWM interface bank
if param compare SENS_EN_LL40LS 1
then
if pwm_input start
then
ll40ls start pwm
fi
fi
# Lidar-Lite on I2C
if param compare SENS_EN_LL40LS 2
then
ll40ls start i2c
fi
# mb12xx sonar sensor
if param greater SENS_EN_MB12XX 0
then
mb12xx start -a
fi
# pga460 sonar sensor
if param greater SENS_EN_PGA460 0
then
pga460 start
fi
# Lightware i2c lidar sensor
if param greater SENS_EN_SF1XX 0
then
sf1xx start -a
fi
# Heater driver for temperature regulated IMUs.
if param compare SENS_EN_THERMAL 1
then
heater start
fi
# Teraranger one tof sensor
if param greater SENS_EN_TRANGER 0
then
teraranger start -a
fi
# ICM20948 as external magnetometer on I2C (e.g. Here GPS)
mpu9250 -X -M -R 6 start
###############################################################################
# End Optional drivers #
###############################################################################
2015-09-07 10:43:43 -03:00
# Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire)
usleep 20000
sensors start