Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6813d2c1
Commit
6813d2c1
authored
Jul 24, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save log only if armed
parent
a48b1192
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+12
-1
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+1
-0
No files found.
src/comm/MAVLinkProtocol.cc
View file @
6813d2c1
...
@@ -56,6 +56,7 @@ MAVLinkProtocol::MAVLinkProtocol(QObject* parent) :
...
@@ -56,6 +56,7 @@ MAVLinkProtocol::MAVLinkProtocol(QObject* parent) :
systemId
(
QGC
::
defaultSystemId
),
systemId
(
QGC
::
defaultSystemId
),
_logSuspendError
(
false
),
_logSuspendError
(
false
),
_logSuspendReplay
(
false
),
_logSuspendReplay
(
false
),
_logWasArmed
(
false
),
_tempLogFile
(
QString
(
"%2.%3"
).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
)),
_tempLogFile
(
QString
(
"%2.%3"
).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
)),
_linkMgr
(
LinkManager
::
instance
()),
_linkMgr
(
LinkManager
::
instance
()),
_heartbeatRate
(
MAVLINK_HEARTBEAT_DEFAULT_RATE
),
_heartbeatRate
(
MAVLINK_HEARTBEAT_DEFAULT_RATE
),
...
@@ -330,6 +331,15 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
...
@@ -330,6 +331,15 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
_stopLogging
();
_stopLogging
();
_logSuspendError
=
true
;
_logSuspendError
=
true
;
}
}
// Check for the vehicle arming going by. This is used to trigger log save.
if
(
!
_logWasArmed
&&
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
)
{
_logWasArmed
=
true
;
}
}
}
}
// ORDER MATTERS HERE!
// ORDER MATTERS HERE!
...
@@ -690,12 +700,13 @@ void MAVLinkProtocol::_stopLogging(void)
...
@@ -690,12 +700,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
(
qgcApp
()
->
promptFlightDataSave
())
{
if
(
_logWasArmed
&&
qgcApp
()
->
promptFlightDataSave
())
{
emit
saveTempFlightDataLog
(
_tempLogFile
.
fileName
());
emit
saveTempFlightDataLog
(
_tempLogFile
.
fileName
());
}
else
{
}
else
{
QFile
::
remove
(
_tempLogFile
.
fileName
());
QFile
::
remove
(
_tempLogFile
.
fileName
());
}
}
}
}
_logWasArmed
=
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.
...
...
src/comm/MAVLinkProtocol.h
View file @
6813d2c1
...
@@ -292,6 +292,7 @@ private:
...
@@ -292,6 +292,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
_logWasArmed
;
///< true: vehicle was armed during logging
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment