Subversion Repositories Projects

Rev

Rev 239 | 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"
158 KeyOz 43
 
44
#include "../SerialPort/ManageSerialPort.h"
227 KeyOz 45
#include "../Classes/cSettings.h"
199 KeyOz 46
#include "../Classes/cServer.h"
227 KeyOz 47
#include "../Classes/cQMK_Server.h"
48
#include "../Classes/cAttitude.h"
49
#include "../Classes/cSpeedMeter.h"
239 Brean 50
#include "../Logger/Logger.h"
248 Brean 51
#include "../waypoint.h"
158 KeyOz 52
 
53
class QextSerialPort;
54
 
55
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
56
{
57
      Q_OBJECT
58
 
59
public:
60
      MKTool();
61
      ~MKTool();
62
 
63
private:
227 KeyOz 64
 
65
    int aa;
66
 
159 KeyOz 67
    bool AllowSend;
199 KeyOz 68
 
158 KeyOz 69
    // Object für Serielport
70
    ManageSerialPort *serialPort;
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
 
227 KeyOz 78
    // HTTP-Server-Object für Google Earth
199 KeyOz 79
    cServer *Server;
80
 
227 KeyOz 81
    // QMK-Serverobjekt
82
    cQMK_Server *MyServer;
83
 
84
    // LCD-Dialog
85
    dlg_LCD *f_LCD;
86
 
87
    //TCP-Socket
88
    QTcpSocket *TcpSocket;
89
 
158 KeyOz 90
    // Default-Ticker
91
    QTimer *Ticker;
92
 
199 KeyOz 93
    // Kopie der Tabs des Hauptfensters
227 KeyOz 94
    QWidget *TabWidgets[7];
158 KeyOz 95
 
96
    // Analogwert-Beschreibungen
97
    QLabel *lb_Analog[MaxAnalog];
98
 
99
    // Analogwerte
100
    int AnalogData[MaxAnalog];
101
 
102
    // Plots für die Analogwerte
227 KeyOz 103
    QwtPlotCurve *Plot[MaxAnalog];    
158 KeyOz 104
 
105
    // Datenspeicher für die Plots
106
    double aData[MaxAnalog][MaxPlot];
107
    double aID[MaxPlot];
108
    int NextPlot;
109
 
227 KeyOz 110
    AttitudeIndicator *Attitude;
111
    cSpeedMeter * SpeedMeter;
112
 
158 KeyOz 113
    // Ticker-Event-Array
114
    bool TickerEvent[MaxTickerEvents];
115
    bool TickerDiv;
116
 
199 KeyOz 117
    // Aktuelle und Max-Anzahl der LCD-Seiten
159 KeyOz 118
    int LCD_Page;
119
    int LCD_MAX_Page;
120
 
239 Brean 121
    //Logger für CVS und andere
122
    Logger * logger;
158 KeyOz 123
 
124
    sMode Mode;
125
    sRxData RxData;
199 KeyOz 126
    sNaviData Navi;
158 KeyOz 127
 
128
    QString RXS;
129
    QString LastSend;
130
 
167 KeyOz 131
    // Softwareupdate
162 KeyOz 132
    QProcess *Update;
158 KeyOz 133
 
199 KeyOz 134
    // Sendedatenbuffer
158 KeyOz 135
    char TX_Data[150];
136
 
199 KeyOz 137
    // FC-Settings
138
    int FCSettings[MaxParameter];
158 KeyOz 139
 
140
    // Programm Initialisieren
141
    void init_GUI();
142
    void init_Objects();
143
    void init_Connections();
144
    void init_Arrays();
145
    void init_Plot();
146
 
147
    // Daten-Plotter
148
    void update_Plot();
149
    void config_Plot();
150
 
199 KeyOz 151
    void new_NaviData(sRxData RX);
227 KeyOz 152
//    void new_Debugdata();
199 KeyOz 153
 
158 KeyOz 154
    // Daten Senden, Empfangen und verarbeiten
159 KeyOz 155
    void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
158 KeyOz 156
    void new_RXData(sRxData RX);
157
 
158
    // Debugdaten anzeigen und speichern.
159
    void show_DebugData();
239 Brean 160
    void update_Log();
158 KeyOz 161
 
162
    // Programmeinstellungen speichern
167 KeyOz 163
    void set_Preferences();
158 KeyOz 164
 
165
private slots:
227 KeyOz 166
    void slot_QMKS_Connect();
167
    void slot_QMKS_Connected();
168
    void slot_QMKS_Disconnected(int Error);
169
 
199 KeyOz 170
    void slot_ac_Hardware();
171
    void slot_rb_Hardware();
172
 
173
    void slot_ac_StartServer();
174
 
175
    void slot_Test();
176
 
158 KeyOz 177
    void slot_ac_Config();
159 KeyOz 178
    void slot_ac_Preferences();
158 KeyOz 179
    void slot_ac_StartPlotter();
180
    void slot_ac_View();
199 KeyOz 181
    void slot_ac_FastDebug();
182
    void slot_ac_NoDebug();
183
    void slot_ac_FastNavi();
184
    void slot_ac_NoNavi();
158 KeyOz 185
    void slot_ac_About();
186
    void slot_ac_GetLabels();
187
    void slot_ac_Motortest();
227 KeyOz 188
    void slot_ac_LCD();
166 KeyOz 189
    void slot_pb_HexFile();
158 KeyOz 190
 
248 Brean 191
    //Wegpunkte senden
192
    void slot_ac_SendWaypoint();
193
 
158 KeyOz 194
    // Default-Ticker
195
    void slot_Ticker();
196
 
199 KeyOz 197
    // LCD-Seite vor / zurück
159 KeyOz 198
    void slot_LCD_UP();
199
    void slot_LCD_DOWN();
200
 
158 KeyOz 201
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
202
 
199 KeyOz 203
    // Firmeware-Update
158 KeyOz 204
    void slot_pb_Update();
205
    void slot_UpdateShell();
206
 
207
    // Seriell-Port Slots
208
    void slot_newDataReceived(const QByteArray &dataReceived);
209
    void slot_OpenPort();
210
 
211
    void slot_TabChanged(int Tab);
212
 
239 Brean 213
    void slot_RecordLog();
158 KeyOz 214
 
215
    void slot_ScrollPlot(int Pos);
216
 
199 KeyOz 217
    // FC-Settings lesen / Schreiben
218
    void slot_GetFCSettings();
219
    void slot_SetFCSettings();
158 KeyOz 220
};
221
 
222
#endif