From 905c84bb4ccfea2ba59100298bd991934e331d15 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 7 Sep 2013 17:39:51 +1000 Subject: [PATCH] PX4: move PX4IO update to before any sensors start this seems to make the update much more reliable, possibly as it avoids an interrupt load from l3gd20 driver --- mk/PX4/ROMFS/init.d/rc.APM | 55 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/mk/PX4/ROMFS/init.d/rc.APM b/mk/PX4/ROMFS/init.d/rc.APM index 2f546f3a5d..ad68ae19fd 100644 --- a/mk/PX4/ROMFS/init.d/rc.APM +++ b/mk/PX4/ROMFS/init.d/rc.APM @@ -45,6 +45,34 @@ then sh /etc/init.d/rc.error fi +######################## +# PX4IO upgrade handling +echo checking for /etc/px4io/px4io.bin +if [ -f /etc/px4io/px4io.bin ] +then + echo "Checking for new px4io firmware" + if cmp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded + then + echo "No new px4io firmware" + else + echo Loading /etc/px4io/px4io.bin + tone_alarm MBABGP + echo Loading /etc/px4io/px4io.bin > /fs/microsd/px4io_update.log + if px4io update /etc/px4io/px4io.bin + then + cp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded + echo Loaded /etc/px4io/px4io.bin OK >> /fs/microsd/px4io_update.log + tone_alarm MSPAA + else + echo Failed loading /etc/px4io/px4io.bin >> /fs/microsd/px4io_update.log + echo "check Safety Button" >> /fs/microsd/APM/px4io_update.log + echo "Failed to upgrade PX4IO firmware" + tone_alarm MNGGG + fi + fi +fi + + if mkdir /fs/microsd/APM > /dev/null then echo "Created APM directory" @@ -74,33 +102,6 @@ else fi -######################## -# PX4IO upgrade handling -echo checking for /etc/px4io/px4io.bin -if [ -f /etc/px4io/px4io.bin ] -then - echo "Checking for new px4io firmware" - if cmp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded - then - echo "No new px4io firmware" - else - echo Loading /etc/px4io/px4io.bin - tone_alarm MBABGP - echo Loading /etc/px4io/px4io.bin > /fs/microsd/APM/px4io_update.log - if px4io update /etc/px4io/px4io.bin - then - cp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded - echo Loaded /etc/px4io/px4io.bin OK >> /fs/microsd/APM/px4io_update.log - tone_alarm MSPAA - else - echo Failed loading /etc/px4io/px4io.bin >> /fs/microsd/APM/px4io_update.log - echo "check Safety Button" >> /fs/microsd/APM/px4io_update.log - echo "Failed to upgrade PX4IO firmware" - tone_alarm MNGGG - fi - fi -fi - echo "Starting APM sensors" echo "Starting APM sensors" > $logfile if ms5611 start