logger: send post-flight perf data when stopping mavlink log streaming

- send out VEHICLE_CMD_RESULT_IN_PROGRESS
- delete the ulog object when receiving the ACK from logger, instead of
  the stop command
This commit is contained in:
Beat Küng
2021-02-15 11:09:04 +01:00
committed by Daniel Agar
parent 0f6bf6bc0e
commit e1ac6fe297
4 changed files with 21 additions and 13 deletions
+15 -2
View File
@@ -1124,7 +1124,11 @@ void Logger::handle_vehicle_command_update()
}
} else if (command.command == vehicle_command_s::VEHICLE_CMD_LOGGING_STOP) {
stop_log_mavlink();
if (_writer.is_started(LogType::Full, LogWriter::BackendMavlink)) {
ack_vehicle_command(&command, vehicle_command_s::VEHICLE_CMD_RESULT_IN_PROGRESS);
stop_log_mavlink();
}
ack_vehicle_command(&command, vehicle_command_s::VEHICLE_CMD_RESULT_ACCEPTED);
}
}
@@ -1388,7 +1392,16 @@ void Logger::stop_log_mavlink()
{
// don't write perf data since a client does not expect more data after a stop command
PX4_INFO("Stop mavlink log");
_writer.stop_log_mavlink();
if (_writer.is_started(LogType::Full, LogWriter::BackendMavlink)) {
_writer.select_write_backend(LogWriter::BackendMavlink);
_writer.set_need_reliable_transfer(true);
write_perf_data(false);
_writer.set_need_reliable_transfer(false);
_writer.unselect_write_backend();
_writer.notify();
_writer.stop_log_mavlink();
}
}
struct perf_callback_data_t {