Commit ee97864e authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4258 from DonLakeFlyer/LogSettings

Allow changes of log saving if not armed with reboot
parents 92bf4bd5 5693e862
...@@ -57,7 +57,7 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app) ...@@ -57,7 +57,7 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app)
#ifndef __mobile__ #ifndef __mobile__
, _logSuspendError(false) , _logSuspendError(false)
, _logSuspendReplay(false) , _logSuspendReplay(false)
, _logPromptForSave(false) , _vehicleWasArmed(false)
, _tempLogFile(QString("%2.%3").arg(_tempLogFileTemplate).arg(_logFileExtension)) , _tempLogFile(QString("%2.%3").arg(_tempLogFileTemplate).arg(_logFileExtension))
#endif #endif
, _linkMgr(NULL) , _linkMgr(NULL)
...@@ -283,11 +283,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -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. // 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_heartbeat_t state;
mavlink_msg_heartbeat_decode(&message, &state); mavlink_msg_heartbeat_decode(&message, &state);
if (state.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY) { if (state.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY) {
_logPromptForSave = true; _vehicleWasArmed = true;
} }
} }
} }
...@@ -429,11 +429,7 @@ void MAVLinkProtocol::_startLogging(void) ...@@ -429,11 +429,7 @@ void MAVLinkProtocol::_startLogging(void)
return; return;
} }
if (_app->promptFlightDataSaveNotArmed()) { qDebug() << "Temp log" << _tempLogFile.fileName();
_logPromptForSave = true;
}
qDebug() << "Temp log" << _tempLogFile.fileName() << _logPromptForSave;
_logSuspendError = false; _logSuspendError = false;
} }
...@@ -444,13 +440,13 @@ void MAVLinkProtocol::_stopLogging(void) ...@@ -444,13 +440,13 @@ void MAVLinkProtocol::_stopLogging(void)
{ {
if (_closeLogFile()) { if (_closeLogFile()) {
// If the signals are not connected it means we are running a unit test. In that case just delete log files // 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()); emit saveTempFlightDataLog(_tempLogFile.fileName());
} else { } else {
QFile::remove(_tempLogFile.fileName()); QFile::remove(_tempLogFile.fileName());
} }
} }
_logPromptForSave = false; _vehicleWasArmed = false;
} }
/// @brief Checks the temp directory for log files which may have been left there. /// @brief Checks the temp directory for log files which may have been left there.
......
...@@ -7,13 +7,6 @@ ...@@ -7,13 +7,6 @@
* *
****************************************************************************/ ****************************************************************************/
/**
* @file
* @brief Definition of class MAVLinkProtocol
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef MAVLINKPROTOCOL_H_ #ifndef MAVLINKPROTOCOL_H_
#define MAVLINKPROTOCOL_H_ #define MAVLINKPROTOCOL_H_
...@@ -179,7 +172,7 @@ private: ...@@ -179,7 +172,7 @@ private:
bool _logSuspendError; ///< true: Logging suspended due to error bool _logSuspendError; ///< true: Logging suspended due to error
bool _logSuspendReplay; ///< true: Logging suspended due to replay 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 QGCTemporaryFile _tempLogFile; ///< File to log to
static const char* _tempLogFileTemplate; ///< Template for temporary log file 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