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
+37 -12
View File
@@ -8,6 +8,8 @@
# #
set MODE autostart set MODE autostart
set logfile /fs/microsd/bootlog.txt
# #
# Try to mount the microSD card. # Try to mount the microSD card.
# #
@@ -147,26 +149,49 @@ then
nshterm /dev/ttyACM0 & nshterm /dev/ttyACM0 &
fi fi
# #
# Upgrade PX4IO firmware # Upgrade PX4IO firmware
# #
if px4io detect
if [ -f /etc/extras/px4io-v2_default.bin ]
then then
echo "PX4IO running, not upgrading" set io_file /etc/extras/px4io-v2_default.bin
else else
echo "Attempting to upgrade PX4IO" set io_file /etc/extras/px4io-v1_default.bin
if px4io update
then
if [ -d /fs/microsd ]
then
echo "Flashed PX4IO Firmware OK" > /fs/microsd/px4io.log
fi fi
# Allow IO to safely kick back to app if px4io start
usleep 200000 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 else
echo "No PX4IO to upgrade here" 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 "PX4IO update failed"
echo "PX4IO update failed" >> $logfile
tone_alarm MNGGG
fi fi
fi fi
+1 -1
View File
@@ -2229,7 +2229,7 @@ void
start(int argc, char *argv[]) start(int argc, char *argv[])
{ {
if (g_dev != nullptr) if (g_dev != nullptr)
errx(1, "already loaded"); errx(0, "already loaded");
/* allocate the interface */ /* allocate the interface */
device::Device *interface = get_interface(); device::Device *interface = get_interface();
@@ -200,7 +200,7 @@ system_eval:
led_toggle(leds, LED_BLUE); led_toggle(leds, LED_BLUE);
/* display and sound error */ /* display and sound error */
for (int i = 0; i < 50; i++) for (int i = 0; i < 14; i++)
{ {
led_toggle(leds, LED_BLUE); led_toggle(leds, LED_BLUE);
led_toggle(leds, LED_AMBER); led_toggle(leds, LED_AMBER);