diff --git a/src/modules/commander/PreflightCheck.cpp b/src/modules/commander/PreflightCheck.cpp index 503feacb2f..fecc9176c9 100644 --- a/src/modules/commander/PreflightCheck.cpp +++ b/src/modules/commander/PreflightCheck.cpp @@ -712,12 +712,14 @@ bool preflightCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_s &statu bool prime_found = false; int32_t prime_id = 0; param_get(param_find("CAL_MAG_PRIME"), &prime_id); + int32_t sys_has_mag = 1; + param_get(param_find("SYS_HAS_MAG"), &sys_has_mag); bool mag_fail_reported = false; /* check all sensors, but fail only for mandatory ones */ for (unsigned i = 0; i < max_optional_mag_count; i++) { - bool required = (i < max_mandatory_mag_count); + bool required = (i < max_mandatory_mag_count) && sys_has_mag == 1; int device_id = -1; if (!magnometerCheck(mavlink_log_pub, i, !required, device_id, (reportFailures && !failed && !mag_fail_reported)) && required) { @@ -816,12 +818,14 @@ bool preflightCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_s &statu bool prime_found = false; int32_t prime_id = 0; param_get(param_find("CAL_BARO_PRIME"), &prime_id); + int32_t sys_has_baro = 1; + param_get(param_find("SYS_HAS_BARO"), &sys_has_baro); bool baro_fail_reported = false; /* check all sensors, but fail only for mandatory ones */ for (unsigned i = 0; i < max_optional_baro_count; i++) { - bool required = (i < max_mandatory_baro_count); + bool required = (i < max_mandatory_baro_count) && sys_has_baro == 1; int device_id = -1; if (!baroCheck(mavlink_log_pub, i, !required, device_id, (reportFailures && !failed && !baro_fail_reported)) && required) { diff --git a/src/modules/sensors/parameters.cpp b/src/modules/sensors/parameters.cpp index cd7261b72a..4b3ae53275 100644 --- a/src/modules/sensors/parameters.cpp +++ b/src/modules/sensors/parameters.cpp @@ -188,6 +188,9 @@ void initialize_parameter_handles(ParameterHandles ¶meter_handles) (void)param_find("SYS_CAL_TDEL"); (void)param_find("SYS_CAL_TMAX"); (void)param_find("SYS_CAL_TMIN"); + + (void)param_find("SYS_HAS_MAG"); + (void)param_find("SYS_HAS_BARO"); } int update_parameters(const ParameterHandles ¶meter_handles, Parameters ¶meters) diff --git a/src/modules/systemlib/system_params.c b/src/modules/systemlib/system_params.c index 036d0a4a1c..24d39ce691 100644 --- a/src/modules/systemlib/system_params.c +++ b/src/modules/systemlib/system_params.c @@ -248,3 +248,32 @@ PARAM_DEFINE_INT32(SYS_CAL_TMIN, 5); * @group System */ PARAM_DEFINE_INT32(SYS_CAL_TMAX, 10); + +/** + * Control if the vehicle has a magnetometer + * + * Disable this if the board has no magnetometer, such as the Omnibus F4 SD. + * If disabled, the preflight checks will not check for the presence of a + * magnetometer. + * + * @boolean + * @reboot_required true + * + * @group System + */ +PARAM_DEFINE_INT32(SYS_HAS_MAG, 1); + +/** + * Control if the vehicle has a barometer + * + * Disable this if the board has no barometer, such as some of the the Omnibus + * F4 SD variants. + * If disabled, the preflight checks will not check for the presence of a + * barometer. + * + * @boolean + * @reboot_required true + * + * @group System + */ +PARAM_DEFINE_INT32(SYS_HAS_BARO, 1);