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
babe2b7c
Commit
babe2b7c
authored
Sep 02, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify logSendBytes
Remove the use of mavlink_parse_char which distorts channel stats
parent
3536f1af
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
28 deletions
+12
-28
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+12
-28
No files found.
src/comm/MAVLinkProtocol.cc
View file @
babe2b7c
...
@@ -167,30 +167,17 @@ void MAVLinkProtocol::resetMetadataForLink(LinkInterface *link)
...
@@ -167,30 +167,17 @@ void MAVLinkProtocol::resetMetadataForLink(LinkInterface *link)
void
MAVLinkProtocol
::
logSentBytes
(
LinkInterface
*
link
,
QByteArray
b
){
void
MAVLinkProtocol
::
logSentBytes
(
LinkInterface
*
link
,
QByteArray
b
){
uint8_t
mavlinkChannel
=
link
->
mavlinkChannel
();
uint8_t
bytes_time
[
sizeof
(
quint64
)];
static
mavlink_message_t
_sent_message
;
for
(
int
position
=
0
;
position
<
b
.
size
();
position
++
)
{
if
(
mavlink_parse_char
(
mavlinkChannel
,
static_cast
<
uint8_t
>
(
b
[
position
]),
&
_sent_message
,
&
_status
)){
Q_UNUSED
(
link
);
if
(
!
_logSuspendError
&&
!
_logSuspendReplay
&&
_tempLogFile
.
isOpen
())
{
uint8_t
buf
[
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
)];
// Write the uint64 time in microseconds in big endian format before the message.
// This timestamp is saved in UTC time. We are only saving in ms precision because
// getting more than this isn't possible with Qt without a ton of extra code.
quint64
time
=
static_cast
<
quint64
>
(
QDateTime
::
currentMSecsSinceEpoch
()
*
1000
);
quint64
time
=
static_cast
<
quint64
>
(
QDateTime
::
currentMSecsSinceEpoch
()
*
1000
);
qToBigEndian
(
time
,
buf
);
// Then write the message to the buffer
qToBigEndian
(
time
,
bytes_time
);
int
len
=
mavlink_msg_to_send_buffer
(
buf
+
sizeof
(
quint64
),
&
_sent_message
);
// Determine how many bytes were written by adding the timestamp size to the message size
b
.
insert
(
0
,
QByteArray
((
const
char
*
)
bytes_time
,
sizeof
(
bytes_time
)));
len
+=
sizeof
(
quint64
);
// Now write this timestamp/message pair to the log.
int
len
=
b
.
count
();
QByteArray
b
(
reinterpret_cast
<
const
char
*>
(
buf
),
len
);
if
(
_tempLogFile
.
write
(
b
)
!=
len
)
if
(
_tempLogFile
.
write
(
b
)
!=
len
)
{
{
...
@@ -199,9 +186,6 @@ void MAVLinkProtocol::logSentBytes(LinkInterface* link, QByteArray b){
...
@@ -199,9 +186,6 @@ void MAVLinkProtocol::logSentBytes(LinkInterface* link, QByteArray b){
_stopLogging
();
_stopLogging
();
_logSuspendError
=
true
;
_logSuspendError
=
true
;
}
}
}
}
}
}
}
...
...
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