Subversion Repositories Projects

Rev

Rev 396 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
158 KeyOz 1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
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  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
20
 
21
#ifndef MKTOOL_H
22
#define MKTOOL_H
23
 
24
#include <QMainWindow>
25
#include <QSettings>
26
#include <QString>
27
#include <QTimer>
28
#include <QComboBox>
29
#include <QIcon>
30
#include <QProcess>
31
 
32
#include <qwt_plot_curve.h>
33
#include <qwt_plot_grid.h>
34
#include <qwt_legend.h>
35
#include <qwt_plot.h>
227 KeyOz 36
#include <qwt_compass.h>
37
#include <qwt_compass_rose.h>
38
#include <qwt_dial_needle.h>
39
 
158 KeyOz 40
#include "ui_mktool.h"
167 KeyOz 41
#include "wdg_Settings.h"
227 KeyOz 42
#include "dlg_LCD.h"
305 KeyOz 43
#include "dlg_Map.h"
307 KeyOz 44
#include "dlg_MotorMixer.h"
158 KeyOz 45
 
250 KeyOz 46
#include "../Classes/cConnection.h"
227 KeyOz 47
#include "../Classes/cSettings.h"
306 KeyOz 48
#include "../Classes/cKML_Server.h"
227 KeyOz 49
#include "../Classes/cQMK_Server.h"
50
#include "../Classes/cAttitude.h"
51
#include "../Classes/cSpeedMeter.h"
239 Brean 52
#include "../Logger/Logger.h"
250 KeyOz 53
#include "../typedefs.h"
158 KeyOz 54
 
391 Brean 55
//quadcopter lib stuff
396 Brean 56
#include "../com/Handler.h"
57
#include "../com/Communication.h"
58
#include "../com/QTCommunication.h"
391 Brean 59
 
158 KeyOz 60
class QextSerialPort;
61
 
62
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
63
{
64
      Q_OBJECT
65
 
66
public:
67
      MKTool();
68
      ~MKTool();
69
 
70
private:
272 KeyOz 71
    // Object für Kopter-Verbindung
396 Brean 72
    //cConnection *o_Connection;
158 KeyOz 73
 
396 Brean 74
    Handler *handler;
75
 
76
    Communication *com;
77
 
199 KeyOz 78
    // Settings-Object (Programmeinstellungen)
158 KeyOz 79
    cSettings *Settings;
80
 
199 KeyOz 81
    // Settings-Widget (FC-Settings)
167 KeyOz 82
    wdg_Settings *f_Settings;
83
 
306 KeyOz 84
    // HTTP-Server-Object für KML-Files
85
    cKML_Server *KML_Server;
199 KeyOz 86
 
227 KeyOz 87
    // QMK-Serverobjekt
272 KeyOz 88
    cQMK_Server *QMK_Server;
227 KeyOz 89
 
90
    // LCD-Dialog
91
    dlg_LCD *f_LCD;
92
 
307 KeyOz 93
    // MotorMixer-Dialog
94
    dlg_MotorMixer *f_MotorMixer;
95
 
306 KeyOz 96
    // Map-Dialog
305 KeyOz 97
    dlg_Map *f_Map;
98
 
227 KeyOz 99
    //TCP-Socket
100
    QTcpSocket *TcpSocket;
101
 
158 KeyOz 102
    // Default-Ticker
103
    QTimer *Ticker;
104
 
199 KeyOz 105
    // Kopie der Tabs des Hauptfensters
227 KeyOz 106
    QWidget *TabWidgets[7];
158 KeyOz 107
 
108
    // Analogwert-Beschreibungen
109
    QLabel *lb_Analog[MaxAnalog];
110
 
111
    // Analogwerte
112
    int AnalogData[MaxAnalog];
113
 
114
    // Plots für die Analogwerte
227 KeyOz 115
    QwtPlotCurve *Plot[MaxAnalog];    
158 KeyOz 116
 
117
    // Datenspeicher für die Plots
118
    double aData[MaxAnalog][MaxPlot];
119
    double aID[MaxPlot];
120
    int NextPlot;
121
 
227 KeyOz 122
    AttitudeIndicator *Attitude;
123
    cSpeedMeter * SpeedMeter;
124
 
158 KeyOz 125
    // Ticker-Event-Array
126
    bool TickerEvent[MaxTickerEvents];
127
    bool TickerDiv;
128
 
239 Brean 129
    //Logger für CVS und andere
130
    Logger * logger;
158 KeyOz 131
 
132
    sMode Mode;
133
    sRxData RxData;
199 KeyOz 134
    sNaviData Navi;
337 KeyOz 135
    sMotor Motor;
158 KeyOz 136
 
137
    QString RXS;
138
 
167 KeyOz 139
    // Softwareupdate
162 KeyOz 140
    QProcess *Update;
158 KeyOz 141
 
199 KeyOz 142
    // FC-Settings
143
    int FCSettings[MaxParameter];
158 KeyOz 144
 
145
    // Programm Initialisieren
146
    void init_GUI();
147
    void init_Objects();
148
    void init_Connections();
149
    void init_Arrays();
150
    void init_Plot();
306 KeyOz 151
    void init_Cockpit();
158 KeyOz 152
 
153
    // Daten-Plotter
154
    void update_Plot();
155
    void config_Plot();
156
 
199 KeyOz 157
    void new_NaviData(sRxData RX);
250 KeyOz 158
    void parse_TargetKML();
199 KeyOz 159
 
158 KeyOz 160
    // Debugdaten anzeigen und speichern.
161
    void show_DebugData();
239 Brean 162
    void update_Log();
158 KeyOz 163
 
164
    // Programmeinstellungen speichern
167 KeyOz 165
    void set_Preferences();
158 KeyOz 166
 
167
private slots:
227 KeyOz 168
    void slot_QMKS_Connect();
169
    void slot_QMKS_Connected();
170
    void slot_QMKS_Disconnected(int Error);
171
 
306 KeyOz 172
    void slot_set_Settings(cSettings *t_Settings);
173
 
174
    void slot_MAP_SetTarget(sWayPoint Target);
358 KeyOz 175
    void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints);
