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
This commit is contained in:
Randy Mackay 2014-01-17 17:21:42 +09:00
parent fc6ce42a28
commit a7f03619f2

View File

@ -241,6 +241,13 @@ static void pre_arm_checks(bool display_failure)
}
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
@ -436,6 +443,16 @@ static bool arm_checks(bool display_failure)
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
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)) {