Browse Source

Plane: start logging when first needed

mission-4.1.18
Andrew Tridgell 11 years ago
parent
commit
a15336079e
  1. 3
      ArduPlane/ArduPlane.pde
  2. 12
      ArduPlane/GCS_Mavlink.pde
  3. 9
      ArduPlane/system.pde

3
ArduPlane/ArduPlane.pde

@ -164,6 +164,9 @@ DataFlash_Empty DataFlash;
#endif #endif
#endif #endif
// has a log download started?
static bool in_log_download;
// scaled roll limit based on pitch // scaled roll limit based on pitch
static int32_t roll_limit_cd; static int32_t roll_limit_cd;
static int32_t pitch_limit_min_cd; static int32_t pitch_limit_min_cd;

12
ArduPlane/GCS_Mavlink.pde

@ -2182,7 +2182,17 @@ mission_failed:
break; break;
} }
case MAVLINK_MSG_ID_LOG_REQUEST_LIST ... MAVLINK_MSG_ID_LOG_REQUEST_END: case MAVLINK_MSG_ID_LOG_REQUEST_DATA:
case MAVLINK_MSG_ID_LOG_ERASE:
in_log_download = true;
// fallthru
case MAVLINK_MSG_ID_LOG_REQUEST_LIST:
if (!in_mavlink_delay) {
handle_log_message(msg, DataFlash);
}
break;
case MAVLINK_MSG_ID_LOG_REQUEST_END:
in_log_download = false;
if (!in_mavlink_delay) { if (!in_mavlink_delay) {
handle_log_message(msg, DataFlash); handle_log_message(msg, DataFlash);
} }

9
ArduPlane/system.pde

@ -142,9 +142,6 @@ static void init_ardupilot()
gcs[i].reset_cli_timeout(); gcs[i].reset_cli_timeout();
} }
} }
if (g.log_bitmask != 0) {
start_logging();
}
#endif #endif
// Register mavlink_delay_cb, which will run anytime you have // Register mavlink_delay_cb, which will run anytime you have
@ -624,5 +621,9 @@ static bool should_log(uint32_t mask)
} else { } else {
armed = arming.is_armed(); armed = arming.is_armed();
} }
return armed || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0; bool ret = armed || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;
if (ret && !DataFlash.logging_started() && !in_log_download) {
start_logging();
}
return ret;
} }

Loading…
Cancel
Save