diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 235875f21e50..d7a398f27106 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -274,33 +274,36 @@ else . $FCONFIG fi - # Check if PX4IO present and update firmware if needed. - if [ -f $IOFW ] + if ver px4io_present then - if ! px4io checkcrc ${IOFW} + # Check if PX4IO present and update firmware if needed. + if [ -f $IOFW ] then - # tune Program PX4IO - tune_control play -t 16 # tune 16 = PROG_PX4IO - - if px4io update ${IOFW} + if ! px4io checkcrc ${IOFW} then - usleep 10000 - tune_control stop - if px4io checkcrc ${IOFW} + # tune Program PX4IO + tune_control play -t 16 # tune 16 = PROG_PX4IO + + if px4io update ${IOFW} then - tune_control play -t 17 # tune 17 = PROG_PX4IO_OK + usleep 10000 + tune_control stop + if px4io checkcrc ${IOFW} + then + tune_control play -t 17 # tune 17 = PROG_PX4IO_OK + else + tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR + fi else - tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR + tune_control stop fi - else - tune_control stop fi - fi - if ! px4io start - then - echo "PX4IO start failed" - set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE + if ! px4io start + then + echo "PX4IO start failed" + set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE + fi fi fi diff --git a/src/systemcmds/ver/ver.cpp b/src/systemcmds/ver/ver.cpp index ab75009d1ec5..c09ac6736484 100644 --- a/src/systemcmds/ver/ver.cpp +++ b/src/systemcmds/ver/ver.cpp @@ -57,7 +57,8 @@ static const char sz_ver_buri_str[] = "uri"; static const char sz_ver_gcc_str[] = "gcc"; static const char sz_ver_all_str[] = "all"; static const char mcu_ver_str[] = "mcu"; -static const char px4_guid_str[] = "px4guid"; +static const char px4_guid_str[] = "px4guid"; +static const char px4io_present_str[] = "px4io_present"; static void usage(const char *reason) { @@ -76,6 +77,7 @@ static void usage(const char *reason) PRINT_MODULE_USAGE_COMMAND_DESCR("bdate", "Build date and time"); PRINT_MODULE_USAGE_COMMAND_DESCR("px4guid", "PX4 GUID"); PRINT_MODULE_USAGE_COMMAND_DESCR("uri", "Build URI"); + PRINT_MODULE_USAGE_COMMAND_DESCR("px4io_present", "PX4IO MCU present"); PRINT_MODULE_USAGE_COMMAND_DESCR("all", "Print all versions"); PRINT_MODULE_USAGE_COMMAND_DESCR("hwcmp", "Compare hardware version (returns 0 on match)"); @@ -269,6 +271,18 @@ extern "C" __EXPORT int ver_main(int argc, char *argv[]) ret = 0; } + if (show_all || !strncmp(argv[1], px4io_present_str, sizeof(px4io_present_str))) { + bool px4io_supported = PX4_MFT_HW_SUPPORTED(PX4_MFT_PX4IO); + + PX4_INFO_RAW("PX4IO MCU supported: %s\n", px4io_supported ? "YES" : "NO"); + + if (!show_all) { + return px4io_supported ? 0 : 1;; + } + + ret = 0; + } + if (ret == 1) { PX4_ERR("unknown command"); return 1;