PX4: clean up whitespace in startup scripts

This commit is contained in:
Jonathan Challinger 2016-01-22 11:55:25 -08:00 committed by Andrew Tridgell
parent d2ca2d2e0e
commit 246cf113df
2 changed files with 180 additions and 180 deletions

View File

@ -14,75 +14,75 @@ set deviceA /dev/ttyACM0
# a bug in an earlier firmware release
if [ -f /fs/microsd/APM ]
then
echo "APM file found - renaming"
mv /fs/microsd/APM /fs/microsd/APM.old
echo "APM file found - renaming"
mv /fs/microsd/APM /fs/microsd/APM.old
fi
if [ -f /fs/microsd/APM/nostart ]
then
echo "APM/nostart found - skipping APM startup"
sh /etc/init.d/rc.error
echo "APM/nostart found - skipping APM startup"
sh /etc/init.d/rc.error
fi
# mount binfs so we can find the built-in apps
if [ -f /bin/reboot ]
then
echo "binfs already mounted"
echo "binfs already mounted"
else
echo "Mounting binfs"
if mount -t binfs /dev/null /bin
then
echo "binfs mounted OK"
else
sh /etc/init.d/rc.error
fi
echo "Mounting binfs"
if mount -t binfs /dev/null /bin
then
echo "binfs mounted OK"
else
sh /etc/init.d/rc.error
fi
fi
set sketch NONE
if rm /fs/microsd/APM/boot.log
then
echo "removed old boot.log"
echo "removed old boot.log"
fi
set logfile /fs/microsd/APM/BOOT.LOG
if [ ! -f /bin/ArduPilot ]
then
echo "/bin/ardupilot not found"
sh /etc/init.d/rc.error
echo "/bin/ardupilot not found"
sh /etc/init.d/rc.error
fi
if mkdir /fs/microsd/APM > /dev/null
then
echo "Created APM directory"
echo "Created APM directory"
fi
if [ -f /bin/px4io ]
then
if [ -f /bin/lsm303d ]
then
echo "Detected FMUv2 board"
set BOARD FMUv2
else
echo "Detected FMUv1 board"
set BOARD FMUv1
fi
if [ -f /bin/lsm303d ]
then
echo "Detected FMUv2 board"
set BOARD FMUv2
else
echo "Detected FMUv1 board"
set BOARD FMUv1
fi
else
echo "Detected FMUv4 board"
set BOARD FMUv4
echo "Detected FMUv4 board"
set BOARD FMUv4
fi
if [ $BOARD == FMUv1 ]
then
set deviceC /dev/ttyS2
if [ -f /fs/microsd/APM/AUXPWM.en ]
then
set deviceD /dev/null
else
set deviceD /dev/ttyS1
fi
set deviceC /dev/ttyS2
if [ -f /fs/microsd/APM/AUXPWM.en ]
then
set deviceD /dev/null
else
set deviceD /dev/ttyS1
fi
else
set deviceC /dev/ttyS1
set deviceD /dev/ttyS2
set deviceC /dev/ttyS1
set deviceD /dev/ttyS2
fi
if uorb start
@ -116,34 +116,34 @@ fi
if [ -f /bin/px4io ]
then
echo "Trying PX4IO board"
echo "Trying PX4IO board"
# try the px4io start twice. Some FMUv2 board don't
# come up the first time
set HAVE_PX4IO false
if px4io start norc
then
set HAVE_PX4IO true
else
# it may be in bootloader mode
echo Loading /etc/px4io/px4io.bin
tone_alarm MBABGP
if px4io update /etc/px4io/px4io.bin
then
echo "upgraded PX4IO firmware OK"
tone_alarm MSPAA
else
echo "Failed to upgrade PX4IO firmware"
tone_alarm MNGGG
fi
sleep 1
# try the px4io start twice. Some FMUv2 board don't
# come up the first time
set HAVE_PX4IO false
if px4io start norc
then
set HAVE_PX4IO true
# play happy tune again
tone_alarm 1
else
# it may be in bootloader mode
echo Loading /etc/px4io/px4io.bin
tone_alarm MBABGP
if px4io update /etc/px4io/px4io.bin
then
echo "upgraded PX4IO firmware OK"
tone_alarm MSPAA
else
echo "Failed to upgrade PX4IO firmware"
tone_alarm MNGGG
fi
sleep 1
if px4io start norc
then
set HAVE_PX4IO true
# play happy tune again
tone_alarm 1
fi
fi
fi
else
set HAVE_PX4IO false
echo "No PX4IO support"
@ -157,7 +157,7 @@ then
echo "PX4IO CRC OK"
else
echo "PX4IO CRC failure"
echo "PX4IO CRC failure" >> $logfile
echo "PX4IO CRC failure" >> $logfile
tone_alarm MBABGP
if px4io safety_on
@ -171,22 +171,22 @@ then
if px4io forceupdate 14662 /etc/px4io/px4io.bin
then
sleep 1
if px4io start norc
then
echo "PX4IO restart OK"
echo "PX4IO restart OK" >> $logfile
tone_alarm MSPAA
else
echo "PX4IO restart failed"
echo "PX4IO restart failed" >> $logfile
tone_alarm MNGGG
sh /etc/init.d/rc.error
fi
sleep 1
if px4io start norc
then
echo "PX4IO restart OK"
echo "PX4IO restart OK" >> $logfile
tone_alarm MSPAA
else
echo "PX4IO restart failed"
echo "PX4IO restart failed" >> $logfile
tone_alarm MNGGG
sh /etc/init.d/rc.error
fi
else
echo "PX4IO update failed"
echo "PX4IO update failed" >> $logfile
tone_alarm MNGGG
echo "PX4IO update failed"
echo "PX4IO update failed" >> $logfile
tone_alarm MNGGG
fi
fi
else
@ -195,19 +195,19 @@ else
if [ $BOARD == FMUv2 ]
then
sh /etc/init.d/rc.error
sh /etc/init.d/rc.error
fi
fi
if [ $BOARD == FMUv1 -a $deviceD == /dev/ttyS1 ]
then
echo "Setting FMU mode_serial"
fmu mode_serial
echo "Setting FMU mode_serial"
fmu mode_serial
else
if fmu mode_pwm4
then
echo "Set FMU mode_pwm4"
fi
if fmu mode_pwm4
then
echo "Set FMU mode_pwm4"
fi
fi
@ -250,19 +250,19 @@ echo "Starting APM sensors"
if ms5611 start
then
echo "ms5611 started OK"
echo "ms5611 started OK"
else
echo "no ms5611 found"
echo "No ms5611 found" >> $logfile
sh /etc/init.d/rc.error
echo "no ms5611 found"
echo "No ms5611 found" >> $logfile
sh /etc/init.d/rc.error
fi
if adc start
then
echo "adc started OK"
echo "adc started OK"
else
echo "No adc" >> $logfile
sh /etc/init.d/rc.error
echo "No adc" >> $logfile
sh /etc/init.d/rc.error
fi
if [ $BOARD == FMUv1 ]
@ -282,16 +282,16 @@ then
fi
if mpu6000 start
then
echo "mpu6000 started OK"
echo "mpu6000 started OK"
else
sh /etc/init.d/rc.error
sh /etc/init.d/rc.error
fi
if l3gd20 start
then
echo "l3gd20 started OK"
echo "l3gd20 started OK"
else
echo "No l3gd20"
echo "No l3gd20" >> $logfile
echo "No l3gd20"
echo "No l3gd20" >> $logfile
fi
fi
@ -331,61 +331,61 @@ then
# external L3GD20 is rotated YAW_180 from standard
if l3gd20 -X -R 4 start
then
echo "l3gd20 external started OK"
echo "l3gd20 external started OK"
else
echo "No l3gd20"
sh /etc/init.d/rc.error
echo "No l3gd20"
sh /etc/init.d/rc.error
fi
# external LSM303D is rotated YAW_270 from standard
if lsm303d -a 16 -X -R 6 start
then
echo "lsm303d external started OK"
echo "lsm303d external started OK"
else
echo "No lsm303d"
sh /etc/init.d/rc.error
echo "No lsm303d"
sh /etc/init.d/rc.error
fi
# internal MPU6000 is rotated ROLL_180_YAW_270 from standard
if mpu6000 -R 14 start
then
echo "Found MPU6000 internal"
echo "Found MPU6000 internal"
else
if mpu9250 -R 14 start
then
echo "Found MPU9250 internal"
else
echo "No MPU6000 or MPU9250"
echo "No MPU6000 or MPU9250" >> $logfile
sh /etc/init.d/rc.error
fi
if mpu9250 -R 14 start
then
echo "Found MPU9250 internal"
else
echo "No MPU6000 or MPU9250"
echo "No MPU6000 or MPU9250" >> $logfile
sh /etc/init.d/rc.error
fi
fi
if hmc5883 -C -T -S -R 8 start
then
echo "Found SPI hmc5883"
echo "Found SPI hmc5883"
fi
else
if mpu6000 start
then
echo "Found MPU6000"
echo "Found MPU6000"
else
if mpu9250 start
then
echo "Found MPU9250"
else
echo "No MPU6000 or MPU9250"
echo "No MPU9250" >> $logfile
fi
if mpu9250 start
then
echo "Found MPU9250"
else
echo "No MPU6000 or MPU9250"
echo "No MPU9250" >> $logfile
fi
fi
if l3gd20 start
then
echo "l3gd20 started OK"
echo "l3gd20 started OK"
else
sh /etc/init.d/rc.error
sh /etc/init.d/rc.error
fi
if lsm303d -a 16 start
then
echo "lsm303d started OK"
echo "lsm303d started OK"
else
sh /etc/init.d/rc.error
sh /etc/init.d/rc.error
fi
fi
fi
@ -409,12 +409,12 @@ then
if mpu6000 -R 2 -T 20608 start
then
echo "Found ICM-20608 internal"
echo "Found ICM-20608 internal"
fi
if mpu9250 -R 2 start
then
echo "Found mpu9250 internal"
echo "Found mpu9250 internal"
fi
fi
@ -458,10 +458,10 @@ fi
# optional PX4Flow sensor
if [ -f /bin/px4flow ]
then
if px4flow start
then
echo "Found px4flow sensor"
fi
if px4flow start
then
echo "Found px4flow sensor"
fi
fi
# optional PWM input driver

