Commit 5693e862 authored by Don Gagne's avatar Don Gagne

Allow changes of log saving if not armed with reboot

parent d662b4da
......@@ -57,7 +57,7 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app)
#ifndef __mobile__
, _logSuspendError(false)
, _logSuspendReplay(false)
, _logPromptForSave(false)
, _vehicleWasArmed(false)
, _tempLogFile(QString("%2.%3").arg(_tempLogFileTemplate).arg(_logFileExtension))
#endif
, _linkMgr(NULL)
......@@ -283,11 +283,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
}
// Check for the vehicle arming going by. This is used to trigger log save.
if (!_logPromptForSave && message.msgid == MAVLINK_MSG_ID_HEARTBEAT) {
if (!_vehicleWasArmed && message.msgid == MAVLINK_MSG_ID_HEARTBEAT) {
mavlink_heartbeat_t state;
mavlink_msg_heartbeat_decode(&message, &state);
if (state.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY) {
_logPromptForSave = true;
_vehicleWasArmed = true;
}
}
}
......@@ -429,11 +429,7 @@ void MAVLinkProtocol::_startLogging(void)
return;
}
if (_app->promptFlightDataSaveNotArmed()) {
_logPromptForSave = true;
}
qDebug() << "Temp log" << _tempLogFile.fileName() << _logPromptForSave;
qDebug() << "Temp log" << _tempLogFile.fileName();
_logSuspendError = false;
}
......@@ -444,13 +440,13 @@ void MAVLinkProtocol::_stopLogging(void)
{
if (_closeLogFile()) {
// If the signals are not connected it means we are running a unit test. In that case just delete log files
if (_logPromptForSave && _app->promptFlightDataSave()) {
if ((_vehicleWasArmed || _app->promptFlightDataSaveNotArmed()) && _app->promptFlightDataSave()) {
emit saveTempFlightDataLog(_tempLogFile.fileName());
} else {
QFile::remove(_tempLogFile.fileName());
}
}
_logPromptForSave = false;
_vehicleWasArmed = false;
}
/// @brief Checks the temp directory for log files which may have been left there.
......
......@@ -7,13 +7,6 @@
*
****************************************************************************/
/**
* @file
* @brief Definition of class MAVLinkProtocol
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef MAVLINKPROTOCOL_H_
#define MAVLINKPROTOCOL_H_
......@@ -179,7 +172,7 @@ private:
bool _logSuspendError; ///< true: Logging suspended due to error
bool _logSuspendReplay; ///< true: Logging suspended due to replay
bool _logPromptForSave; ///< true: Prompt for log save when appropriate
bool _vehicleWasArmed; ///< true: Vehicle was armed during log sequence
QGCTemporaryFile _tempLogFile; ///< File to log to
static const char* _tempLogFileTemplate; ///< Template for temporary log file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment