QGC.h 1.54 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10
#pragma once
11

12
#include <QDateTime>
13
#include <QColor>
14
#include <QThread>
15

16
#include "QGCConfig.h"
17

18 19
namespace QGC
{
20

21 22 23 24
/**
 * @brief Get the current ground time in microseconds.
 * @note This does not have microsecond precision, it is limited to millisecond precision.
 */
25 26 27
quint64 groundTimeUsecs();
/** @brief Get the current ground time in milliseconds */
quint64 groundTimeMilliseconds();
28 29 30 31
/** 
 * @brief Get the current ground time in fractional seconds
 * @note Precision is limited to milliseconds.
 */
32
qreal groundTimeSeconds();
33
/** @brief Returns the angle limited to -pi - pi */
34
float limitAngleToPMPIf(double angle);
35 36
/** @brief Returns the angle limited to -pi - pi */
double limitAngleToPMPId(double angle);
37

Gus Grubba's avatar
Gus Grubba committed
38 39 40 41 42
/** @brief Records boot time (called from main) */
void initTimer();
/** @brief Get the ground time since boot in milliseconds */
quint64 bootTimeMilliseconds();

43 44
/// Returns true if the two values are equal or close. Correctly handles 0 and NaN values.
bool fuzzyCompare(double value1, double value2);
45

46 47
class SLEEP : public QThread
{
48
    Q_OBJECT
49
public:
Tomaz Canabrava's avatar
Tomaz Canabrava committed
50 51 52
    using QThread::sleep;
    using QThread::msleep;
    using QThread::usleep;
53
};
54

55 56
quint32 crc32(const quint8 *src, unsigned len, unsigned state);

57
}