2013-01-20 17:21:44 -04:00
|
|
|
#!nsh
|
|
|
|
|
|
|
|
# APM startup script for NuttX on PX4
|
|
|
|
|
2013-02-17 22:55:58 -04:00
|
|
|
# To disable APM startup add a /fs/microsd/APM/nostart file
|
2013-07-11 00:18:54 -03:00
|
|
|
|
2013-03-17 22:25:45 -03:00
|
|
|
# check for an old file called APM, caused by
|
|
|
|
# a bug in an earlier firmware release
|
|
|
|
if [ -f /fs/microsd/APM ]
|
|
|
|
then
|
2016-01-22 15:55:25 -04:00
|
|
|
echo "APM file found - renaming"
|
|
|
|
mv /fs/microsd/APM /fs/microsd/APM.old
|
2013-03-17 22:25:45 -03:00
|
|
|
fi
|
|
|
|
|
2013-01-25 05:36:33 -04:00
|
|
|
if [ -f /fs/microsd/APM/nostart ]
|
|
|
|
then
|
2016-01-22 15:55:25 -04:00
|
|
|
echo "APM/nostart found - skipping APM startup"
|
|
|
|
sh /etc/init.d/rc.error
|
2013-08-03 05:51:59 -03:00
|
|
|
fi
|
2013-01-25 05:36:33 -04:00
|
|
|
|
2013-01-20 17:21:44 -04:00
|
|
|
set sketch NONE
|
2014-01-13 21:41:07 -04:00
|
|
|
if rm /fs/microsd/APM/boot.log
|
|
|
|
then
|
2016-01-22 15:55:25 -04:00
|
|
|
echo "removed old boot.log"
|
2014-01-13 21:41:07 -04:00
|
|
|
fi
|
2014-01-13 00:04:42 -04:00
|
|
|
set logfile /fs/microsd/APM/BOOT.LOG
|
2013-01-20 17:21:44 -04:00
|
|
|
|
2013-08-05 22:27:34 -03:00
|
|
|
if mkdir /fs/microsd/APM > /dev/null
|
2013-01-20 17:21:44 -04:00
|
|
|
then
|
2016-01-22 15:55:25 -04:00
|
|
|
echo "Created APM directory"
|
2013-08-03 05:51:59 -03:00
|
|
|
fi
|
2013-03-21 00:59:58 -03:00
|
|
|
|
2013-10-30 01:33:42 -03:00
|
|
|
if uorb start
|
|
|
|
then
|
|
|
|
echo "uorb started OK"
|
|
|
|
else
|
|
|
|
sh /etc/init.d/rc.error
|
|
|
|
fi
|
|
|
|
|
2016-11-02 23:13:13 -03:00
|
|
|
echo Starting ArduPilot
|
|
|
|
if ArduPilot start
|
2013-08-03 05:51:59 -03:00
|
|
|
then
|
|
|
|
echo ArduPilot started OK
|
2013-01-20 17:21:44 -04:00
|
|
|
else
|
2013-08-03 05:51:59 -03:00
|
|
|
sh /etc/init.d/rc.error
|
|
|
|
fi
|
|
|
|
|
2013-02-17 22:55:58 -04:00
|
|
|
echo "rc.APM finished"
|