Subversion Repositories Projects

Rev

Rev 481 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 481 Rev 525
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
#ifndef GLOBAL_H
19
#ifndef GLOBAL_H
20
#define GLOBAL_H
20
#define GLOBAL_H
21
 
21
 
22
#include <QString>
22
#include <QString>
23
#include <QSize>
23
#include <QSize>
24
#include <QPoint>
24
#include <QPoint>
25
#include <QColor>
25
#include <QColor>
26
#include <QBitArray>
26
#include <QBitArray>
27
 
27
 
28
#include "Parameter_Positions.h"
28
#include "Parameter_Positions.h"
29
 
29
 
30
#ifdef _WIN32_
30
#ifdef _WIN32_
31
static const QString OS_PORT = "COM1";
31
static const QString OS_PORT = "COM1";
32
#else
32
#else
33
static const QString OS_PORT = "/dev/ttyUSB0";
33
static const QString OS_PORT = "/dev/ttyUSB0";
34
#endif
34
#endif
35
 
35
 
36
//#define _EEEPC_
36
//#define _EEEPC_
37
 
-
 
38
#ifdef _EEEPC_
-
 
39
    static const int MeterSize = 125;
-
 
40
#else
-
 
41
    static const int MeterSize = 160;
-
 
42
#endif
-
 
43
 
37
 
44
// Version des Seriellen Protokoll
38
// Version des Seriellen Protokoll
45
static const int VERSION_SERIAL_MAJOR = 10;
39
static const int VERSION_SERIAL_MAJOR = 10;
46
static const int VERSION_SERIAL_MINOR = 0;
40
static const int VERSION_SERIAL_MINOR = 0;
47
 
41
 
48
// Basis-Addressen der verschiedenen Hardware
42
// Basis-Addressen der verschiedenen Hardware
49
static const int ADDRESS_ALL    = 0;
43
static const int ADDRESS_ALL    = 0;
50
static const int ADDRESS_FC     = 1;
44
static const int ADDRESS_FC     = 1;
51
static const int ADDRESS_NC     = 2;
45
static const int ADDRESS_NC     = 2;
52
static const int ADDRESS_MK3MAG = 3;
46
static const int ADDRESS_MK3MAG = 3;
53
 
47
 
54
static const int SETTINGS_ID = 2;
48
static const int SETTINGS_ID = 2;
55
 
49
 
56
static const int SLEEP = 500000;
50
static const int SLEEP = 500000;
-
 
51
 
-
 
52
#ifdef _EEEPC_
-
 
53
    static const int MeterSize = 125;
-
 
54
    static const int TICKER = 5000;
-
 
55
#else
-
 
56
    static const int MeterSize = 160;
-
 
57
    static const int TICKER = 2000;
-
 
58
#endif
57
 
59
 
58
static const QString QA_NAME = "QMK-Groundstation";
60
static const QString QA_NAME = "QMK-Groundstation";
59
static const QString QA_VERSION_NR = "0.8.10";
61
static const QString QA_VERSION_NR = "0.8.15";
60
 
62
 
61
#ifdef _BETA_
63
#ifdef _BETA_
62
    static const QString QA_VERSION = QA_VERSION_NR + " (BETA)";
64
    static const QString QA_VERSION = QA_VERSION_NR + " (BETA)";
63
    static const QString QA_HWVERSION = "FlightCtrl v0.75a & NaviCtrl v0.15c";
65
    static const QString QA_HWVERSION = "FlightCtrl v0.75a & NaviCtrl v0.15c";
64
#else
66
#else
65
    static const QString QA_VERSION = QA_VERSION_NR;
67
    static const QString QA_VERSION = QA_VERSION_NR;
66
    static const QString QA_HWVERSION = "FlightCtrl v0.75a & NaviCtrl v0.15c";
68
    static const QString QA_HWVERSION = "FlightCtrl v0.75a & NaviCtrl v0.15c";
67
#endif
69
#endif
68
 
70
 
69
#ifdef Q_OS_LINUX
71
#ifdef Q_OS_LINUX
70
    static const QString QA_OS = "Linux";
72
    static const QString QA_OS = "Linux";
71
#else
73
#else
72
    #ifdef Q_OS_DARWIN
74
    #ifdef Q_OS_DARWIN
73
        static const QString QA_OS = "OSX";
75
        static const QString QA_OS = "OSX";
74
    #else
76
    #else
75
        #ifdef Q_OS_WIN32
77
        #ifdef Q_OS_WIN32
76
            static const QString QA_OS = "Windows";
