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
d6e0e342
Commit
d6e0e342
authored
Jul 30, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
6e83df06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
QGC.cc
src/QGC.cc
+16
-0
QGC.h
src/QGC.h
+3
-8
No files found.
src/QGC.cc
View file @
d6e0e342
...
@@ -9,9 +9,12 @@
...
@@ -9,9 +9,12 @@
#include "QGC.h"
#include "QGC.h"
#include <qmath.h>
#include <qmath.h>
#include <float.h>
#include <float.h>
#include <QtGlobal>
namespace
QGC
namespace
QGC
{
{
...
@@ -137,4 +140,17 @@ quint32 crc32(const quint8 *src, unsigned len, unsigned state)
...
@@ -137,4 +140,17 @@ quint32 crc32(const quint8 *src, unsigned len, unsigned state)
return
state
;
return
state
;
}
}
bool
fuzzyCompare
(
double
value1
,
double
value2
)
{
if
(
qIsNaN
(
value1
)
&&
qIsNaN
(
value2
))
{
return
true
;
}
else
if
(
qIsNaN
(
value1
)
||
qIsNaN
(
value2
))
{
return
false
;
}
else
if
(
value1
==
value2
)
{
return
true
;
}
else
{
return
qFuzzyCompare
(
value1
,
value2
);
}
}
}
}
src/QGC.h
View file @
d6e0e342
...
@@ -7,9 +7,7 @@
...
@@ -7,9 +7,7 @@
*
*
****************************************************************************/
****************************************************************************/
#pragma once
#ifndef QGC_H
#define QGC_H
#include <QDateTime>
#include <QDateTime>
#include <QColor>
#include <QColor>
...
@@ -42,7 +40,8 @@ void initTimer();
...
@@ -42,7 +40,8 @@ void initTimer();
/** @brief Get the ground time since boot in milliseconds */
/** @brief Get the ground time since boot in milliseconds */
quint64
bootTimeMilliseconds
();
quint64
bootTimeMilliseconds
();
const
static
int
MAX_FLIGHT_TIME
=
60
*
60
*
24
*
21
;
/// Returns true if the two values are equal or close. Correctly handles 0 and NaN values.
bool
fuzzyCompare
(
double
value1
,
double
value2
);
class
SLEEP
:
public
QThread
class
SLEEP
:
public
QThread
{
{
...
@@ -56,7 +55,3 @@ public:
...
@@ -56,7 +55,3 @@ public:
quint32
crc32
(
const
quint8
*
src
,
unsigned
len
,
unsigned
state
);
quint32
crc32
(
const
quint8
*
src
,
unsigned
len
,
unsigned
state
);
}
}
#define QGC_EVENTLOOP_DEBUG 0
#endif // QGC_H
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