Subversion Repositories Projects

Rev

Details | 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
56
#include "../com/Parser.h"
57
 
158 KeyOz 58
class QextSerialPort;
59
 
60
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
61
{
62
      Q_OBJECT
63
 
64
public:
65
      MKTool();
66
      ~MKTool();
67
 
68
private:
272 KeyOz 69
    // Object für Kopter-Verbindung
306 KeyOz 70
    cConnection *o_Connection;
158 KeyOz 71
 
199 KeyOz 72
    // Settings-Object (Programmeinstellungen)
158 KeyOz 73
    cSettings *Settings;
74
 
199 KeyOz 75
    // Settings-Widget (FC-Settings)
167 KeyOz 76
    wdg_Settings *f_Settings;
77
 
306 KeyOz 78
    // HTTP-Server-Object für KML-Files
79
    cKML_Server *KML_Server;
199 KeyOz 80
 
227 KeyOz 81
    // QMK-Serverobjekt
272 KeyOz 82
    cQMK_Server *QMK_Server;
227 KeyOz 83
 
84
    // LCD-Dialog
85
    dlg_LCD *f_LCD;
86
 
307 KeyOz 87
    // MotorMixer-Dialog
88
    dlg_MotorMixer *f_MotorMixer;
89
 
306 KeyOz 90
    // Map-Dialog
305 KeyOz 91
    dlg_Map *f_Map;
92
 
227 KeyOz 93
    //TCP-Socket
94
    QTcpSocket *TcpSocket;
95
 
158 KeyOz 96
    // Default-Ticker
97
    QTimer *Ticker;
98
 
199 KeyOz 99
    // Kopie der Tabs des Hauptfensters
227 KeyOz 100
    QWidget *TabWidgets[7];
158 KeyOz 101
 
102
    // Analogwert-Beschreibungen
103
    QLabel *lb_Analog[MaxAnalog];
104
 
105
    // Analogwerte
106
    int AnalogData[MaxAnalog];
107
 
108
    // Plots für die Analogwerte
227 KeyOz 109
    QwtPlotCurve *Plot[MaxAnalog];    
158 KeyOz 110
 
111
    // Datenspeicher für die Plots
112
    double aData[MaxAnalog][MaxPlot];
113
    double aID[MaxPlot];
114
    int NextPlot;
115
 
227 KeyOz 116
    AttitudeIndicator *Attitude;
117
    cSpeedMeter * SpeedMeter;
118
 
158 KeyOz 119
    // Ticker-Event-Array
120
    bool TickerEvent[MaxTickerEvents];
121
    bool TickerDiv;
122
 
199 KeyOz 123
    // Aktuelle und Max-Anzahl der LCD-Seiten
159 KeyOz 124
    int LCD_Page;
125
    int LCD_MAX_Page;
126
 
239 Brean 127
    //Logger für CVS und andere
128
    Logger * logger;
158 KeyOz 129
 
130
    sMode Mode;
131
    sRxData RxData;
199 KeyOz 132
    sNaviData Navi;
337 KeyOz 133
    sMotor Motor;
158 KeyOz 134
 
135
    QString RXS;
136
 
167 KeyOz 137
    // Softwareupdate
162 KeyOz 138
    QProcess *Update;
158 KeyOz 139
 
199 KeyOz 140
    // Sendedatenbuffer
158 KeyOz 141
    char TX_Data[150];
142
 
199 KeyOz 143
    // FC-Settings
144
    int FCSettings[MaxParameter];
158 KeyOz 145
 
146
    // Programm Initialisieren
147
    void init_GUI();
148
    void init_Objects();
149
    void init_Connections();
150
    void init_Arrays();
151
    void init_Plot();
306 KeyOz 152
    void init_Cockpit();
158 KeyOz 153
 
154
    // Daten-Plotter
155
    void update_Plot();
156
    void config_Plot();
157
 
199 KeyOz 158
    void new_NaviData(sRxData RX);
250 KeyOz 159
    void parse_TargetKML();
199 KeyOz 160
 
158 KeyOz 161
    // Debugdaten anzeigen und speichern.
162
    void show_DebugData();
239 Brean 163
    void update_Log();
158 KeyOz 164
 
165
    // Programmeinstellungen speichern
167 KeyOz 166
    void set_Preferences();
158 KeyOz 167
 
168
private slots:
227 KeyOz 169
    void slot_QMKS_Connect();
170
    void slot_QMKS_Connected();
171
    void slot_QMKS_Disconnected(int Error);
172
 
306 KeyOz 173
    void slot_set_Settings(cSettings *t_Settings);
174
 
175
    void slot_MAP_SetTarget(sWayPoint Target);
358 KeyOz 176
    void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints);
306 KeyOz 177
 
358 KeyOz 178
 
250 KeyOz 179
    void slot_showTerminal(int Typ, QString Text);
180
 
199 KeyOz 181
    void slot_ac_Hardware();
182
    void slot_rb_Hardware();
183
 
184
    void slot_ac_StartServer();
185
 
186
    void slot_Test();
187
 
158 KeyOz 188
    void slot_ac_Config();
159 KeyOz 189
    void slot_ac_Preferences();
158 KeyOz 190
    void slot_ac_StartPlotter();
191
    void slot_ac_View();
199 KeyOz 192
    void slot_ac_FastDebug();
193
    void slot_ac_NoDebug();
194
    void slot_ac_FastNavi();
195
    void slot_ac_NoNavi();
158 KeyOz 196
    void slot_ac_About();
197
    void slot_ac_GetLabels();
198
    void slot_ac_Motortest();
227 KeyOz 199
    void slot_ac_LCD();
305 KeyOz 200
    void slot_ac_Map();
307 KeyOz 201
    void slot_ac_MotorMixer();
250 KeyOz 202
 
166 KeyOz 203
    void slot_pb_HexFile();
358 KeyOz 204
    void slot_pb_SendTarget();
158 KeyOz 205
 
206
    // Default-Ticker
207
    void slot_Ticker();
208
 
199 KeyOz 209
    // LCD-Seite vor / zurück
159 KeyOz 210
    void slot_LCD_UP();
211
    void slot_LCD_DOWN();
212
 
337 KeyOz 213
    void slot_Motortest(sMotor p_Motor);
158 KeyOz 214
 
199 KeyOz 215
    // Firmeware-Update
158 KeyOz 216
    void slot_pb_Update();
217
    void slot_UpdateShell();
218
 
219
    // Seriell-Port Slots
250 KeyOz 220
    void slot_newData(sRxData RX);
158 KeyOz 221
    void slot_OpenPort();
222
 
223
    void slot_TabChanged(int Tab);
224
 
239 Brean 225
    void slot_RecordLog();
158 KeyOz 226
 
227
    void slot_ScrollPlot(int Pos);
228
 
199 KeyOz 229
    // FC-Settings lesen / Schreiben
230
    void slot_GetFCSettings();
231
    void slot_SetFCSettings();
158 KeyOz 232
};
233
 
234
#endif