Rev 442 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 442 | Rev 449 | ||
---|---|---|---|
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/cSettings.h" |
46 | #include "../Classes/cSettings.h" |
47 | #include "../Classes/cKML_Server.h" |
47 | #include "../Classes/cKML_Server.h" |
48 | #include "../Classes/cQMK_Server.h" |
48 | #include "../Classes/cQMK_Server.h" |
49 | #include "../Classes/cAttitude.h" |
49 | #include "../Classes/cAttitude.h" |
50 | #include "../Classes/cSpeedMeter.h" |
50 | #include "../Classes/cSpeedMeter.h" |
51 | #include "../Logger/Logger.h" |
51 | #include "../Logger/Logger.h" |
52 | #include "../typedefs.h" |
52 | #include "../typedefs.h" |
53 | 53 | ||
54 | //quadcopter lib stuff |
54 | //quadcopter lib stuff |
55 | #include "../libMK/Handler.h" |
55 | #include "../libMK/Handler.h" |
56 | #include "../libMK/Communication.h" |
56 | #include "../libMK/Communication.h" |
57 | #include "../libMK/QTCommunication.h" |
57 | #include "../libMK/QTSerialCommunication.h" |
58 | 58 | ||
59 | class QextSerialPort; |
59 | class QextSerialPort; |
60 | 60 | ||
61 | class MKTool : public QMainWindow, public Ui::dlg_mktool_UI |
61 | class MKTool : public QMainWindow, public Ui::dlg_mktool_UI |
62 | { |
62 | { |
63 | Q_OBJECT |
63 | Q_OBJECT |
64 | 64 | ||
65 | public: |
65 | public: |
66 | MKTool(); |
66 | MKTool(); |
67 | ~MKTool(); |
67 | ~MKTool(); |
68 | 68 | ||
69 | private: |
69 | private: |
70 | // data-exchange from the MK |
70 | // data-exchange from the MK |
71 | KopterData * data; |
71 | KopterData * data; |
72 | 72 | ||
73 | // data-handler to send commands to MK |
73 | // data-handler to send commands to MK |
74 | Handler *handler; |
74 | Handler *handler; |
75 | 75 | ||
76 | // connect to MK/disconnect from MK |
76 | // connect to MK/disconnect from MK |
77 | Communication *com; |
77 | Communication *com; |
78 | 78 | ||
79 | // settings object (program configuration) |
79 | // settings object (program configuration) |
80 | cSettings *Settings; |
80 | cSettings *Settings; |
81 | 81 | ||
82 | // settings widget (FC settings) |
82 | // settings widget (FC settings) |
83 | wdg_Settings *f_Settings; |
83 | wdg_Settings *f_Settings; |
84 | 84 | ||
85 | // HTTP server object for KML files |
85 | // HTTP server object for KML files |
86 | cKML_Server *KML_Server; |
86 | cKML_Server *KML_Server; |
87 | 87 | ||
88 | // QMK-serverobjekt |
88 | // QMK-serverobjekt |
89 | cQMK_Server *QMK_Server; |
89 | cQMK_Server *QMK_Server; |
90 | 90 | ||
91 | // LCD dialog |
91 | // LCD dialog |
92 | dlg_LCD *f_LCD; |
92 | dlg_LCD *f_LCD; |
93 | 93 | ||
94 | // MotorMixer dialog |
94 | // MotorMixer dialog |
95 | dlg_MotorMixer *f_MotorMixer; |
95 | dlg_MotorMixer *f_MotorMixer; |
96 | 96 | ||
97 | // Map dialog |
97 | // Map dialog |
98 | dlg_Map *f_Map; |
98 | dlg_Map *f_Map; |
99 | 99 | ||
100 | //TCP socket - needed by QMK server |
100 | //TCP socket - needed by QMK server |
101 | QTcpSocket *TcpSocket; |
101 | QTcpSocket *TcpSocket; |
102 | 102 | ||
103 | //FIXME: replace ticker with something else |
103 | //FIXME: replace ticker with something else |
104 | // Default-Ticker |
104 | // Default-Ticker |
105 | //QTimer *Ticker; |
105 | //QTimer *Ticker; |
106 | 106 | ||
107 | // copy of the tabs from the main widget |
107 | // copy of the tabs from the main widget |
108 | QWidget *TabWidgets[7]; |
108 | QWidget *TabWidgets[7]; |
109 | 109 | ||
110 | // analog names (label) |
110 | // analog names (label) |
111 | QLabel *lb_Analog[MaxAnalog]; |
111 | QLabel *lb_Analog[MaxAnalog]; |
112 | 112 | ||
113 | // analog values (line edit) |
113 | // analog values (line edit) |
114 | QLineEdit *le_Analog[MaxAnalog]; |
114 | QLineEdit *le_Analog[MaxAnalog]; |
115 | 115 | ||
116 | // Plots für die Analogwerte |
116 | // Plots für die Analogwerte |
117 | QwtPlotCurve *Plot[MaxAnalog]; |
117 | QwtPlotCurve *Plot[MaxAnalog]; |
118 | 118 | ||
119 | // Datenspeicher für die Plots |
119 | // Datenspeicher für die Plots |
120 | double aData[MaxAnalog][MaxPlot]; |
120 | double aData[MaxAnalog][MaxPlot]; |
121 | double aID[MaxPlot]; |
121 | double aID[MaxPlot]; |
122 | int NextPlot; |
122 | int NextPlot; |
123 | 123 | ||
124 | AttitudeIndicator *Attitude; |
124 | AttitudeIndicator *Attitude; |
125 | cSpeedMeter * SpeedMeter; |
125 | cSpeedMeter * SpeedMeter; |
126 | 126 | ||
127 | // Ticker-Event-Array |
127 | // Ticker-Event-Array |
128 | //FIXME: move ticker to QTCommunication |
128 | //FIXME: move ticker to QTCommunication |
129 | //bool TickerEvent[MaxTickerEvents]; |
129 | //bool TickerEvent[MaxTickerEvents]; |
130 | //bool TickerDiv; |
130 | //bool TickerDiv; |
131 | 131 | ||
132 | // logger for CVS, MySQL and others |
132 | // logger for CVS, MySQL and others |
133 | Logger * logger; |
133 | Logger * logger; |
134 | 134 | ||
135 | // software update |
135 | // software update |
136 | QProcess *Update; |
136 | QProcess *Update; |
137 | 137 | ||
138 | // FC-Settings |
138 | // FC-Settings |
139 | int FCSettings[MaxParameter]; |
139 | int FCSettings[MaxParameter]; |
140 | 140 | ||
141 | // initialize program |
141 | // initialize program |
142 | void init_GUI(); |
142 | void init_GUI(); |
143 | void init_Objects(); |
143 | void init_Objects(); |
144 | void init_Connections(); |
144 | void init_Connections(); |
145 | void init_Arrays(); |
145 | void init_Arrays(); |
146 | void init_Plot(); |
146 | void init_Plot(); |
147 | void init_Cockpit(); |
147 | void init_Cockpit(); |
148 | 148 | ||
149 | // plot data |
149 | // plot data |
150 | void update_Plot(); |
150 | void update_Plot(); |
151 | void config_Plot(); |
151 | void config_Plot(); |
152 | 152 | ||
153 | void new_NaviData(sRxData RX); |
153 | // void new_NaviData(sRxData RX); |
154 | void parse_TargetKML(); |
154 | void parse_TargetKML(); |
155 | 155 | ||
156 | // show and save debug/log |
156 | // show and save debug/log |
157 | void show_DebugData(); |
157 | void show_DebugData(); |
158 | void update_Log(); |
158 | void update_Log(); |
159 | 159 | ||
160 | // save program settings |
160 | // save program settings |
161 | void set_Preferences(); |
161 | void set_Preferences(); |
162 | 162 | ||
163 | private slots: |
163 | private slots: |
164 | void slot_QMKS_Connect(); |
164 | void slot_QMKS_Connect(); |
165 | void slot_QMKS_Connected(); |
165 | void slot_QMKS_Connected(); |
166 | void slot_QMKS_Disconnected(int Error); |
166 | void slot_QMKS_Disconnected(int Error); |
167 | 167 | ||
168 | void slot_set_Settings(cSettings *t_Settings); |
168 | void slot_set_Settings(cSettings *t_Settings); |
169 | 169 | ||
170 | void slot_MAP_SetTarget(sWayPoint Target); |
170 | void slot_MAP_SetTarget(sWayPoint Target); |
171 | void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints); |
171 | void slot_MAP_SetWayPoints(QList<sWayPoint> l_WayPoints); |
172 | 172 | ||
173 | 173 | ||
174 | void slot_showTerminal(int Typ, QString Text); |
174 | void slot_showTerminal(int Typ, QString Text); |
175 | 175 | ||
176 | void slot_ac_Hardware(); |
176 | void slot_ac_Hardware(); |
177 | void slot_rb_Hardware(); |
177 | void slot_rb_Hardware(); |
178 | 178 | ||
179 | void slot_ac_StartServer(); |
179 | void slot_ac_StartServer(); |
180 | 180 | ||
181 | void slot_Test(); |
181 | void slot_Test(); |
182 | 182 | ||
183 | void slot_ac_Config(); |
183 | void slot_ac_Config(); |
184 | void slot_ac_Preferences(); |
184 | void slot_ac_Preferences(); |
185 | void slot_ac_StartPlotter(); |
185 | void slot_ac_StartPlotter(); |
186 | void slot_ac_View(); |
186 | void slot_ac_View(); |
187 | void slot_ac_FastDebug(); |
187 | void slot_ac_FastDebug(); |
188 | void slot_ac_NoDebug(); |
188 | void slot_ac_NoDebug(); |
189 | void slot_ac_FastNavi(); |
189 | void slot_ac_FastNavi(); |
190 | void slot_ac_NoNavi(); |
190 | void slot_ac_NoNavi(); |
191 | void slot_ac_About(); |
191 | void slot_ac_About(); |
192 | void slot_ac_GetLabels(); |
192 | void slot_ac_GetLabels(); |
193 | void slot_ac_Motortest(); |
193 | void slot_ac_Motortest(); |
194 | void slot_ac_LCD(); |
194 | void slot_ac_LCD(); |
195 | void slot_ac_Map(); |
195 | void slot_ac_Map(); |
196 | void slot_ac_MotorMixer(); |
196 | void slot_ac_MotorMixer(); |
197 | 197 | ||
198 | void slot_pb_HexFile(); |
198 | void slot_pb_HexFile(); |
199 | void slot_pb_SendTarget(); |
199 | void slot_pb_SendTarget(); |
200 | 200 | ||
201 | // Default-Ticker |
201 | // Default-Ticker |
202 | //FIXME: put this in libMK/QTCommunication.cpp |
202 | //FIXME: put this in libMK/QTCommunication.cpp |
203 | //void slot_Ticker(); |
203 | //void slot_Ticker(); |
204 | 204 | ||
205 | // LCD page up / down |
205 | // LCD page up / down |
206 | void slot_LCD_UP(); |
206 | void slot_LCD_UP(); |
207 | void slot_LCD_DOWN(); |
207 | void slot_LCD_DOWN(); |
208 | 208 | ||
209 | void slot_Motortest(sMotorData p_Motor); |
209 | void slot_Motortest(sMotorData p_Motor); |
210 | 210 | ||
211 | // Firmeware-Update |
211 | // Firmeware-Update |
212 | void slot_pb_Update(); |
212 | void slot_pb_Update(); |
213 | void slot_UpdateShell(); |
213 | void slot_UpdateShell(); |
214 | 214 | ||
215 | // Seriell-Port Slots |
215 | // Seriell-Port Slots |
216 | void slot_newData(sRxData RX); |
216 | // void slot_newData(sRxData RX); |
217 | void slot_OpenPort(); |
217 | void slot_OpenPort(); |
218 | 218 | ||
219 | void slot_TabChanged(int Tab); |
219 | void slot_TabChanged(int Tab); |
220 | 220 | ||
221 | void slot_RecordLog(); |
221 | void slot_RecordLog(); |
222 | 222 | ||
223 | void slot_ScrollPlot(int Pos); |
223 | void slot_ScrollPlot(int Pos); |
224 | 224 | ||
225 | // FC-Settings lesen / Schreiben |
225 | // FC-Settings lesen / Schreiben |
226 | void slot_GetFCSettings(); |
226 | void slot_GetFCSettings(); |
227 | void slot_SetFCSettings(); |
227 | void slot_SetFCSettings(); |
228 | }; |
228 | }; |
229 | 229 | ||
230 | #endif |
230 | #endif |
231 | 231 |