Plane: use ahrs.get_armed()

This commit is contained in:
Andrew Tridgell 2014-02-19 10:53:26 +11:00
parent c9d0c1face
commit 33851030a4
3 changed files with 6 additions and 19 deletions

View File

@ -801,6 +801,9 @@ void loop()
// update AHRS system
static void ahrs_update()
{
ahrs.set_armed(arming.is_armed() &&
hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
#if HIL_MODE != HIL_MODE_DISABLED
// update hil before AHRS update
gcs_update();
@ -1081,16 +1084,8 @@ static void update_GPS_10Hz(void)
}
#endif
if (!arming.is_armed() ||
hal.util->safety_switch_state() == AP_HAL::Util::SAFETY_DISARMED) {
if (g_gps->status() >= GPS::GPS_OK_FIX_3D) {
ahrs.set_correct_centrifugal(true);
} else {
ahrs.set_correct_centrifugal(false);
}
if (!ahrs.get_armed()) {
update_home();
} else {
ahrs.set_correct_centrifugal(true);
}
// update wind estimate

View File

@ -91,7 +91,7 @@ static NOINLINE void send_heartbeat(mavlink_channel_t chan)
#endif
// we are armed if we are not initialising
if (control_mode != INITIALISING && arming.is_armed()) {
if (control_mode != INITIALISING && ahrs.get_armed()) {
base_mode |= MAV_MODE_FLAG_SAFETY_ARMED;
}

View File

@ -610,15 +610,7 @@ static bool should_log(uint32_t mask)
if (!(mask & g.log_bitmask) || in_mavlink_delay) {
return false;
}
bool armed;
if (arming.arming_required() == AP_Arming::NO) {
// for logging purposes consider us armed if we either don't
// have a safety switch, or we have one and it is disarmed
armed = (hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
} else {
armed = arming.is_armed();
}
bool ret = armed || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;
bool ret = ahrs.get_armed() || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;
if (ret && !DataFlash.logging_started() && !in_log_download) {
// we have to set in_mavlink_delay to prevent logging while
// writing headers