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
0f136f32
Commit
0f136f32
authored
Nov 17, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added update rate calculation for incoming messages
parent
9ecf6a95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
QGCMAVLinkInspector.cc
src/ui/QGCMAVLinkInspector.cc
+11
-5
QGCMAVLinkInspector.h
src/ui/QGCMAVLinkInspector.h
+1
-1
No files found.
src/ui/QGCMAVLinkInspector.cc
View file @
0f136f32
...
...
@@ -38,7 +38,7 @@ void QGCMAVLinkInspector::refreshView()
if
(
!
msg
)
continue
;
// Update the tree view
QString
messageName
(
"%1 (%2 Hz, #%3)"
);
messageName
=
messageName
.
arg
(
messageInfo
[
msg
->
msgid
].
name
).
arg
(
messagesHz
.
value
(
msg
->
msgid
,
0
)).
arg
(
msg
->
msgid
);
messageName
=
messageName
.
arg
(
messageInfo
[
msg
->
msgid
].
name
).
arg
(
messagesHz
.
value
(
msg
->
msgid
,
0
)
,
2
,
'f'
,
0
).
arg
(
msg
->
msgid
);
if
(
!
treeWidgetItems
.
contains
(
msg
->
msgid
))
{
...
...
@@ -80,12 +80,18 @@ void QGCMAVLinkInspector::receiveMessage(LinkInterface* link,mavlink_message_t m
quint64
receiveTime
=
QGC
::
groundTimeMilliseconds
();
if
(
lastMessageUpdate
.
contains
(
message
.
msgid
))
{
msgHz
=
((
float
)((
float
)
receiveTime
-
(
float
)
lastMessageUpdate
.
value
(
message
.
msgid
)))
/
1000.0
f
;
qDebug
()
<<
"DIFF:"
<<
receiveTime
-
lastMessageUpdate
.
value
(
message
.
msgid
);
messagesHz
.
insert
(
message
.
msgid
,
0.1
f
*
msgHz
+
0.9
f
*
messagesHz
.
value
(
message
.
msgid
,
1
));
msgHz
=
1000.0
/
(
double
)(
receiveTime
-
lastMessageUpdate
.
value
(
message
.
msgid
));
if
(
isinf
(
msgHz
)
||
isnan
(
msgHz
)
||
msgHz
<
0.0
f
)
{
msgHz
=
1
;
}
//qDebug() << "DIFF:" << receiveTime - lastMessageUpdate.value(message.msgid);
float
newHz
=
0.001
f
*
msgHz
+
0.999
f
*
messagesHz
.
value
(
message
.
msgid
,
1
);
qDebug
()
<<
"HZ"
<<
newHz
;
messagesHz
.
insert
(
message
.
msgid
,
newHz
);
}
qDebug
()
<<
"MSGHZ:"
<<
messagesHz
.
value
(
message
.
msgid
,
1000
);
//
qDebug() << "MSGHZ:" << messagesHz.value(message.msgid, 1000);
lastMessageUpdate
.
insert
(
message
.
msgid
,
receiveTime
);
}
...
...
src/ui/QGCMAVLinkInspector.h
View file @
0f136f32
...
...
@@ -27,7 +27,7 @@ public slots:
protected:
QMap
<
int
,
quint64
>
lastMessageUpdate
;
///< Used to switch between highlight and non-highlighting color
QMap
<
int
,
quint64
>
messagesHz
;
///< Used to store update rate in Hz
QMap
<
int
,
float
>
messagesHz
;
///< Used to store update rate in Hz
mavlink_message_t
receivedMessages
[
256
];
///< Available / known messages
QMap
<
int
,
QTreeWidgetItem
*>
treeWidgetItems
;
///< Available tree widget items
QTimer
updateTimer
;
///< Only update at 1 Hz to not overload the GUI
...
...
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