Subversion Repositories Projects

Rev

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

Rev 440 Rev 441
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
 
19
 
20
 
20
 
21
#ifndef MKTOOL_H
21
#ifndef MKTOOL_H
22
#define MKTOOL_H
22
#define MKTOOL_H
23
 
23
 
24
#include <QMainWindow>
24
#include <QMainWindow>
25
#include <QSettings>
25
#include <QSettings>
26
#include <QString>
26
#include <QString>
27
#include <QTimer>
27
#include <QTimer>
28
#include <QComboBox>
28
#include <QComboBox>
29
#include <QIcon>
29
#include <QIcon>
30
#include <QProcess>
30
#include <QProcess>
31
 
31
 
32
#include <qwt_plot_curve.h>
32
#include <qwt_plot_curve.h>
33
#include <qwt_plot_grid.h>
33
#include <qwt_plot_grid.h>
34
#include <qwt_legend.h>
34
#include <qwt_legend.h>
35
#include <qwt_plot.h>
35
#include <qwt_plot.h>
36
#include <qwt_compass.h>
36
#include <qwt_compass.h>
37
#include <qwt_compass_rose.h>
37
#include <qwt_compass_rose.h>
38
#include <qwt_dial_needle.h>
38
#include <qwt_dial_needle.h>
39
 
39
 
40
#include "ui_mktool.h"
40
#include "ui_mktool.h"
41
#include "wdg_Settings.h"
41
#include "wdg_Settings.h"
42
#include "dlg_LCD.h"
42
#include "dlg_LCD.h"
43
#include "dlg_Map.h"
43
#include "dlg_Map.h"
44
#include "dlg_MotorMixer.h"
44
#include "dlg_MotorMixer.h"
45
 
45
 
46
#include "../Classes/cConnection.h"
46
#include "../Classes/cConnection.h"
47
#include "../Classes/cSettings.h"
47
#include "../Classes/cSettings.h"
48
#include "../Classes/cKML_Server.h"
48
#include "../Classes/cKML_Server.h"
49
#include "../Classes/cQMK_Server.h"
49
#include "../Classes/cQMK_Server.h"
50
#include "../Classes/cAttitude.h"
50
#include "../Classes/cAttitude.h"
51
#include "../Classes/cSpeedMeter.h"
51
#include "../Classes/cSpeedMeter.h"
52
#include "../Logger/Logger.h"
52
#include "../Logger/Logger.h"
53
#include "../typedefs.h"
53
#include "../typedefs.h"
54
 
54
 
55
//quadcopter lib stuff
55
//quadcopter lib stuff
56
#include "../libMK/Handler.h"
56
#include "../libMK/Handler.h"
57
#include "../libMK/Communication.h"
57
#include "../libMK/Communication.h"
58
#include "../libMK/QTCommunication.h"
58
#include "../libMK/QTCommunication.h"
59
 
59
 
60
class QextSerialPort;
60
class QextSerialPort;
61
 
61
 
