diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index f747966e03..1337a777c8 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -228,30 +228,26 @@ else fi unset BOARD_RC_ADDITIONAL_INIT - # Load airframe configuration based on SYS_AUTOSTART parameter - if ! param compare SYS_AUTOSTART 0 + # Load airframe configuration based on SYS_AUTOSTART parameter if successful VEHICLE_TYPE gets set + # Run autogenerated ROMFS airframe script + . ${R}etc/init.d/rc.autostart + + if [ ${VEHICLE_TYPE} = none ] then - # rc.autostart directly run the right airframe script which sets the VEHICLE_TYPE - # Look for airframe in ROMFS - . ${R}etc/init.d/rc.autostart - - if [ ${VEHICLE_TYPE} = none ] + # Run external airframe script on SD card + if [ $STORAGE_AVAILABLE = yes ] then - # Use external startup file - if [ $STORAGE_AVAILABLE = yes ] - then - . ${R}etc/init.d/rc.autostart_ext - else - echo "ERROR [init] SD card not mounted - can't load external airframe" - fi + . ${R}etc/init.d/rc.autostart_ext + else + echo "ERROR [init] SD not mounted, skipping external airframe" fi + fi - if [ ${VEHICLE_TYPE} = none ] - then - echo "ERROR [init] No airframe file found for SYS_AUTOSTART value" - param set SYS_AUTOSTART 0 - tune_control play error - fi + if [ ${VEHICLE_TYPE} = none ] + then + echo "ERROR [init] No airframe file found for SYS_AUTOSTART value" + param set SYS_AUTOSTART 0 + tune_control play error fi # Check parameter version and reset upon airframe configuration version mismatch.