From 9ba2e91fa16a77c8d5074c4c60ae47c4365fc100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Sat, 11 Aug 2018 10:33:43 +0200 Subject: [PATCH] ROMFS: avoid empty 'then else' clause, it's an error in bash Use 'if ! ' instead. --- ROMFS/px4fmu_common/init.d/3000_generic_wing | 5 --- ROMFS/px4fmu_common/init.d/rc.interface | 12 ++---- ROMFS/px4fmu_common/init.d/rc.mavlink | 7 +--- ROMFS/px4fmu_common/init.d/rc.sensors | 41 +++++++------------- ROMFS/px4fmu_common/init.d/rcS | 29 +++++--------- ROMFS/tap_common/init.d/rcS | 7 +--- platforms/nuttx/NuttX/apps | 2 +- 7 files changed, 33 insertions(+), 70 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/3000_generic_wing b/ROMFS/px4fmu_common/init.d/3000_generic_wing index 8ce2d55f83..717dee80a2 100644 --- a/ROMFS/px4fmu_common/init.d/3000_generic_wing +++ b/ROMFS/px4fmu_common/init.d/3000_generic_wing @@ -10,9 +10,4 @@ sh /etc/init.d/rc.fw_defaults -if [ $AUTOCNF == yes ] -then - -fi - set MIXER fw_generic_wing diff --git a/ROMFS/px4fmu_common/init.d/rc.interface b/ROMFS/px4fmu_common/init.d/rc.interface index 9c6d46a41d..037511ebe5 100644 --- a/ROMFS/px4fmu_common/init.d/rc.interface +++ b/ROMFS/px4fmu_common/init.d/rc.interface @@ -17,9 +17,8 @@ set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers # If mount (gimbal) control is enabled and output mode is AUX, set the aux # mixer to mount (override the airframe-specific MIXER_AUX setting). # -if param compare MNT_MODE_IN -1 +if ! param compare MNT_MODE_IN -1 then -else if param compare MNT_MODE_OUT 0 then set MIXER_AUX mount @@ -69,9 +68,8 @@ then set MKBLCTRL_ARG "-mkmode +" fi - if mkblctrl $MKBLCTRL_ARG + if ! mkblctrl $MKBLCTRL_ARG then - else # Error tune. tune_control play -t 2 fi @@ -79,9 +77,8 @@ then if [ $OUTPUT_MODE == hil ] then - if pwm_out_sim start + if ! pwm_out_sim start then - else # Error tune. tune_control play -t 2 fi @@ -89,9 +86,8 @@ then if [ $OUTPUT_MODE == fmu ] then - if fmu mode_$FMU_MODE $FMU_ARGS + if ! fmu mode_$FMU_MODE $FMU_ARGS then - else echo "FMU start failed" >> $LOG_FILE # Error tune. tune_control play -t 2 diff --git a/ROMFS/px4fmu_common/init.d/rc.mavlink b/ROMFS/px4fmu_common/init.d/rc.mavlink index f14fada23d..3544e53173 100644 --- a/ROMFS/px4fmu_common/init.d/rc.mavlink +++ b/ROMFS/px4fmu_common/init.d/rc.mavlink @@ -11,10 +11,8 @@ # Begin Setup for board specific configurations. # ############################################################################### -if ver hwcmp AEROFC_V1 +if ! ver hwcmp AEROFC_V1 then - # don't start mavlink ttyACM0 on aerofc_v1 -else # Start MAVLink mavlink start -r 800000 -d /dev/ttyACM0 -m config -x fi @@ -74,9 +72,8 @@ then fi fi -if [ "x$MAVLINK_F" == xnone ] +if [ "x$MAVLINK_F" != xnone ] then -else mavlink start ${MAVLINK_F} fi diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 29e87ef7f7..a764dfa5a0 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -9,14 +9,10 @@ # Begin Setup for board specific configurations. # ############################################################################### -if ver hwcmp AEROFC_V1 OMNIBUS_F4SD +if ! ver hwcmp AEROFC_V1 OMNIBUS_F4SD then - # Aero FC uses separate driver -else - if ver hwcmp CRAZYFLIE + if ! ver hwcmp CRAZYFLIE then - # Crazyflie uses separate driver - else # Configure all I2C buses to 100 KHz as they # are all external or slow fmu i2c 1 100000 @@ -209,11 +205,10 @@ then # 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 + if ! ver hwtypecmp V2M then - # On the PixhawkMini the mpu9250 has been disabled due to HW errata - else mpu9250 start + # else: On the PixhawkMini the mpu9250 has been disabled due to HW errata fi l3gd20 start @@ -240,14 +235,12 @@ then # expansion i2c used for BMM150 rotated by 90deg bmm150 -R 2 start - if hmc5883 -C -T -S -R 2 start + # hmc5883 internal SPI bus is rotated 90 deg yaw + if ! hmc5883 -C -T -S -R 2 start then - # hmc5883 internal SPI bus is rotated 90 deg yaw - else - if lis3mdl start + # lis3mdl internal SPI bus is rotated 90 deg yaw + if ! lis3mdl start then - # lis3mdl internal SPI bus is rotated 90 deg yaw - else # BMI055 gyro internal SPI bus bmi055 -G start fi @@ -257,14 +250,12 @@ then # chip select pin. There are different boards with either one of them and the WHO_AM_I register # will prevent the incorrect driver from a successful initialization. - if mpu6000 -R 2 -T 20602 start + # ICM20602 internal SPI bus ICM-20608-G is rotated 90 deg yaw + if ! mpu6000 -R 2 -T 20602 start then - # ICM20602 internal SPI bus ICM-20608-G is rotated 90 deg yaw - else - if mpu6000 -R 2 -T 20608 start + # ICM20608 internal SPI bus ICM-20602-G is rotated 90 deg yaw + if ! mpu6000 -R 2 -T 20608 start then - # ICM20608 internal SPI bus ICM-20602-G is rotated 90 deg yaw - else # BMI055 accel internal SPI bus bmi055 -A start fi @@ -274,10 +265,9 @@ then # chip select pin. There are different boards with either one of them and the WHO_AM_I register # will prevent the incorrect driver from a successful initialization. - if mpu9250 -R 2 start + # mpu9250 internal SPI bus mpu9250 is rotated 90 deg yaw + if ! mpu9250 -R 2 start then - # mpu9250 internal SPI bus mpu9250 is rotated 90 deg yaw - else # BMI160 internal SPI bus bmi160 start fi @@ -299,9 +289,8 @@ fi if ver hwcmp OMNIBUS_F4SD then - if mpu6000 -R 12 -s start + if ! mpu6000 -R 12 -s start then - else # some boards such as the Hobbywing XRotor F4 G2 use the ICM-20602 mpu6000 -R 12 -T 20602 -s start fi diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 95e8778965..f4d6902086 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -131,10 +131,9 @@ else fi fi -if ver hwcmp CRAZYFLIE AEROCORE2 +# AEROCORE2 shouldn't have an sd card and CF2 may optionally have an sd card. +if ! ver hwcmp CRAZYFLIE AEROCORE2 then - # AEROCORE2 shouldn't have an sd card and CF2 may optionally have an sd card. -else # Run no SD alarm. if [ $LOG_FILE == /dev/null ] then @@ -194,20 +193,16 @@ else # Load parameters. # param select $PARAM_FILE - if param load + if ! param load then - else - if param reset - then - fi + param reset fi # # Start system state indicator. # - if rgbled start + if ! rgbled start then - else if blinkm start then blinkm systemstate @@ -289,9 +284,8 @@ else # # Set parameters and env variables for selected AUTOSTART. # - if param compare SYS_AUTOSTART 0 + if ! param compare SYS_AUTOSTART 0 then - else sh /etc/init.d/rc.autostart fi @@ -351,10 +345,8 @@ else if px4io start then # Try to safety px4 io so motor outputs don't go crazy. - if px4io safety_on + if ! px4io safety_on then - # success! no-op - else # px4io did not respond to the safety command. px4io stop fi @@ -507,12 +499,9 @@ else # # Start vmount to control mounts such as gimbals, disabled by default. # - if param compare MNT_MODE_IN -1 + if ! param compare MNT_MODE_IN -1 then - else - if vmount start - then - fi + vmount start fi # diff --git a/ROMFS/tap_common/init.d/rcS b/ROMFS/tap_common/init.d/rcS index 9f64ab2711..4343a49d8c 100644 --- a/ROMFS/tap_common/init.d/rcS +++ b/ROMFS/tap_common/init.d/rcS @@ -61,12 +61,9 @@ then fi param select $PARAM_FILE -if param load +if !param load then -else - if param reset - then - fi + param reset fi tone_alarm start diff --git a/platforms/nuttx/NuttX/apps b/platforms/nuttx/NuttX/apps index 36806ba3d8..d19cc40bdc 160000 --- a/platforms/nuttx/NuttX/apps +++ b/platforms/nuttx/NuttX/apps @@ -1 +1 @@ -Subproject commit 36806ba3d84c0fa07ed86857d4c92a997b7cd194 +Subproject commit d19cc40bdca5416a0891798f4b13bfa14f07abeb