Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
907134d9
Commit
907134d9
authored
Oct 27, 2015
by
Don Gagne
Browse files
Merge pull request #2125 from DonLakeFlyer/AutoConnect2
Start logging on heartbeat instead of connect
parents
932109ea
65b4b923
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/comm/MAVLinkProtocol.cc
View file @
907134d9
...
...
@@ -187,13 +187,6 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
// Use the same shared pointer as LinkManager
_connectedLinks
.
append
(
LinkManager
::
instance
()
->
sharedPointerForLink
(
link
));
#ifndef __mobile__
if
(
_connectedLinks
.
count
()
==
1
)
{
// This is the first link, we need to start logging
_startLogging
();
}
#endif
// Send command to start MAVLink
// XXX hacky but safe
// Start NSH
...
...
@@ -353,6 +346,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
#endif
if
(
message
.
msgid
==
MAVLINK_MSG_ID_HEARTBEAT
)
{
#ifndef __mobile__
// Start logging on first heartbeat
_startLogging
();
#endif
// Notify the vehicle manager of the heartbeat. This will create/update vehicles as needed.
mavlink_heartbeat_t
heartbeat
;
mavlink_msg_heartbeat_decode
(
&
message
,
&
heartbeat
);
...
...
@@ -646,20 +644,20 @@ bool MAVLinkProtocol::_closeLogFile(void)
void
MAVLinkProtocol
::
_startLogging
(
void
)
{
Q_ASSERT
(
!
_tempLogFile
.
isOpen
());
if
(
!
_tempLogFile
.
isOpen
())
{
if
(
!
_logSuspendReplay
)
{
if
(
!
_tempLogFile
.
open
())
{
emit
protocolStatusMessage
(
tr
(
"MAVLink Protocol"
),
tr
(
"Opening Flight Data file for writing failed. "
"Unable to write to %1. Please choose a different file location."
).
arg
(
_tempLogFile
.
fileName
()));
_closeLogFile
();
_logSuspendError
=
true
;
return
;
}
qDebug
()
<<
"Temp log"
<<
_tempLogFile
.
fileName
();
if
(
!
_logSuspendReplay
)
{
if
(
!
_tempLogFile
.
open
())
{
emit
protocolStatusMessage
(
tr
(
"MAVLink Protocol"
),
tr
(
"Opening Flight Data file for writing failed. "
"Unable to write to %1. Please choose a different file location."
).
arg
(
_tempLogFile
.
fileName
()));
_closeLogFile
();
_logSuspendError
=
true
;
return
;
_logSuspendError
=
false
;
}
qDebug
()
<<
"Temp log"
<<
_tempLogFile
.
fileName
();
_logSuspendError
=
false
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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