diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 9986a3a75374..0849dbd6cd6a 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -217,25 +217,31 @@ else fi unset BOARD_RC_DEFAULTS - # - # Set parameters and env variables for selected SYS_AUTOSTART. - # - set AUTOSTART_PATH etc/init.d/rc.autostart + # Load airframe configuration based on SYS_AUTOSTART parameter if ! param compare SYS_AUTOSTART 0 then - if param greater SYS_AUTOSTART 1000000 + # 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 ] then - # Use external startup file + # Look for airframe on SD card if [ $SDCARD_AVAILABLE = yes ] then - set AUTOSTART_PATH etc/init.d/rc.autostart_ext + . ${R}etc/init.d/rc.autostart_ext else - echo "ERROR [init] SD card not mounted - trying to load airframe from ROMFS" + echo "ERROR [init] SD card not mounted - can't load external airframe" fi fi - . ${R}$AUTOSTART_PATH + + 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 fi - unset AUTOSTART_PATH # Check parameter version and reset upon airframe configuration version mismatch. # Reboot required because "param reset_all" would reset all "param set" lines from airframe. diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py index 9bc8747185a2..a6bdc9e94410 100644 --- a/Tools/px4airframes/rcout.py +++ b/Tools/px4airframes/rcout.py @@ -79,12 +79,6 @@ def __init__(self, groups, board, post_start=False): result += "then\n" result += "\techo \"Loading airframe: /etc/init.d/airframes/${AIRFRAME}\"\n" result += "\t. /etc/init.d/airframes/${AIRFRAME}\n" - if not post_start: - result += "else\n" - result += "\techo \"ERROR [init] No file matches SYS_AUTOSTART value found in : /etc/init.d/airframes\"\n" - # Reset the configuration - result += "\tparam set SYS_AUTOSTART 0\n" - result += "\ttone_alarm ${TUNE_ERR}\n" result += "fi\n" result += "unset AIRFRAME" self.output = result