APMrover2: stop using in_mavlink_delay as a proxy for disabling logging

This commit is contained in:
Peter Barker 2017-06-15 11:24:33 +10:00 committed by Francisco Ferreira
parent 6a03af8f3e
commit aeacc11573
3 changed files with 7 additions and 7 deletions

View File

@ -1584,6 +1584,8 @@ void Rover::mavlink_delay_cb()
} }
in_mavlink_delay = true; in_mavlink_delay = true;
// don't allow potentially expensive logging calls:
DataFlash.EnableWrites(false);
const uint32_t tnow = millis(); const uint32_t tnow = millis();
if (tnow - last_1hz > 1000) { if (tnow - last_1hz > 1000) {
@ -1603,6 +1605,7 @@ void Rover::mavlink_delay_cb()
} }
check_usb_mux(); check_usb_mux();
DataFlash.EnableWrites(true);
in_mavlink_delay = false; in_mavlink_delay = false;
} }

View File

@ -85,9 +85,9 @@ int8_t Rover::dump_log(uint8_t argc, const Menu::arg *argv)
int8_t Rover::erase_logs(uint8_t argc, const Menu::arg *argv) int8_t Rover::erase_logs(uint8_t argc, const Menu::arg *argv)
{ {
in_mavlink_delay = true; DataFlash.EnableWrites(false);
do_erase_logs(); do_erase_logs();
in_mavlink_delay = false; DataFlash.EnableWrites(true);
return 0; return 0;
} }
@ -510,9 +510,9 @@ void Rover::Log_Write_Vehicle_Startup_Messages()
// start a new log // start a new log
void Rover::start_logging() void Rover::start_logging()
{ {
in_mavlink_delay = true; DataFlash.EnableWrites(false);
DataFlash.StartUnstartedLogging(); DataFlash.StartUnstartedLogging();
in_mavlink_delay = false; DataFlash.EnableWrites(true);
} }
#else // LOGGING_ENABLED #else // LOGGING_ENABLED

View File

@ -540,9 +540,6 @@ uint8_t Rover::check_digital_pin(uint8_t pin)
*/ */
bool Rover::should_log(uint32_t mask) bool Rover::should_log(uint32_t mask)
{ {
if (in_mavlink_delay) {
return false;
}
if (!(mask & g.log_bitmask)) { if (!(mask & g.log_bitmask)) {
return false; return false;
} }