2013-04-26 20:14:32 -03:00
|
|
|
#!nsh
|
|
|
|
#
|
2015-02-09 08:57:04 -04:00
|
|
|
# Standard startup script for PX4FMU v1, v2, v3 onboard sensor drivers.
|
2013-04-26 20:14:32 -03:00
|
|
|
#
|
|
|
|
|
2015-05-10 05:21:16 -03:00
|
|
|
if ms5611 start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
|
|
|
if adc start
|
|
|
|
then
|
|
|
|
fi
|
2013-04-26 20:14:32 -03:00
|
|
|
|
2015-02-09 08:57:04 -04:00
|
|
|
if ver hwcmp PX4FMU_V2
|
2014-07-16 10:02:25 -03:00
|
|
|
then
|
2015-02-09 09:50:26 -04:00
|
|
|
# External I2C bus
|
2015-04-10 19:59:58 -03:00
|
|
|
if hmc5883 -C -T -X start
|
2015-02-09 08:57:04 -04:00
|
|
|
then
|
|
|
|
fi
|
2014-07-16 10:02:25 -03:00
|
|
|
|
2015-02-09 09:50:26 -04:00
|
|
|
# Internal I2C bus
|
2015-04-10 19:59:58 -03:00
|
|
|
if hmc5883 -C -T -I -R 4 start
|
2015-02-09 08:57:04 -04:00
|
|
|
then
|
|
|
|
fi
|
2013-12-15 14:35:23 -04:00
|
|
|
|
2015-02-09 08:57:04 -04:00
|
|
|
# external MPU6K is rotated 180 degrees yaw
|
|
|
|
if mpu6000 -X -R 4 start
|
2014-07-16 06:26:32 -03:00
|
|
|
then
|
2015-02-09 08:57:04 -04:00
|
|
|
set BOARD_FMUV3 true
|
|
|
|
else
|
|
|
|
set BOARD_FMUV3 false
|
2014-07-16 06:26:32 -03:00
|
|
|
fi
|
2015-02-09 08:57:04 -04:00
|
|
|
|
|
|
|
if [ $BOARD_FMUV3 == true ]
|
2014-07-16 06:26:32 -03:00
|
|
|
then
|
2015-02-09 08:57:04 -04:00
|
|
|
# external L3GD20H is rotated 180 degrees yaw
|
|
|
|
if l3gd20 -X -R 4 start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
|
|
|
# external LSM303D is rotated 270 degrees yaw
|
|
|
|
if lsm303d -X -R 6 start
|
2014-07-16 09:58:43 -03:00
|
|
|
then
|
|
|
|
fi
|
2015-02-09 08:57:04 -04:00
|
|
|
|
|
|
|
# internal MPU6000 is rotated 180 deg roll, 270 deg yaw
|
|
|
|
if mpu6000 -R 14 start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
2015-04-10 19:59:58 -03:00
|
|
|
if hmc5883 -C -T -S -R 8 start
|
2015-02-09 09:50:26 -04:00
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
2014-07-16 09:58:43 -03:00
|
|
|
else
|
2015-02-09 08:57:04 -04:00
|
|
|
# FMUv2
|
|
|
|
if mpu6000 start
|
2014-07-16 06:26:32 -03:00
|
|
|
then
|
|
|
|
fi
|
2014-07-16 09:58:43 -03:00
|
|
|
|
2015-02-09 08:57:04 -04:00
|
|
|
if l3gd20 start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
|
|
|
if lsm303d start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# FMUv1
|
|
|
|
if mpu6000 start
|
2014-07-16 10:02:25 -03:00
|
|
|
then
|
|
|
|
fi
|
|
|
|
|
2015-02-09 08:57:04 -04:00
|
|
|
if l3gd20 start
|
2014-01-14 19:02:57 -04:00
|
|
|
then
|
|
|
|
fi
|
2014-10-15 11:33:46 -03:00
|
|
|
|
2015-02-09 08:57:04 -04:00
|
|
|
# MAG selection
|
|
|
|
if param compare SENS_EXT_MAG 2
|
2014-10-15 11:33:46 -03:00
|
|
|
then
|
2015-02-09 08:57:04 -04:00
|
|
|
if hmc5883 -C -I start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Use only external as primary
|
|
|
|
if param compare SENS_EXT_MAG 1
|
|
|
|
then
|
|
|
|
if hmc5883 -C -X start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# auto-detect the primary, prefer external
|
|
|
|
if hmc5883 start
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
fi
|
2014-10-15 11:33:46 -03:00
|
|
|
fi
|
2013-04-26 20:14:32 -03:00
|
|
|
fi
|
|
|
|
|
2013-09-29 09:07:01 -03:00
|
|
|
if meas_airspeed start
|
|
|
|
then
|
|
|
|
else
|
|
|
|
if ets_airspeed start
|
|
|
|
then
|
|
|
|
else
|
|
|
|
if ets_airspeed start -b 1
|
|
|
|
then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
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
|
2015-03-08 10:55:51 -03:00
|
|
|
sensors start
|