78
            static const QString QA_OS = "Windows";
77
        #else
79
        #else
78
            static const QString QA_OS = "n/a";
80
            static const QString QA_OS = "n/a";
79
        #endif
81
        #endif
80
    #endif
82
    #endif
81
#endif
83
#endif
82
 
84
 
83
 
85
 
84
static const QString QA_DATE = "28.05.2009";
86
static const QString QA_DATE = "09.07.2009";
85
static const QString QA_YEAR = "2008-2009";
87
static const QString QA_YEAR = "2008-2009";
86
static const QString QA_AUTHOR = "Manuel Schrape";
88
static const QString QA_AUTHOR = "Manuel Schrape";
87
static const QString QA_EMAIL  = "manuel.schrape@gmx.de";
89
static const QString QA_EMAIL  = "manuel.schrape@gmx.de";
88
 
90
 
89
static const QString QA_ABOUT =
91
static const QString QA_ABOUT =
90
    "<HTML>"
92
    "<HTML>"
91
    "<p><b><font size=8>" + QA_NAME + "</font></b></p>"
93
    "<p><b><font size=8>" + QA_NAME + "</font></b></p>"
92
    "<br />"
94
    "<br />"
93
    "Version " + QA_VERSION + " - " + QA_DATE + " on " + QA_OS + ""
95
    "Version " + QA_VERSION + " - " + QA_DATE + " on " + QA_OS + ""
94
    "<br /><br /><b>kompatibel zu " + QA_HWVERSION + "</b>"
96
    "<br /><br /><b>kompatibel zu " + QA_HWVERSION + "</b>"
95
    "<br /><br />"
97
    "<br /><br />"
96
    "(C) " + QA_YEAR + " by " + QA_AUTHOR + " - "
98
    "(C) " + QA_YEAR + " by " + QA_AUTHOR + " - "
97
    "<a href=\"mailto:" + QA_EMAIL + "\">" + QA_EMAIL + "</a> <br /><br />"
99
    "<a href=\"mailto:" + QA_EMAIL + "\">" + QA_EMAIL + "</a> <br /><br />"
98
    "Groundstation-Programm f&uuml;r den Mikrokopter zum <br>Parametrieren und Debug-Werte anzeigen, aufzeichnen & Visualisieren."
100
    "Groundstation-Programm f&uuml;r den Mikrokopter zum <br>Parametrieren und Debug-Werte anzeigen, aufzeichnen & Visualisieren."
99
    "<br /><br /> Dieses Programm wird unter den Bedingungen der GPL v2 ver&ouml;ffentlicht."
101
    "<br /><br /> Dieses Programm wird unter den Bedingungen der GPL v2 ver&ouml;ffentlicht."
100
    "</HTML>";
102
    "</HTML>";
101
 
103
 
102
static const QString Def_AnalogNames[] = {"Integral Nick", "Integral Roll", "ACC Nick", "ACC Roll", "Gyro Gier", "Hoehen-Wert", "ACC Z", "GAS", "Kompass-Value", "Spannung", "Empfang", "Ersatzkompass", "Motor Vorne", "Motor Hinten", "Motor Links", "Motor Rechts", "Analog 16", "Distance", "OSD-Bar", "MK3Mag", "Servo", "Nick", "Roll", "Analog 23", "Analog 24",  "Analog 25",  "Analog 26",  "Kalman Max",  "Analog 28",  "Kalman K", "GPS Nick", "GPS Roll"};
104
static const QString Def_AnalogNames[] = {"Integral Nick", "Integral Roll", "ACC Nick", "ACC Roll", "Gyro Gier", "Hoehen-Wert", "ACC Z", "GAS", "Kompass-Value", "Spannung", "Empfang", "Ersatzkompass", "Motor Vorne", "Motor Hinten", "Motor Links", "Motor Rechts", "Analog 16", "Distance", "OSD-Bar", "MK3Mag", "Servo", "Nick", "Roll", "Analog 23", "Analog 24",  "Analog 25",  "Analog 26",  "Kalman Max",  "Analog 28",  "Kalman K", "GPS Nick", "GPS Roll"};
103
 
105
 
