Browse Source

move fmu-v2/v3 init to rc.board

sbg
Daniel Agar 6 years ago
parent
commit
c6a502f150
  1. 101
      ROMFS/px4fmu_common/init.d/rc.sensors
  2. 34
      ROMFS/px4fmu_common/init.d/rcS
  3. 61
      ROMFS/px4fmu_test/init.d/rc.sensors
  4. 11
      ROMFS/px4fmu_test/init.d/rcS
  5. 141
      boards/px4/fmu-v2/init/rc.board
  6. 141
      boards/px4/fmu-v3/init/rc.board

101
ROMFS/px4fmu_common/init.d/rc.sensors

@ -5,9 +5,6 @@ @@ -5,9 +5,6 @@
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#
set BOARD_FMUV3 0
###############################################################################
# Begin Setup for board specific configurations. #
###############################################################################
@ -148,102 +145,6 @@ then @@ -148,102 +145,6 @@ then
adc start
fi
if ver hwcmp PX4_FMU_V2
then
# External I2C bus
hmc5883 -C -T -X start
lis3mdl -X start
ist8310 -C start
# Internal I2C bus
hmc5883 -C -T -I -R 4 start
# Internal SPI bus ICM-20608-G
mpu6000 -T 20608 start
# V3 build hwtypecmp supports V2|V2M|V30
if ver hwtypecmp V30
then
# Check for Pixhawk 2.0 cube
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhawk 2.1 cube
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
# Check if a Pixhack (which reports as V2M) is present
if ver hwtypecmp V2M
then
# Pixhawk Mini doesn't have these sensors,
# so if they are found we know its a Pixhack
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhack 3.1
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
if [ $BOARD_FMUV3 != 0 ]
then
# sensor heating is available, but we disable it for now
param set SENS_EN_THERMAL 0
# external L3GD20H is rotated 180 degrees yaw
l3gd20 -X -R 4 start
# external LSM303D is rotated 270 degrees yaw
lsm303d -X -R 6 start
if [ $BOARD_FMUV3 = 20 ]
then
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw
mpu6000 -R 14 start
# v2.0 Has internal hmc5883 on SPI1
hmc5883 -C -T -S -R 8 start
fi
if [ $BOARD_FMUV3 = 21 ]
then
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw
mpu9250 -R 14 start
fi
else
# $BOARD_FMUV3 = 0 -> FMUv2
mpu6000 start
# As we will use the external mag and the ICM-20608-G
# V2 build hwtypecmp is always false
# V3 build hwtypecmp supports V2|V2M|V30
if ! ver hwtypecmp V2M
then
mpu9250 start
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata
fi
l3gd20 start
lsm303d start
fi
fi
if ver hwcmp ATMEL_SAME70XPLAINED_V1
then
# External I2C bus
@ -334,8 +235,6 @@ fi @@ -334,8 +235,6 @@ fi
# End Optional drivers #
###############################################################################
unset BOARD_FMUV3
# Wait 20 ms for sensors (because we need to wait for the HRT and work queue callbacks to fire)
usleep 20000
sensors start

34
ROMFS/px4fmu_common/init.d/rcS

@ -15,17 +15,6 @@ set +e @@ -15,17 +15,6 @@ set +e
#
#------------------------------------------------------------------------------
#
# UART mapping on FMUv2/3:
#
# UART1 /dev/ttyS0 IO debug
# USART2 /dev/ttyS1 TELEM1 (flow control)
# USART3 /dev/ttyS2 TELEM2 (flow control)
# UART4
# UART7 CONSOLE
# UART8 /dev/ttyS6 SERIAL4/TELEM4
#
#------------------------------------------------------------------------------
#
# UART mapping on OMNIBUSF4SD:
#
# USART1 /dev/ttyS0 SerialRX
@ -200,27 +189,6 @@ else @@ -200,27 +189,6 @@ else
param reset
fi
#
# Bootloader upgrade
#
if ver hwcmp PX4_FMU_V2
then
set BL_FILE /etc/extras/px4fmuv3_bl.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..." >> $LOG_FILE
bl_update $BL_FILE
echo "BL update done" >> $LOG_FILE
reboot
fi
fi
unset BL_FILE
fi
#
# Start system state indicator.
#
@ -549,7 +517,7 @@ else @@ -549,7 +517,7 @@ else
#
# Launch the flow sensor as a background task.
#
if ver hwcmp PX4_FMU_V2 PX4_FMU_V4 AIRMIND_MINDPX_V2 OMNIBUS_F4SD
if ver hwcmp PX4_FMU_V4 AIRMIND_MINDPX_V2 OMNIBUS_F4SD
then
px4flow start &
fi

