mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-05 23:43:58 -04:00
PX4: auto-format microSD if corrupt
and allow boot with no microSD if USB is not connected. If USB is connected give a nsh shell on USB
This commit is contained in:
parent
8bd7c171e4
commit
c0e212916b
@ -45,13 +45,32 @@ then
|
||||
# Start playing the startup tune
|
||||
tone_alarm start
|
||||
else
|
||||
echo "[init] no microSD card found"
|
||||
set HAVE_MICROSD 0
|
||||
# Play SOS
|
||||
tone_alarm 2
|
||||
if [ $HAVE_RGBLED == 1 ]
|
||||
echo "Trying format of microSD"
|
||||
tone_alarm MBAGP
|
||||
if mkfatfs /dev/mmcsd0
|
||||
then
|
||||
rgbled rgb 16 0 0
|
||||
echo "microSD card formatted"
|
||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
||||
then
|
||||
echo "format succeeded"
|
||||
set HAVE_MICROSD 1
|
||||
tone_alarm start
|
||||
else
|
||||
echo "mount failed"
|
||||
tone_alarm MNBG
|
||||
if [ $HAVE_RGBLED == 1 ]
|
||||
then
|
||||
rgbled rgb 16 0 0
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "format failed"
|
||||
tone_alarm MNBGG
|
||||
if [ $HAVE_RGBLED == 1 ]
|
||||
then
|
||||
rgbled rgb 16 0 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -88,6 +107,17 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $HAVE_MICROSD == 0 ]
|
||||
then
|
||||
if usb_connected
|
||||
then
|
||||
echo "Opening USB nsh"
|
||||
else
|
||||
echo "booting with no microSD"
|
||||
set HAVE_MICROSD 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# if this is an APM build then there will be a rc.APM script
|
||||
# from an EXTERNAL_SCRIPTS build option
|
||||
if [ -f /etc/init.d/rc.APM -a $HAVE_MICROSD == 1 -a ! -f /fs/microsd/APM/nostart ]
|
||||
|
Loading…
Reference in New Issue
Block a user