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