61
ROMFS/px4fmu_test/init.d/rc.sensors

@ -21,67 +21,6 @@ if adc start @@ -21,67 +21,6 @@ if adc start
then
fi
if ver hwcmp PX4_FMU_V2
then
# External I2C bus
if hmc5883 -C -T -X start
then
fi
# External I2C bus
if lis3mdl -X start
then
fi
# Internal I2C bus
if hmc5883 -C -T -I -R 4 start
then
fi
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -X -R 4 start
then
set BOARD_FMUV3 true
else
set BOARD_FMUV3 false
fi
if [ $BOARD_FMUV3 = true ]
then
# 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
then
fi
# internal MPU6000 is rotated 180 deg roll, 270 deg yaw
if mpu6000 -R 14 start
then
fi
if hmc5883 -C -T -S -R 8 start
then
fi
else
# FMUv2
if mpu6000 start
then
fi
if l3gd20 start
then
fi
if lsm303d start
then
fi
fi
fi
if ver hwcmp AIRMIND_MINDPX_V2
then
# External I2C bus

11
ROMFS/px4fmu_test/init.d/rcS

@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
set +e
set unit_test_failure 0
set BOARD_RC /etc/init.d/rc.board
uorb start
if rgbled start
@ -61,6 +63,15 @@ else @@ -61,6 +63,15 @@ else
echo "[param] FAILED loading $PARAM_FILE"
fi
#
# run boards rc.board if available
#
if [ -f $BOARD_RC ]
then
echo "Board init: ${BOARD_RC}"
sh $BOARD_RC
fi
if [ -f /etc/extras/px4_io-v2_default.bin ]
then
set io_file /etc/extras/px4_io-v2_default.bin

141
boards/px4/fmu-v2/init/rc.board

@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
#!nsh
#
# PX4 FMUv2 specific board init
#
#------------------------------------------------------------------------------
#
# UART mapping on FMUv2:
#
# UART1 /dev/ttyS0 IO debug
# USART2 /dev/ttyS1 TELEM1 (flow control)
# USART3 /dev/ttyS2 TELEM2 (flow control)
# UART4
# UART7 CONSOLE
# UART8 /dev/ttyS6 SERIAL4/TELEM4
#
#------------------------------------------------------------------------------
#
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/px4fmuv3_bl.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..." >> $LOG_FILE
bl_update $BL_FILE
echo "BL update done" >> $LOG_FILE
reboot
fi
fi
unset BL_FILE
if [ $AUTOCNF = yes ]
then
param set SYS_FMU_TASK 1
fi
# External I2C bus
hmc5883 -C -T -X start
lis3mdl -X start
ist8310 -C start
# Internal I2C bus
hmc5883 -C -T -I -R 4 start
# Internal SPI bus ICM-20608-G
mpu6000 -T 20608 start
set BOARD_FMUV3 0
# V3 build hwtypecmp supports V2|V2M|V30
if ver hwtypecmp V30
then
# Check for Pixhawk 2.0 cube
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhawk 2.1 cube
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
# Check if a Pixhack (which reports as V2M) is present
if ver hwtypecmp V2M
then
# Pixhawk Mini doesn't have these sensors,
# so if they are found we know its a Pixhack
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhack 3.1
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
if [ $BOARD_FMUV3 != 0 ]
then
# sensor heating is available, but we disable it for now
param set SENS_EN_THERMAL 0
# external L3GD20H is rotated 180 degrees yaw
l3gd20 -X -R 4 start
# external LSM303D is rotated 270 degrees yaw
lsm303d -X -R 6 start
if [ $BOARD_FMUV3 = 20 ]
then
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw
mpu6000 -R 14 start
# v2.0 Has internal hmc5883 on SPI1
hmc5883 -C -T -S -R 8 start
fi
if [ $BOARD_FMUV3 = 21 ]
then
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw
mpu9250 -R 14 start
fi
else
# $BOARD_FMUV3 = 0 -> FMUv2
mpu6000 start
# As we will use the external mag and the ICM-20608-G
# V2 build hwtypecmp is always false
# V3 build hwtypecmp supports V2|V2M|V30
if ! ver hwtypecmp V2M
then
mpu9250 start
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata
fi
l3gd20 start
lsm303d start
fi
px4flow start &
unset BOARD_FMUV3

