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

130 lines
2.6 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# 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
# TODO: move this
pwm_out i2c 1 100000
pwm_out i2c 2 100000
2017-08-10 15:31:54 -03:00
fi
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 -X
sdp3x_airspeed start -X -a 0x22
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 -X -b 2
else
ms5525_airspeed start -X
fi
2017-05-22 11:06:29 -03:00
ms4525_airspeed start -X
ets_airspeed start -X
fi
fi
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
2020-03-02 06:50:25 -04:00
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
2020-03-02 08:55:55 -04:00
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
2020-03-02 09:43:09 -04:00
sf1xx start -X
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
###############################################################################
# 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