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