2018-12-18 04:26:22 -04:00
|
|
|
#!/bin/sh
|
2013-04-26 20:14:32 -03:00
|
|
|
#
|
2017-10-05 18:29:44 -03:00
|
|
|
# Standard startup script for sensor drivers.
|
2013-04-26 20:14:32 -03:00
|
|
|
#
|
2018-07-26 21:18:53 -03:00
|
|
|
# NOTE: Script variables are declared/initialized/unset in the rcS script.
|
|
|
|
#
|
2013-04-26 20:14:32 -03:00
|
|
|
|
2018-08-11 05:33:43 -03:00
|
|
|
if ! ver hwcmp AEROFC_V1 OMNIBUS_F4SD
|
2015-05-10 05:21:16 -03:00
|
|
|
then
|
2018-11-22 00:27:21 -04:00
|
|
|
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-06 15:09:52 -03:00
|
|
|
adc start
|
2015-05-10 05:21:16 -03:00
|
|
|
fi
|
2013-04-26 20:14:32 -03:00
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
###############################################################################
|
|
|
|
# Begin Optional drivers #
|
|
|
|
###############################################################################
|
2017-06-16 12:49:14 -03:00
|
|
|
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
|
2017-05-22 11:06:29 -03:00
|
|
|
then
|
2017-10-05 18:29:44 -03:00
|
|
|
if param compare CBRK_AIRSPD_CHK 0
|
|
|
|
then
|
2018-06-17 16:04:10 -03:00
|
|
|
sdp3x_airspeed start -a
|
2017-05-22 11:06:29 -03:00
|
|
|
|
2017-10-05 18:29:44 -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.
|
2018-09-27 06:11:12 -03:00
|
|
|
if [ $BOARD_FMUV3 = 21 ]
|
2017-10-05 18:29:44 -03:00
|
|
|
then
|
|
|
|
ms5525_airspeed start -b 2
|
|
|
|
else
|
2018-06-17 16:04:10 -03:00
|
|
|
ms5525_airspeed start -a
|
2017-10-05 18:29:44 -03:00
|
|
|
fi
|
2017-05-22 11:06:29 -03:00
|
|
|
|
2018-06-17 16:04:10 -03:00
|
|
|
ms4525_airspeed start -a
|
|
|
|
|
|
|
|
ets_airspeed start -a
|
2017-10-05 18:29:44 -03:00
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
2013-09-29 09:07:01 -03:00
|
|
|
|
2018-12-05 10:49:58 -04:00
|
|
|
if param compare SENS_EN_BATT 1
|
|
|
|
then
|
|
|
|
batt_smbus start -X
|
|
|
|
fi
|
|
|
|
|
2017-06-16 12:49:14 -03:00
|
|
|
# Sensors on the PWM interface bank
|
|
|
|
if param compare SENS_EN_LL40LS 1
|
|
|
|
then
|
|
|
|
if pwm_input start
|
|
|
|
then
|
2017-08-06 15:09:52 -03:00
|
|
|
ll40ls start pwm
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Lidar-Lite on I2C
|
|
|
|
if param compare SENS_EN_LL40LS 2
|
|
|
|
then
|
2017-08-06 15:09:52 -03:00
|
|
|
ll40ls start i2c
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2019-06-15 22:13:52 -03:00
|
|
|
# mappydot lidar sensor
|
|
|
|
if param compare SENS_EN_MPDT 1
|
|
|
|
then
|
|
|
|
mappydot start -a
|
|
|
|
fi
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# mb12xx sonar sensor
|
|
|
|
if param greater SENS_EN_MB12XX 0
|
|
|
|
then
|
|
|
|
mb12xx start -a
|
|
|
|
fi
|
|
|
|
|
2018-08-23 21:01:08 -03:00
|
|
|
# pga460 sonar sensor
|
|
|
|
if param greater SENS_EN_PGA460 0
|
|
|
|
then
|
|
|
|
pga460 start
|
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
# Lightware i2c lidar sensor
|
2017-10-05 18:29:44 -03:00
|
|
|
if param greater SENS_EN_SF1XX 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2018-06-22 11:10:24 -03:00
|
|
|
sf1xx start -a
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# Heater driver for temperature regulated IMUs.
|
|
|
|
if param compare SENS_EN_THERMAL 1
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2018-05-19 12:33:20 -03:00
|
|
|
heater start
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
# Teraranger one tof sensor
|
2017-10-05 18:29:44 -03:00
|
|
|
if param greater SENS_EN_TRANGER 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2018-06-22 11:10:24 -03:00
|
|
|
teraranger start -a
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
###############################################################################
|
|
|
|
# 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
|
2017-10-05 18:29:44 -03:00
|
|
|
sensors start
|