From cfa9054aa4e6accae1fefaad1a13316301ce56fc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 22 Aug 2013 09:25:13 +0200 Subject: Moved to USART1 for the main console, starting a 2nd NSH instance on USB if needed, reworked start scripts to not fall over --- ROMFS/px4fmu_common/init.d/01_fmu_quad_x | 14 ++++---- ROMFS/px4fmu_common/init.d/02_io_quad_x | 2 +- ROMFS/px4fmu_common/init.d/08_ardrone | 25 ++++----------- ROMFS/px4fmu_common/init.d/09_ardrone_flow | 15 +++++---- ROMFS/px4fmu_common/init.d/10_io_f330 | 51 +++++++++++++++--------------- ROMFS/px4fmu_common/init.d/rcS | 47 ++++++++++++++++++++++++++- 6 files changed, 93 insertions(+), 61 deletions(-) (limited to 'ROMFS') diff --git a/ROMFS/px4fmu_common/init.d/01_fmu_quad_x b/ROMFS/px4fmu_common/init.d/01_fmu_quad_x index 58a970eba..c1f3187f9 100644 --- a/ROMFS/px4fmu_common/init.d/01_fmu_quad_x +++ b/ROMFS/px4fmu_common/init.d/01_fmu_quad_x @@ -97,11 +97,9 @@ multirotor_att_control start # Start logging # sdlog2 start -r 50 -a -b 14 - -# -# Start system state -# -if blinkm start -then - blinkm systemstate -fi + +# Try to get an USB console +nshterm /dev/ttyACM0 & + +# Exit, because /dev/ttyS0 is needed for MAVLink +exit diff --git a/ROMFS/px4fmu_common/init.d/02_io_quad_x b/ROMFS/px4fmu_common/init.d/02_io_quad_x index c63e92f6d..49483d14f 100644 --- a/ROMFS/px4fmu_common/init.d/02_io_quad_x +++ b/ROMFS/px4fmu_common/init.d/02_io_quad_x @@ -88,7 +88,7 @@ pwm -u 400 -m 0xff multirotor_att_control start # -# Start logging +# Start logging once armed # sdlog2 start -r 50 -a -b 14 diff --git a/ROMFS/px4fmu_common/init.d/08_ardrone b/ROMFS/px4fmu_common/init.d/08_ardrone index f55ac2ae3..5bb1491e9 100644 --- a/ROMFS/px4fmu_common/init.d/08_ardrone +++ b/ROMFS/px4fmu_common/init.d/08_ardrone @@ -2,12 +2,6 @@ # # Flight startup script for PX4FMU on PX4IOAR carrier board. # - -# Disable the USB interface -set USB no - -# Disable autostarting other apps -set MODE ardrone echo "[init] doing PX4IOAR startup..." @@ -70,25 +64,14 @@ multirotor_att_control start ardrone_interface start -d /dev/ttyS1 # -# Start logging +# Start logging once armed # -sdlog start -s 10 +sdlog2 start -r 50 -a -b 14 # # Start GPS capture # gps start - -# -# Start system state -# -if blinkm start -then - echo "using BlinkM for state indication" - blinkm systemstate -else - echo "no BlinkM found, OK." -fi # # startup is done; we don't want the shell because we @@ -96,4 +79,8 @@ fi # echo "[init] startup done" +# Try to get an USB console +nshterm /dev/ttyACM0 & + +# Exit, because /dev/ttyS0 is needed for MAVLink exit diff --git a/ROMFS/px4fmu_common/init.d/09_ardrone_flow b/ROMFS/px4fmu_common/init.d/09_ardrone_flow index e7173f6e6..a223ef7aa 100644 --- a/ROMFS/px4fmu_common/init.d/09_ardrone_flow +++ b/ROMFS/px4fmu_common/init.d/09_ardrone_flow @@ -2,12 +2,6 @@ # # Flight startup script for PX4FMU on PX4IOAR carrier board. # - -# Disable the USB interface -set USB no - -# Disable autostarting other apps -set MODE ardrone echo "[init] doing PX4IOAR startup..." @@ -84,6 +78,11 @@ flow_speed_control start # Fire up the AR.Drone interface. # ardrone_interface start -d /dev/ttyS1 + +# +# Start logging once armed +# +sdlog2 start -r 50 -a -b 14 # # startup is done; we don't want the shell because we @@ -91,4 +90,8 @@ ardrone_interface start -d /dev/ttyS1 # echo "[init] startup done" +# Try to get an USB console +nshterm /dev/ttyACM0 & + +# Exit, because /dev/ttyS0 is needed for MAVLink exit diff --git a/ROMFS/px4fmu_common/init.d/10_io_f330 b/ROMFS/px4fmu_common/init.d/10_io_f330 index 0e6d3f5d5..b2fc0c96f 100644 --- a/ROMFS/px4fmu_common/init.d/10_io_f330 +++ b/ROMFS/px4fmu_common/init.d/10_io_f330 @@ -2,10 +2,6 @@ # # Flight startup script for PX4FMU+PX4IO on an F330 quad. # - -# disable USB and autostart -set USB no -set MODE custom # # Start the ORB (first app to start) @@ -60,33 +56,36 @@ commander start # if px4io start then + # + # This sets a PWM right after startup (regardless of safety button) + # + px4io idle 900 900 900 900 + pwm -u 400 -m 0xff -else - # SOS - tone_alarm 6 -fi - -# -# Allow PX4IO to recover from midair restarts. -# this is very unlikely, but quite safe and robust. -px4io recovery -# -# This sets a PWM right after startup (regardless of safety button) -# -px4io idle 900 900 900 900 + # + # Allow PX4IO to recover from midair restarts. + # this is very unlikely, but quite safe and robust. + px4io recovery -# -# The values are for spinning motors when armed using DJI ESCs -# -px4io min 1200 1200 1200 1200 -# -# Upper limits could be higher, this is on the safe side -# -px4io max 1800 1800 1800 1800 -mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix + # + # The values are for spinning motors when armed using DJI ESCs + # + px4io min 1200 1200 1200 1200 + + # + # Upper limits could be higher, this is on the safe side + # + px4io max 1800 1800 1800 1800 + + mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix + +else + # SOS + tone_alarm 6 +fi # # Start the sensors (depends on orb, px4io) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 650224cf1..8674c3c04 100755 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -61,7 +61,13 @@ then # # Start terminal # -sercon +if sercon +then + echo "USB connected" +else + # second attempt + sercon & +fi # # Start the ORB (first app to start) @@ -128,45 +134,84 @@ fi if param compare SYS_AUTOSTART 1 then sh /etc/init.d/01_fmu_quad_x + set MODE custom fi if param compare SYS_AUTOSTART 2 then sh /etc/init.d/02_io_quad_x + set MODE custom fi if param compare SYS_AUTOSTART 8 then sh /etc/init.d/08_ardrone + set MODE custom fi if param compare SYS_AUTOSTART 9 then sh /etc/init.d/09_ardrone_flow + set MODE custom fi if param compare SYS_AUTOSTART 10 then sh /etc/init.d/10_io_f330 + set MODE custom fi if param compare SYS_AUTOSTART 15 then sh /etc/init.d/15_io_tbs + set MODE custom fi if param compare SYS_AUTOSTART 30 then sh /etc/init.d/30_io_camflyer + set MODE custom fi if param compare SYS_AUTOSTART 31 then sh /etc/init.d/31_io_phantom + set MODE custom fi # Try to get an USB console nshterm /dev/ttyACM0 & +# If none of the autostart scripts triggered, get a minimal setup +if [ $MODE == autostart ] +then + # Telemetry port is on both FMU boards ttyS1 + mavlink start -b 57600 -d /dev/ttyS1 + + # Start commander + commander start + + # Start px4io if present + if px4io start + then + echo "PX4IO driver started" + else + if fmu mode_serial + then + echo "FMU driver started" + fi + fi + + # Start sensors + sh /etc/init.d/rc.sensors + + # Start one of the estimators + attitude_estimator_ekf start + + # Start GPS + gps start + +fi + # End of autostart fi -- cgit v1.2.3