Subversion Repositories Projects

Rev

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

Rev 167 Rev 199
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 "ui_mktool.h"
36
#include "ui_mktool.h"
37
#include "wdg_Settings.h"
37
#include "wdg_Settings.h"
38
 
38
 
39
#include "../SerialPort/ManageSerialPort.h"
39
#include "../SerialPort/ManageSerialPort.h"
40
#include "../cSettings.h"
40
#include "../cSettings.h"
-
 
41
#include "../Classes/cServer.h"
41
 
42
 
42
class QextSerialPort;
43
class QextSerialPort;
43
 
44
 
44
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
45
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
45
{
46
{
46
      Q_OBJECT
47
      Q_OBJECT
47
 
48
 
48
public:
49
public:
49
      MKTool();
50
      MKTool();
50
      ~MKTool();
51
      ~MKTool();
51
 
52
 
52
private:
53
private:
53
    bool AllowSend;
54
    bool AllowSend;
-
 
55
 
54
    // Object für Serielport
56
    // Object für Serielport
55
    ManageSerialPort *serialPort;
57
    ManageSerialPort *serialPort;
56
 
58
 
57
    // Settings-Object
59
    // Settings-Object (Programmeinstellungen)
58
    cSettings *Settings;
60
    cSettings *Settings;
59
 
61
 
-
 
62
    // Settings-Widget (FC-Settings)
-
 
63
    wdg_Settings *f_Settings;
-
 
64
 
60
    // Settings-Widget
65
    // HTTp-Server-Object für Google Earth
61
    wdg_Settings *f_Settings;
66
    cServer *Server;
62
 
67
 
63
    // Default-Ticker
68
    // Default-Ticker
64
    QTimer *Ticker;
69
    QTimer *Ticker;
65
 
70
 
66
    // Die Tabs des Hauptfensters
71
    // Kopie der Tabs des Hauptfensters
67
    QWidget *TabWidgets[6];
72
    QWidget *TabWidgets[6];
68
 
73
 
69
    // Analogwert-Beschreibungen
74
    // Analogwert-Beschreibungen
70
    QLabel *lb_Analog[MaxAnalog];
75
    QLabel *lb_Analog[MaxAnalog];
71
 
76
 
72
    // Analogwerte
77
    // Analogwerte
73
    int AnalogData[MaxAnalog];
78
    int AnalogData[MaxAnalog];
74
 
79
 
75
    // Plots für die Analogwerte
80
    // Plots für die Analogwerte
76
    QwtPlotCurve *Plot[MaxAnalog];
81
    QwtPlotCurve *Plot[MaxAnalog];
77
 
82
 
78
    // Datenspeicher für die Plots
83
    // Datenspeicher für die Plots
79
    double aData[MaxAnalog][MaxPlot];
84
    double aData[MaxAnalog][MaxPlot];
80
    double aID[MaxPlot];
85
    double aID[MaxPlot];
81
    int NextPlot;
86
    int NextPlot;
82
 
87
 
83
    // Ticker-Event-Array
88
    // Ticker-Event-Array
84
    bool TickerEvent[MaxTickerEvents];
89
    bool TickerEvent[MaxTickerEvents];
85
    bool TickerDiv;
90
    bool TickerDiv;
-
 
91
 
86
 
92
    // Aktuelle und Max-Anzahl der LCD-Seiten
87
    int LCD_Page;
93
    int LCD_Page;
88
    int LCD_MAX_Page;
94
    int LCD_MAX_Page;
89
 
-
 
90
    // Alle Icons
-
 
91
    QIcon Icons[30];
-
 
92
 
-
 
93
//    QByteArray allDataReceived;
-
 
94
 
95
 
95
    // Object für das Datenfile;
96
    // Object für das Datenfile;
96
    QFile  *CSVFile;
97
    QFile  *CSVFile;
97
 
98
 
98
    sMode Mode;
99
    sMode Mode;
99
    sRxData RxData;
100
    sRxData RxData;
-
 
101
    sNaviData Navi;
100
 
102
 
101
    QString RXS;
103
    QString RXS;
102
    QString LastSend;
104
    QString LastSend;
103
 
105
 
104
    // Softwareupdate
106
    // Softwareupdate
105
    QProcess *Update;
107
    QProcess *Update;
-
 
108
 
106
 
109
    // Sendedatenbuffer
-
 
110
    char TX_Data[150];
107
    char TX_Data[150];
111
 
108
 
112
    // FC-Settings
109
    int ParameterSet[11][MaxParameter];
113
    int FCSettings[MaxParameter];
110
 
114
 
111
    // Programm Initialisieren
115
    // Programm Initialisieren
112
    void init_GUI();
116
    void init_GUI();
113
    void init_Objects();
117
    void init_Objects();
114
    void init_Connections();
118
    void init_Connections();
115
    void init_Arrays();
119
    void init_Arrays();
116
    void init_Icons();
-
 
117
    void init_Plot();
120
    void init_Plot();
118
 
121
 
119
    // Daten-Plotter
122
    // Daten-Plotter
120
    void update_Plot();
123
    void update_Plot();
121
    void config_Plot();
124
    void config_Plot();
-
 
125
 
-
 
126
    void new_NaviData(sRxData RX);
122
 
127
 
123
    // Daten Senden, Empfangen und verarbeiten
128
    // Daten Senden, Empfangen und verarbeiten
124
    void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
129
    void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
125
    void new_RXData(sRxData RX);
130
    void new_RXData(sRxData RX);
126
 
131
 
127
    // Debugdaten anzeigen und speichern.
132
    // Debugdaten anzeigen und speichern.
128
    void show_DebugData();
133
    void show_DebugData();
129
    void write_CSV();
134
    void write_CSV();
130
 
135
 
131
    // Programmeinstellungen speichern
136
    // Programmeinstellungen speichern
132
    void set_Preferences();
137
    void set_Preferences();
133
 
138
 
134
private slots:
139
private slots:
-
 
140
    void slot_ac_Hardware();
-
 
141
    void slot_rb_Hardware();
-
 
142
 
-
 
143
    void slot_ac_StartServer();
-
 
144
 
-
 
145
    void slot_Test();
-
 
146
 
135
    void slot_ac_Config();
147
    void slot_ac_Config();
136
    void slot_ac_Preferences();
148
    void slot_ac_Preferences();
137
    void slot_ac_StartPlotter();
149
    void slot_ac_StartPlotter();
138
    void slot_ac_View();
150
    void slot_ac_View();
139
    void slot_ac_MehrDaten();
151
    void slot_ac_FastDebug();
-
 
152
    void slot_ac_NoDebug();
140
    void slot_ac_KeineDaten();
153
    void slot_ac_FastNavi();
-
 
154
    void slot_ac_NoNavi();
141
    void slot_ac_About();
155
    void slot_ac_About();
142
    void slot_ac_GetLabels();
156
    void slot_ac_GetLabels();
143
    void slot_ac_Motortest();
157
    void slot_ac_Motortest();
144
    void slot_pb_HexFile();
158
    void slot_pb_HexFile();
145
 
159
 
146
    // Default-Ticker
160
    // Default-Ticker
147
    void slot_Ticker();
161
    void slot_Ticker();
-
 
162
 
148
 
163
    // LCD-Seite vor / zurück
149
    void slot_LCD_UP();
164
    void slot_LCD_UP();
150
    void slot_LCD_DOWN();
165
    void slot_LCD_DOWN();
151
 
166
 
152
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
167
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
-
 
168
 
153
 
169
    // Firmeware-Update
154
    void slot_pb_Update();
-
 
155
 
170
    void slot_pb_Update();
156
    void slot_UpdateShell();
171
    void slot_UpdateShell();
157
 
172
 
158
    // Seriell-Port Slots
173
    // Seriell-Port Slots
159
    void slot_newDataReceived(const QByteArray &dataReceived);
174
    void slot_newDataReceived(const QByteArray &dataReceived);
160
    void slot_OpenPort();
175
    void slot_OpenPort();
161
 
176
 
162
    void slot_TabChanged(int Tab);
177
    void slot_TabChanged(int Tab);
163
 
178
 
164
    void slot_RecordCSV();
179
    void slot_RecordCSV();
165
 
180
 
166
    void slot_ScrollPlot(int Pos);
181
    void slot_ScrollPlot(int Pos);
-
 
182
 
167
 
183
    // FC-Settings lesen / Schreiben
168
    void slot_GetParameter();
184
    void slot_GetFCSettings();
169
    void slot_SetParameter();
185
    void slot_SetFCSettings();
170
};
186
};
171
 
187
 
172
#endif
188
#endif
173
 
189