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
|
|
|
|
2021-02-25 06:27:13 -04:00
|
|
|
if ! ver hwcmp 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
|
2020-03-27 16:31:04 -03:00
|
|
|
# TODO: move this
|
|
|
|
pwm_out i2c 1 100000
|
|
|
|
pwm_out i2c 2 100000
|
2017-08-10 15:31:54 -03:00
|
|
|
fi
|
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
|
|
|
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_BATT 1
|
2018-12-05 10:49:58 -04:00
|
|
|
then
|
|
|
|
batt_smbus start -X
|
|
|
|
fi
|
|
|
|
|
2017-06-16 12:49:14 -03:00
|
|
|
# Sensors on the PWM interface bank
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_LL40LS 1
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
|
|
|
if pwm_input start
|
|
|
|
then
|
2020-03-03 14:01:59 -04:00
|
|
|
ll40ls_pwm start
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-01-06 21:14:06 -04:00
|
|
|
# External automatic trigger system
|
|
|
|
if param compare FD_EXT_ATS_EN 1
|
|
|
|
then
|
|
|
|
pwm_input start
|
|
|
|
fi
|
|
|
|
|
2017-06-16 12:49:14 -03:00
|
|
|
# Lidar-Lite on I2C
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_LL40LS 2
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-03-02 06:50:25 -04:00
|
|
|
ll40ls start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2019-06-15 22:13:52 -03:00
|
|
|
# mappydot lidar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s SENS_EN_MPDT 1
|
2019-06-15 22:13:52 -03:00
|
|
|
then
|
2020-03-02 07:03:10 -04:00
|
|
|
mappydot start -X
|
2019-06-15 22:13:52 -03:00
|
|
|
fi
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# mb12xx sonar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_MB12XX 0
|
2018-05-19 12:33:20 -03:00
|
|
|
then
|
2020-03-02 08:55:55 -04:00
|
|
|
mb12xx start -X
|
2018-05-19 12:33:20 -03:00
|
|
|
fi
|
|
|
|
|
2018-08-23 21:01:08 -03:00
|
|
|
# pga460 sonar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_PGA460 0
|
2018-08-23 21:01:08 -03:00
|
|
|
then
|
|
|
|
pga460 start
|
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
# Lightware i2c lidar sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_SF1XX 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-10-22 03:40:28 -03:00
|
|
|
lightware_laser_i2c start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2020-11-08 14:25:58 -04:00
|
|
|
# Sensor HY-SRF05 or HC-SR05 ultrasonic sensor
|
|
|
|
if param compare -s SENS_EN_SR05 1
|
|
|
|
then
|
|
|
|
srf05 start
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2018-05-19 12:33:20 -03:00
|
|
|
# Heater driver for temperature regulated IMUs.
|
2019-10-07 04:50:12 -03:00
|
|
|
if param compare -s 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
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_TRANGER 0
|
2017-06-16 12:49:14 -03:00
|
|
|
then
|
2020-03-02 10:03:57 -04:00
|
|
|
teraranger start -X
|
2017-06-16 12:49:14 -03:00
|
|
|
fi
|
|
|
|
|
2020-02-26 09:35:14 -04:00
|
|
|
# Possible external pmw3901 optical flow sensor
|
2019-10-07 04:50:12 -03:00
|
|
|
if param greater -s SENS_EN_PMW3901 0
|
2019-09-02 12:08:51 -03:00
|
|
|
then
|
2020-02-26 09:35:14 -04:00
|
|
|
pmw3901 -S start
|
2019-09-02 12:08:51 -03:00
|
|
|
fi
|
|
|
|
|
2020-03-26 12:24:48 -03:00
|
|
|
# Possible external paw3902 optical flow sensor
|
|
|
|
if param greater -s SENS_EN_PAW3902 0
|
|
|
|
then
|
|
|
|
paw3902 -S start
|
|
|
|
fi
|
|
|
|
|
2020-12-07 14:17:02 -04:00
|
|
|
# vl53l1x i2c distance sensor
|
2020-12-08 13:10:25 -04:00
|
|
|
if param compare -s SENS_EN_VL53L1X 1
|
2020-12-07 14:17:02 -04:00
|
|
|
then
|
|
|
|
vl53l1x start -X
|
|
|
|
fi
|
|
|
|
|
2020-06-08 11:28:38 -03:00
|
|
|
# probe for optional external I2C devices
|
|
|
|
if param compare SENS_EXT_I2C_PRB 1
|
|
|
|
then
|
|
|
|
# compasses
|
2020-08-26 03:46:35 -03:00
|
|
|
ak09916 -X -R 6 -q start # external AK09916 (Here2) is rotated 270 degrees yaw
|
|
|
|
hmc5883 -T -X -q start
|
|
|
|
ist8308 -X -q start
|
|
|
|
ist8310 -X -q start
|
|
|
|
lis2mdl -X -q start
|
|
|
|
lis3mdl -X -q start
|
2020-09-02 14:16:27 -03:00
|
|
|
qmc5883l -X -q start
|
2020-08-26 03:46:35 -03:00
|
|
|
rm3100 -X -q start
|
2020-06-08 11:28:38 -03:00
|
|
|
|
|
|
|
# differential pressure sensors
|
|
|
|
if [ ${VEHICLE_TYPE} = fw -o ${VEHICLE_TYPE} = vtol ]
|
|
|
|
then
|
2021-03-10 15:36:18 -04:00
|
|
|
# Always try to start the airspeed sensors
|
|
|
|
# even if their usage might be disabled
|
|
|
|
sdp3x_airspeed start -X -q
|
|
|
|
sdp3x_airspeed start -X -a 0x22 -q
|
|
|
|
|
|
|
|
# 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 ]
|
2020-06-08 11:28:38 -03:00
|
|
|
then
|
2021-03-10 15:36:18 -04:00
|
|
|
ms5525_airspeed start -X -b 2 -q
|
|
|
|
else
|
|
|
|
ms5525_airspeed start -X -q
|
2020-06-08 11:28:38 -03:00
|
|
|
fi
|
2021-03-10 15:36:18 -04:00
|
|
|
|
|
|
|
ms4525_airspeed start -X -q
|
|
|
|
|
|
|
|
ets_airspeed start -X -q
|
2020-06-08 11:28:38 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-07-20 01:32:11 -03:00
|
|
|
###############################################################################
|
|
|
|
# End Optional drivers #
|
|
|
|
###############################################################################
|
|
|
|
|
2017-10-05 18:29:44 -03:00
|
|
|
sensors start
|