104
static const QRgb Def_Colors[] = {0x00FF0000, 0x0000FF00, 0x00FFFF00, 0x000000FF, 0x00FF00FF, 0x0000FFFF, 0x00FFFFFF, 0x00660000, 0x00006600, 0x00666600, 0x00000066, 0x00660066, 0x000066, 0x00666666, 0x00990000, 0x00009900, 0x00999900, 0x00000099, 0x00990099, 0x00009999, 0x00999999, 0x00CC0000, 0x0000CC00, 0x00CCCC00, 0x000000CC, 0x00CC00CC, 0x0000CCCC, 0x00CCCCCC, 0x0066FF99, 0x009966FF, 0x00FF9966, 0x0099FF66};
106
static const QRgb Def_Colors[] = {0x00FF0000, 0x0000FF00, 0x00FFFF00, 0x000000FF, 0x00FF00FF, 0x0000FFFF, 0x00FFFFFF, 0x00660000, 0x00006600, 0x00666600, 0x00000066, 0x00660066, 0x000066, 0x00666666, 0x00990000, 0x00009900, 0x00999900, 0x00000099, 0x00990099, 0x00009999, 0x00999999, 0x00CC0000, 0x0000CC00, 0x00CCCC00, 0x000000CC, 0x00CC00CC, 0x0000CCCC, 0x00CCCCCC, 0x0066FF99, 0x009966FF, 0x00FF9966, 0x0099FF66};
105
 
107
 
106
static const bool Def_Plot_Show[] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0};
108
static const bool Def_Plot_Show[] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0};
107
static const bool Def_Log[]       = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0};
109
static const bool Def_Log[]       = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0};
108
 
110
 
109
static const QString HardwareType[] = {"Default", "FlightCtrl", "NaviCtrl", "MK3Mag"};
111
static const QString HardwareType[] = {"Default", "FlightCtrl", "NaviCtrl", "MK3Mag"};
110
 
112
 
111
static const int MaxTickerEvents = 5;
113
static const int MaxTickerEvents = 5;
112
 
114
 
113
static const int MaxAnalog    = 32;
115
static const int MaxAnalog    = 32;
114
static const int MaxPlot      = 50000;
116
static const int MaxPlot      = 50000;
115
 
117
 
116
static const int MaxNaviPos   = 2000;
118
static const int MaxNaviPos   = 2000;
117
 
119
 
118
struct sMotor
120
struct sMotor
119
{
121
{
120
    int Speed[12];
122
    int Speed[12];
121
};
123
};
122
 
124
 
123
struct sMode
125
struct sMode
124
{
126
{
125
    int ID;
127
    int ID;
126
    int VERSION_MAJOR;
128
    int VERSION_MAJOR;
127
    int VERSION_MINOR;
129
    int VERSION_MINOR;
128
    int VERSION_PATCH;
130
    int VERSION_PATCH;
129
    int VERSION_SERIAL_MAJOR;
131
    int VERSION_SERIAL_MAJOR;
130
    int VERSION_SERIAL_MINOR;
132
    int VERSION_SERIAL_MINOR;
131
    QString Hardware;
133
    QString Hardware;
132
    QString Version;
134
    QString Version;
133
};
135
};
134
 
136
 
135
struct sRxData
137
struct sRxData
136
{
138
{
137
    char *Input;
139
    char *Input;
138
    QString String;
140
    QString String;
139
    int Decode[150];
141
    int Decode[150];
140
    int DecLen;
142
    int DecLen;
141
};
143
};
142
 
144
 
143
struct sGPS_Pos
145
struct sGPS_Pos
144
{
146
{
145
    long Longitude;
147
    long Longitude;
146
    long Latitude;
148
    long Latitude;
147
    long Altitude;
149
    long Altitude;
148
};
150
};
149
 
151
 
150
struct sNaviData
152
struct sNaviData
151
{
153
{
152
    sGPS_Pos Current;
154
    sGPS_Pos Current;
153
    sGPS_Pos Target;
155
    sGPS_Pos Target;
154
    sGPS_Pos Home;
156
    sGPS_Pos Home;
155
 
157
 
156
 
158
 
157
    long Longitude;
159
    long Longitude;
158
    long Latitude;
160
    long Latitude;
159
    long Altitude;
161
    long Altitude;
160
};
162
};
161
 
163
 
162
struct sNaviString
164
struct sNaviString
163
{
165
{
164
    QString Longitude;
166
    QString Longitude;
165
    QString Latitude;
167
    QString Latitude;
166
    QString Altitude;
168
    QString Altitude;
167
};
169
};
168
 
170
 
169
struct sWayPoint
171
struct sWayPoint
170
{
172
{
171
    double Longitude;
173
    double Longitude;
172
    double Latitude;
174
    double Latitude;
173
    double Altitude;
175
    double Altitude;
174
    int Time;
176
    int Time;
175
};
177
};
176
 
178
 
177
#endif
179
#endif
178
 
180