From 3b9d71ae8a03c79842722ebffe0533cfb1ae9b99 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 31 Jul 2013 14:24:22 +0200 Subject: [PATCH] PX4: Changed the startup script to have mavlink on USART2 / Serial 1 on FMUv2 --- mk/PX4/ROMFS/init.d/rc.APM | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/mk/PX4/ROMFS/init.d/rc.APM b/mk/PX4/ROMFS/init.d/rc.APM index 340b914506..4926fc5e29 100644 --- a/mk/PX4/ROMFS/init.d/rc.APM +++ b/mk/PX4/ROMFS/init.d/rc.APM @@ -8,13 +8,6 @@ set deviceA /dev/ttyACM0 -if [ -f /fs/microsd/APM/mavlink-ttys0 ] -then - set deviceC /dev/ttyS0 -else - set deviceC /dev/ttyS2 -fi - # check for an old file called APM, caused by # a bug in an earlier firmware release if [ -f /fs/microsd/APM ] @@ -63,6 +56,18 @@ then set BOARD FMUv2 fi + if [ -f /fs/microsd/APM/mavlink-ttys0 ] + then + set deviceC /dev/ttyS0 + else + if [ $BOARD == FMUv1 ] + then + set deviceC /dev/ttyS2 + else + set deviceC /dev/ttyS1 + fi + fi + echo checking for /etc/px4io/px4io.bin if [ -f /etc/px4io/px4io.bin ] then @@ -118,7 +123,7 @@ then fmu mode_pwm #echo "Loading FMU_pass mixer" #mixer load /dev/pwm_output /etc/mixers/FMU_pass.mix - if [ $deviceC == /dev/ttyS1 ] + if [ $BOARD == FMUv1 ] && [ $deviceC == /dev/ttyS1 ] then # ttyS1 is used for PWM output for 4 extra channels set deviceC /dev/ttyS2 @@ -140,7 +145,7 @@ then echo "Setting up PX4FMU direct mode" fmu mode_pwm - if [ $deviceC == /dev/ttyS1 ] + if [ $BOARD == FMUv1 ] && [ $deviceC == /dev/ttyS1 ] then # ttyS1 is used for PWM output when there # is no IO board