62
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
62
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
63
{
63
{
64
      Q_OBJECT
64
      Q_OBJECT
65
 
65
 
66
public:
66
public:
67
      MKTool();
67
      MKTool();
68
      ~MKTool();
68
      ~MKTool();
69
 
69
 
70
private:
70
private:
71
    // Object für Kopter-Verbindung
71
    // Object für Kopter-Verbindung
72
    //cConnection *o_Connection;
72
    //cConnection *o_Connection;
73
    KopterData * data;
73
    KopterData * data;
74
 
74
 
75
    Handler *handler;
75
    Handler *handler;
76
 
76
 
77
    Communication *com;
77
    Communication *com;
78
 
78
 
79
    // Settings-Object (Programmeinstellungen)
79
    // Settings-Object (Programmeinstellungen)
80
    cSettings *Settings;
80
    cSettings *Settings;
81
 
81
 
82
    // Settings-Widget (FC-Settings)
82
    // Settings-Widget (FC-Settings)
83
    wdg_Settings *f_Settings;
83
    wdg_Settings *f_Settings;
84
 
84
 
85
    // HTTP-Server-Object für KML-Files
85
    // HTTP-Server-Object für KML-Files
86
    cKML_Server *KML_Server;
86
    cKML_Server *KML_Server;
87
 
87
 
88
    // QMK-Serverobjekt
88
    // QMK-Serverobjekt
89
    cQMK_Server *QMK_Server;
89
    cQMK_Server *QMK_Server;
90
 
90
 
91
    // LCD-Dialog
91
    // LCD-Dialog
92
    dlg_LCD *f_LCD;
92
    dlg_LCD *f_LCD;
93
 
93
 
94
    // MotorMixer-Dialog
94
    // MotorMixer-Dialog
95
    dlg_MotorMixer *f_MotorMixer;
95
    dlg_MotorMixer *f_MotorMixer;
96
 
96
 
97
    // Map-Dialog
97
    // Map-Dialog
98
    dlg_Map *f_Map;
98
    dlg_Map *f_Map;
99
 
99
 
100
    //TCP-Socket
100
    //TCP-Socket
101
    QTcpSocket *TcpSocket;
101
    QTcpSocket *TcpSocket;
-
 
102
 
102
 
103
    //FIXME: replace ticker with something else
103
    // Default-Ticker
104
    // Default-Ticker
104
    QTimer *Ticker;
105
    //QTimer *Ticker;
105
 
106
 
106
    // Kopie der Tabs des Hauptfensters
107
    // copy of the tabs from the main widget
107
    QWidget *TabWidgets[7];
108
    QWidget *TabWidgets[7];
-
 
109
 
-
 
110
    // analog names (label)
-
 
111
    QLabel *lb_Analog[MaxAnalog];
108
 
112
 
109
    // Analogwert-Beschreibungen
113
    // analog values (line edit)
110
    QLabel *lb_Analog[MaxAnalog];
114
    QLineEdit *le_Analog[MaxAnalog];
111
 
115
 
112
    // Plots für die Analogwerte
116
    // Plots für die Analogwerte
113
    QwtPlotCurve *Plot[MaxAnalog];    
117
    QwtPlotCurve *Plot[MaxAnalog];
114
 
118
 
115
    // Datenspeicher für die Plots
119
    // Datenspeicher für die Plots
116
    double aData[MaxAnalog][MaxPlot];
120
    double aData[MaxAnalog][MaxPlot];
117
    double aID[MaxPlot];
121
    double aID[MaxPlot];
118
    int NextPlot;
122
    int NextPlot;
119
 
123
 
120
    AttitudeIndicator *Attitude;
124
    AttitudeIndicator *Attitude;
121
    cSpeedMeter * SpeedMeter;
125
    cSpeedMeter * SpeedMeter;
122
 
126
 
123
    // Ticker-Event-Array
127
    // Ticker-Event-Array
-
 
128
    //FIXME: move ticker to QTCommunication
124
    bool TickerEvent[MaxTickerEvents];
129
    //bool TickerEvent[MaxTickerEvents];
125
    bool TickerDiv;
130
    //bool TickerDiv;
126
 
131
 
127
    //Logger für CVS und andere
132
    //Logger für CVS und andere
128
    Logger * logger;
133
    Logger * logger;
129
 
134
 
130
    // Softwareupdate
135
    // Softwareupdate
131
    QProcess *Update;
136
    QProcess *Update;
132
 
137
 
133
    // FC-Settings
138
    // FC-Settings
134
    int FCSettings[MaxParameter];
139
    int FCSettings[MaxParameter];
135
 
140
 
136
    // Programm Initialisieren
141
    // Programm Initialisieren
137
    void init_GUI();
142
    void init_GUI();
138
    void init_Objects();
143
    void init_Objects();
139
    void init_Connections();
144
    void init_Connections();
140
    void init_Arrays();
145
    void init_Arrays();
141
    void init_Plot();
146
    void init_Plot();
142
    void init_Cockpit();
147
    void init_Cockpit();
143
 
148
 
144
    // Daten-Plotter
149
    // Daten-Plotter
145
    void update_Plot();
150
    void update_Plot();
146
    void config_Plot();
151
    void config_Plot();
147
 
152
 
148
    void new_NaviData(sRxData RX);
153
    void new_NaviData(sRxData RX);
149
    void parse_TargetKML();
154
    void parse_TargetKML();
150
 
155
 
151
    // Debugdaten anzeigen und speichern.
156
    // Debugdaten anzeigen und speichern.
152
    void show_DebugData();
157
    void show_DebugData();
153
    void update_Log();
158
    void update_Log();
154
 
159
 
155
    // Programmeinstellungen speichern
160
    // Programmeinstellungen speichern
156
    void set_Preferences();
161
    void set_Preferences();
157
 
162
 
158
private slots:
163
private slots:
159
    void slot_QMKS_Connect();
164
    void slot_QMKS_Connect();
160
    void slot_QMKS_Connected();
165
    void slot_QMKS_Connected();
161
    void slot_QMKS_Disconnected(int Error);
166
    void slot_QMKS_Disconnected(int Error);
162
 
167
 
163
    void slot_set_Settings(cSettings *t_Settings);
168
    void slot_set_Settings(cSettings *t_Settings);
164
 
169
 
165
    void slot_MAP_SetTarget(sWayPoint Target);
170
    void slot_MAP_SetTarget(sWayPoint Target);
166
    void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints);
171
    void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints);