View File

@ -27,11 +27,11 @@ set USB autoconnect
if rgbled start
then
set HAVE_RGBLED 1
# show startup white
rgbled rgb 16 16 16
set HAVE_RGBLED 1
# show startup white
rgbled rgb 16 16 16
else
set HAVE_RGBLED 0
set HAVE_RGBLED 0
fi
#
@ -40,38 +40,38 @@ fi
echo "[init] looking for microSD..."
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "[init] card mounted at /fs/microsd"
set HAVE_MICROSD 1
# Start playing the startup tune
tone_alarm 1
echo "[init] card mounted at /fs/microsd"
set HAVE_MICROSD 1
# Start playing the startup tune
tone_alarm 1
else
set HAVE_MICROSD 0
echo "Trying format of microSD"
tone_alarm MBAGP
if mkfatfs /dev/mmcsd0
then
echo "microSD card formatted"
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "format succeeded"
set HAVE_MICROSD 1
tone_alarm 1
else
echo "mount failed"
tone_alarm MNBG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
else
echo "format failed"
tone_alarm MNBGG
set HAVE_MICROSD 0
echo "Trying format of microSD"
tone_alarm MBAGP
if mkfatfs /dev/mmcsd0
then
echo "microSD card formatted"
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "format succeeded"
set HAVE_MICROSD 1
tone_alarm 1
else
echo "mount failed"
tone_alarm MNBG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
rgbled rgb 16 0 0
fi
fi
else
echo "format failed"
tone_alarm MNBGG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
fi
#
@ -82,14 +82,14 @@ fi
#
if [ -f /fs/microsd/etc/rc ]
then
echo "[init] reading /fs/microsd/etc/rc"
sh /fs/microsd/etc/rc
echo "[init] reading /fs/microsd/etc/rc"
sh /fs/microsd/etc/rc
fi
# Also consider rc.txt files
if [ -f /fs/microsd/etc/rc.txt ]
then
echo "[init] reading /fs/microsd/etc/rc.txt"
sh /fs/microsd/etc/rc.txt
echo "[init] reading /fs/microsd/etc/rc.txt"
sh /fs/microsd/etc/rc.txt
fi
#
@ -97,34 +97,34 @@ fi
#
if [ $USB != autoconnect ]
then
echo "[init] not connecting USB"
echo "[init] not connecting USB"
else
if sercon
then
echo "[init] USB interface connected"
else
echo "[init] No USB connected"
fi
if sercon
then
echo "[init] USB interface connected"
else
echo "[init] No USB connected"
fi
fi
if [ $HAVE_MICROSD == 0 ]
then
if usb_connected
then
echo "Opening USB nsh"
else
echo "booting with no microSD"
set HAVE_MICROSD 1
fi
if usb_connected
then
echo "Opening USB nsh"
else
echo "booting with no microSD"
set HAVE_MICROSD 1
fi
fi
# if this is an APM build then there will be a rc.APM script
# from an EXTERNAL_SCRIPTS build option
if [ -f /etc/init.d/rc.APM -a $HAVE_MICROSD == 1 -a ! -f /fs/microsd/APM/nostart ]
then
echo Running rc.APM
# if APM startup is successful then nsh will exit
sh /etc/init.d/rc.APM
echo Running rc.APM
# if APM startup is successful then nsh will exit
sh /etc/init.d/rc.APM
else
nshterm /dev/ttyACM0 &
nshterm /dev/ttyACM0 &
fi