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