Skip to content
Snippets Groups Projects
Commit a7f03619 authored by Randy Mackay's avatar Randy Mackay
Browse files

Copter: add inav vs baro arming check

In-flight Barometer sanity checking will be a more complete solution but
until then this should catch some bad pre-flight barometer behaviour
parent fc6ce42a
No related branches found
No related tags found
No related merge requests found
...@@ -241,6 +241,13 @@ static void pre_arm_checks(bool display_failure) ...@@ -241,6 +241,13 @@ static void pre_arm_checks(bool display_failure)
} }
return; return;
} }
// check Baro & inav alt are within 1m
if(fabs(inertial_nav.get_altitude() - baro_alt) > 100) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Alt disparity"));
}
return;
}
} }
// check Compass // check Compass
...@@ -436,6 +443,16 @@ static bool arm_checks(bool display_failure) ...@@ -436,6 +443,16 @@ static bool arm_checks(bool display_failure)
return true; return true;
} }
// check Baro & inav alt are within 1m
if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_BARO)) {
if(fabs(inertial_nav.get_altitude() - baro_alt) > 100) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Alt disparity"));
}
return false;
}
}
// check gps is ok if required - note this same check is also done in pre-arm checks // check gps is ok if required - note this same check is also done in pre-arm checks
if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_GPS)) { if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_GPS)) {
if ((mode_requires_GPS(control_mode) || g.failsafe_gps_enabled == FS_GPS_LAND_EVEN_STABILIZE) && !pre_arm_gps_checks(display_failure)) { if ((mode_requires_GPS(control_mode) || g.failsafe_gps_enabled == FS_GPS_LAND_EVEN_STABILIZE) && !pre_arm_gps_checks(display_failure)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment