Browse Source

Plane: use ahrs.get_armed()

master
Andrew Tridgell 11 years ago
parent
commit
33851030a4
  1. 13
      ArduPlane/ArduPlane.pde
  2. 2
      ArduPlane/GCS_Mavlink.pde
  3. 10
      ArduPlane/system.pde

13
ArduPlane/ArduPlane.pde

@ -801,6 +801,9 @@ void loop() @@ -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) @@ -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

2
ArduPlane/GCS_Mavlink.pde

@ -91,7 +91,7 @@ static NOINLINE void send_heartbeat(mavlink_channel_t chan) @@ -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;
}

10
ArduPlane/system.pde

@ -610,15 +610,7 @@ static bool should_log(uint32_t mask) @@ -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

Loading…
Cancel
Save