306 KeyOz 176
 
358 KeyOz 177
 
250 KeyOz 178
    void slot_showTerminal(int Typ, QString Text);
179
 
199 KeyOz 180
    void slot_ac_Hardware();
181
    void slot_rb_Hardware();
182
 
183
    void slot_ac_StartServer();
184
 
185
    void slot_Test();
186
 
158 KeyOz 187
    void slot_ac_Config();
159 KeyOz 188
    void slot_ac_Preferences();
158 KeyOz 189
    void slot_ac_StartPlotter();
190
    void slot_ac_View();
199 KeyOz 191
    void slot_ac_FastDebug();
192
    void slot_ac_NoDebug();
193
    void slot_ac_FastNavi();
194
    void slot_ac_NoNavi();
158 KeyOz 195
    void slot_ac_About();
196
    void slot_ac_GetLabels();
197
    void slot_ac_Motortest();
227 KeyOz 198
    void slot_ac_LCD();
305 KeyOz 199
    void slot_ac_Map();
307 KeyOz 200
    void slot_ac_MotorMixer();
250 KeyOz 201
 
166 KeyOz 202
    void slot_pb_HexFile();
358 KeyOz 203
    void slot_pb_SendTarget();
158 KeyOz 204
 
205
    // Default-Ticker
206
    void slot_Ticker();
207
 
199 KeyOz 208
    // LCD-Seite vor / zurück
159 KeyOz 209
    void slot_LCD_UP();
210
    void slot_LCD_DOWN();
211
 
337 KeyOz 212
    void slot_Motortest(sMotor p_Motor);
158 KeyOz 213
 
199 KeyOz 214
    // Firmeware-Update
158 KeyOz 215
    void slot_pb_Update();
216
    void slot_UpdateShell();
217
 
218
    // Seriell-Port Slots
250 KeyOz 219
    void slot_newData(sRxData RX);
158 KeyOz 220
    void slot_OpenPort();
221
 
222
    void slot_TabChanged(int Tab);
223
 
239 Brean 224
    void slot_RecordLog();
158 KeyOz 225
 
226
    void slot_ScrollPlot(int Pos);
227
 
199 KeyOz 228
    // FC-Settings lesen / Schreiben
229
    void slot_GetFCSettings();
230
    void slot_SetFCSettings();
158 KeyOz 231
};
232
 
233
#endif