2013-07-07 16:13:40 -03:00
|
|
|
#!nsh
|
|
|
|
#
|
|
|
|
# PX4FMU startup script for test hackery.
|
|
|
|
#
|
2014-01-04 12:05:52 -04:00
|
|
|
uorb start
|
2013-12-20 09:25:35 -04:00
|
|
|
|
|
|
|
if sercon
|
|
|
|
then
|
|
|
|
echo "[init] USB interface connected"
|
|
|
|
|
|
|
|
# Try to get an USB console
|
|
|
|
nshterm /dev/ttyACM0 &
|
2014-01-04 08:54:14 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Try to mount the microSD card.
|
|
|
|
#
|
|
|
|
echo "[init] looking for microSD..."
|
|
|
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
|
|
|
then
|
|
|
|
echo "[init] card mounted at /fs/microsd"
|
|
|
|
# Start playing the startup tune
|
|
|
|
tone_alarm start
|
|
|
|
else
|
|
|
|
echo "[init] no microSD card found"
|
|
|
|
# Play SOS
|
|
|
|
tone_alarm error
|
|
|
|
fi
|
|
|
|
|
2014-01-04 12:05:52 -04:00
|
|
|
#
|
|
|
|
# Start a minimal system
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ -f /etc/extras/px4io-v2_default.bin ]
|
|
|
|
then
|
|
|
|
set io_file /etc/extras/px4io-v2_default.bin
|
|
|
|
else
|
|
|
|
set io_file /etc/extras/px4io-v1_default.bin
|
|
|
|
fi
|
|
|
|
|
|
|
|
if px4io start
|
|
|
|
then
|
|
|
|
echo "PX4IO OK"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if px4io checkcrc $io_file
|
|
|
|
then
|
|
|
|
echo "PX4IO CRC OK"
|
|
|
|
else
|
|
|
|
echo "PX4IO CRC failure"
|
|
|
|
tone_alarm MBABGP
|
|
|
|
if px4io forceupdate 14662 $io_file
|
|
|
|
then
|
|
|
|
usleep 500000
|
|
|
|
if px4io start
|
|
|
|
then
|
|
|
|
echo "PX4IO restart OK"
|
|
|
|
tone_alarm MSPAA
|
|
|
|
else
|
|
|
|
echo "PX4IO restart failed"
|
|
|
|
tone_alarm MNGGG
|
|
|
|
sleep 5
|
|
|
|
reboot
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "PX4IO update failed"
|
|
|
|
tone_alarm MNGGG
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-01-04 08:54:14 -04:00
|
|
|
#
|
|
|
|
# The presence of this file suggests we're running a mount stress test
|
|
|
|
#
|
2014-01-04 12:05:52 -04:00
|
|
|
if [ -f /fs/microsd/mount_test_cmds.txt ]
|
2014-01-04 08:54:14 -04:00
|
|
|
then
|
|
|
|
tests mount
|
|
|
|
fi
|