Auto-update of IO firmware, shorter preflight check alarm

This commit is contained in:
Lorenz Meier
2013-12-14 15:08:56 +01:00
parent 10b2dc67e4
commit ea10d55d71
3 changed files with 41 additions and 16 deletions
+39 -14
View File
@@ -8,6 +8,8 @@
#
set MODE autostart
set logfile /fs/microsd/bootlog.txt
#
# Try to mount the microSD card.
#
@@ -147,26 +149,49 @@ then
nshterm /dev/ttyACM0 &
fi
#
# Upgrade PX4IO firmware
#
if px4io detect
then
echo "PX4IO running, not upgrading"
else
echo "Attempting to upgrade PX4IO"
if px4io update
then
if [ -d /fs/microsd ]
then
echo "Flashed PX4IO Firmware OK" > /fs/microsd/px4io.log
fi
# Allow IO to safely kick back to app
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"
echo "PX4IO OK" >> $logfile
fi
if px4io checkcrc $io_file
then
echo "PX4IO CRC OK"
echo "PX4IO CRC OK" >> $logfile
else
echo "PX4IO CRC failure"
echo "PX4IO CRC failure" >> $logfile
tone_alarm MBABGP
if px4io forceupdate 14662 $io_file
then
usleep 200000
if px4io start
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 "No PX4IO to upgrade here"
echo "PX4IO update failed"
echo "PX4IO update failed" >> $logfile
tone_alarm MNGGG
fi
fi