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
5e416d5e
Commit
5e416d5e
authored
May 05, 2010
by
lm
Browse files
Fixed issues with loss counting, added support for usec timestamps
parent
70692347
Changes
2
Show whitespace changes
Inline
Side-by-side
src/MG.h
View file @
5e416d5e
...
...
@@ -303,6 +303,24 @@ namespace MG
return
static_cast
<
quint64
>
(
milliseconds
+
time
.
time
().
msec
());
}
/**
* @brief Convenience method to get the milliseconds time stamp for now
*
* The timestamp is created at the instant of calling this method. It is
* defined as the number of milliseconds since unix epoch, which is
* 1.1.1970, 00:00 UTC.
*
* @return The number of milliseconds elapsed since unix epoch
* @deprecated Will the replaced by time helper class
**/
static
quint64
getGroundTimeNowUsecs
()
{
QDateTime
time
=
QDateTime
::
currentDateTime
();
time
=
time
.
toUTC
();
/* Return seconds and milliseconds, in milliseconds unit */
quint64
microseconds
=
time
.
toTime_t
()
*
static_cast
<
quint64
>
(
1000000
);
return
static_cast
<
quint64
>
(
microseconds
+
(
time
.
time
().
msec
()
*
1000
));
}
/*tatic quint64 getMissionTimeUsecs()
{
;
...
...
src/comm/MAVLinkProtocol.cc
View file @
5e416d5e
...
...
@@ -149,7 +149,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link)
}
int
safeguard
=
0
;
//qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid << "LASTINDEX" << lastIndex[message.sysid][message.compid] << "SEQ" << message.seq;
//qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid <<
"MSGID" << message.msgid <<
"LASTINDEX" << lastIndex[message.sysid][message.compid] << "SEQ" << message.seq;
while
(
lastIndex
[
message
.
sysid
][
message
.
compid
]
!=
message
.
seq
&&
safeguard
<
1
)
{
if
(
lastIndex
[
message
.
sysid
][
message
.
compid
]
==
255
)
...
...
@@ -171,13 +171,12 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link)
// while (lastCompIndex->value(message.compid, 0)+1 )
// }
//if ()
if
(
lastLoss
!=
totalLossCounter
)
if
(
lastLoss
!=
totalLossCounter
||
(
totalReceiveCounter
/
64
)
==
0
)
{
// Calculate new loss ratio
// Receive loss
float
receiveLoss
=
(
double
)
totalLossCounter
/
(
double
)(
totalReceiveCounter
+
totalLossCounter
);
receiveLoss
*=
100.0
f
;
qDebug
()
<<
"LOSS"
<<
receiveLoss
;
emit
receiveLossChanged
(
receiveLoss
);
}
...
...
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