141
boards/px4/fmu-v3/init/rc.board

@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
#!nsh
#
# PX4 FMUv2 specific board init
#
#------------------------------------------------------------------------------
#
# UART mapping on FMUv2:
#
# UART1 /dev/ttyS0 IO debug
# USART2 /dev/ttyS1 TELEM1 (flow control)
# USART3 /dev/ttyS2 TELEM2 (flow control)
# UART4
# UART7 CONSOLE
# UART8 /dev/ttyS6 SERIAL4/TELEM4
#
#------------------------------------------------------------------------------
#
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/px4fmuv3_bl.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..." >> $LOG_FILE
bl_update $BL_FILE
echo "BL update done" >> $LOG_FILE
reboot
fi
fi
unset BL_FILE
if [ $AUTOCNF = yes ]
then
param set SYS_FMU_TASK 1
fi
# External I2C bus
hmc5883 -C -T -X start
lis3mdl -X start
ist8310 -C start
# Internal I2C bus
hmc5883 -C -T -I -R 4 start
# Internal SPI bus ICM-20608-G
mpu6000 -T 20608 start
set BOARD_FMUV3 0
# V3 build hwtypecmp supports V2|V2M|V30
if ver hwtypecmp V30
then
# Check for Pixhawk 2.0 cube
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhawk 2.1 cube
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
# Check if a Pixhack (which reports as V2M) is present
if ver hwtypecmp V2M
then
# Pixhawk Mini doesn't have these sensors,
# so if they are found we know its a Pixhack
# external MPU6K is rotated 180 degrees yaw
if mpu6000 -S -R 4 start
then
set BOARD_FMUV3 20
else
# Check for Pixhack 3.1
# external MPU9250 is rotated 180 degrees yaw
if mpu9250 -S -R 4 start
then
set BOARD_FMUV3 21
fi
fi
fi
if [ $BOARD_FMUV3 != 0 ]
then
# sensor heating is available, but we disable it for now
param set SENS_EN_THERMAL 0
# external L3GD20H is rotated 180 degrees yaw
l3gd20 -X -R 4 start
# external LSM303D is rotated 270 degrees yaw
lsm303d -X -R 6 start
if [ $BOARD_FMUV3 = 20 ]
then
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw
mpu6000 -R 14 start
# v2.0 Has internal hmc5883 on SPI1
hmc5883 -C -T -S -R 8 start
fi
if [ $BOARD_FMUV3 = 21 ]
then
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw
mpu9250 -R 14 start
fi
else
# $BOARD_FMUV3 = 0 -> FMUv2
mpu6000 start
# As we will use the external mag and the ICM-20608-G
# V2 build hwtypecmp is always false
# V3 build hwtypecmp supports V2|V2M|V30
if ! ver hwtypecmp V2M
then
mpu9250 start
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata
fi
l3gd20 start
lsm303d start
fi
px4flow start &
unset BOARD_FMUV3
Loading…
Cancel
Save