mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
system_params: add SYS_HAS_MAG and SYS_HAS_BARO params
This allows to use PX4 on systems that do not have a mag or a baro, such as the Omnibus F4 SD.
This commit is contained in:
parent
f754d092f8
commit
f2516bbf5f
@ -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) {
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user