167
 
172
 
168
 
173
 
169
    void slot_showTerminal(int Typ, QString Text);
174
    void slot_showTerminal(int Typ, QString Text);
170
 
175
 
171
    void slot_ac_Hardware();
176
    void slot_ac_Hardware();
172
    void slot_rb_Hardware();
177
    void slot_rb_Hardware();
173
 
178
 
174
    void slot_ac_StartServer();
179
    void slot_ac_StartServer();
175
 
180
 
176
    void slot_Test();
181
    void slot_Test();
177
 
182
 
178
    void slot_ac_Config();
183
    void slot_ac_Config();
179
    void slot_ac_Preferences();
184
    void slot_ac_Preferences();
180
    void slot_ac_StartPlotter();
185
    void slot_ac_StartPlotter();
181
    void slot_ac_View();
186
    void slot_ac_View();
182
    void slot_ac_FastDebug();
187
    void slot_ac_FastDebug();
183
    void slot_ac_NoDebug();
188
    void slot_ac_NoDebug();
184
    void slot_ac_FastNavi();
189
    void slot_ac_FastNavi();
185
    void slot_ac_NoNavi();
190
    void slot_ac_NoNavi();
186
    void slot_ac_About();
191
    void slot_ac_About();
187
    void slot_ac_GetLabels();
192
    void slot_ac_GetLabels();
188
    void slot_ac_Motortest();
193
    void slot_ac_Motortest();
189
    void slot_ac_LCD();
194
    void slot_ac_LCD();
190
    void slot_ac_Map();
195
    void slot_ac_Map();
191
    void slot_ac_MotorMixer();
196
    void slot_ac_MotorMixer();
192
 
197
 
193
    void slot_pb_HexFile();
198
    void slot_pb_HexFile();
194
    void slot_pb_SendTarget();
199
    void slot_pb_SendTarget();
195
 
200
 
196
    // Default-Ticker
201
    // Default-Ticker
197
    void slot_Ticker();
202
    void slot_Ticker();
198
 
203
 
199
    // LCD-Seite vor / zurück
204
    // LCD-Seite vor / zurück
200
    void slot_LCD_UP();
205
    void slot_LCD_UP();
201
    void slot_LCD_DOWN();
206
    void slot_LCD_DOWN();
202
 
207
 
203
    void slot_Motortest(sMotor p_Motor);
208
    void slot_Motortest(sMotor p_Motor);
204
 
209
 
205
    // Firmeware-Update
210
    // Firmeware-Update
206
    void slot_pb_Update();
211
    void slot_pb_Update();
207
    void slot_UpdateShell();
212
    void slot_UpdateShell();
208
 
213
 
209
    // Seriell-Port Slots
214
    // Seriell-Port Slots
210
    void slot_newData(sRxData RX);
215
    void slot_newData(sRxData RX);
211
    void slot_OpenPort();
216
    void slot_OpenPort();
212
 
217
 
213
    void slot_TabChanged(int Tab);
218
    void slot_TabChanged(int Tab);
214
 
219
 
215
    void slot_RecordLog();
220
    void slot_RecordLog();
216
 
221
 
217
    void slot_ScrollPlot(int Pos);
222
    void slot_ScrollPlot(int Pos);
218
 
223
 
219
    // FC-Settings lesen / Schreiben
224
    // FC-Settings lesen / Schreiben
220
    void slot_GetFCSettings();
225
    void slot_GetFCSettings();
221
    void slot_SetFCSettings();
226
    void slot_SetFCSettings();
222
};
227
};
223
 
228
 
224
#endif
229
#endif
225
 
230