QGC.h 1.52 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

11 12 13
#ifndef QGC_H
#define QGC_H

14
#include <QDateTime>
15
#include <QColor>
16
#include <QThread>
17

18
#include "QGCConfig.h"
19

20 21
namespace QGC
{
22

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

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

45
const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21;
46

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

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

58 59
}

60 61
#define QGC_EVENTLOOP_DEBUG 0

62
#endif // QGC_H