Plane: prevent log corruption when new log started

This commit is contained in:
Andrew Tridgell 2014-01-14 14:29:14 +11:00
parent 921f923c5f
commit cf09fef1db
2 changed files with 6 additions and 2 deletions

View File

@ -2223,7 +2223,7 @@ mission_failed:
static void mavlink_delay_cb()
{
static uint32_t last_1hz, last_50hz, last_5s;
if (!gcs[0].initialised) return;
if (!gcs[0].initialised || in_mavlink_delay) return;
in_mavlink_delay = true;

View File

@ -610,7 +610,7 @@ static void servo_write(uint8_t ch, uint16_t pwm)
*/
static bool should_log(uint32_t mask)
{
if (!(mask & g.log_bitmask)) {
if (!(mask & g.log_bitmask) || in_mavlink_delay) {
return false;
}
bool armed;
@ -623,7 +623,11 @@ static bool should_log(uint32_t mask)
}
bool ret = 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
in_mavlink_delay = true;
start_logging();
in_mavlink_delay = false;
}
return ret;
}