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