Rover: set the ahrs.set_armed() flag

This commit is contained in:
Andrew Tridgell 2014-02-19 10:54:04 +11:00
parent a45d77f893
commit 532f06073a
3 changed files with 4 additions and 5 deletions

View File

@ -649,6 +649,8 @@ void loop()
// update AHRS system
static void ahrs_update()
{
ahrs.set_armed(hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
#if HIL_MODE != HIL_MODE_DISABLED
// update hil before AHRS update
gcs_update();

View File

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

View File

@ -516,10 +516,7 @@ static bool should_log(uint32_t mask)
if (!(mask & g.log_bitmask) || in_mavlink_delay) {
return false;
}
bool armed;
armed = (hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
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