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