Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
158 | KeyOz | 1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Manuel Schrape * |
||
3 | * manuel.schrape@gmx.de * |
||
4 | * * |
||
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 * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | ***************************************************************************/ |
||
19 | |||
250 | KeyOz | 20 | // TODO: Wiederholungssenden wieder einbauen |
21 | |||
158 | KeyOz | 22 | #include <QtGui> |
23 | |||
24 | #include <QLineEdit> |
||
25 | #include <QString> |
||
26 | #include <QTimer> |
||
27 | #include <QIcon> |
||
28 | #include <QToolButton> |
||
29 | #include <QSpinBox> |
||
199 | KeyOz | 30 | #include <QAction> |
227 | KeyOz | 31 | #include <QPalette> |
158 | KeyOz | 32 | |
33 | #include "mktool.h" |
||
34 | #include "dlg_Config.h" |
||
35 | #include "dlg_Motortest.h" |
||
159 | KeyOz | 36 | #include "dlg_Preferences.h" |
158 | KeyOz | 37 | #include "../global.h" |
227 | KeyOz | 38 | #include "../Classes/ToolBox.h" |
158 | KeyOz | 39 | |
40 | #include <stdlib.h> |
||
41 | |||
42 | MKTool::MKTool() |
||
43 | { |
||
44 | setupUi(this); |
||
45 | |||
46 | Settings = new cSettings; |
||
47 | |||
48 | init_Arrays(); |
||
49 | init_GUI(); |
||
306 | KeyOz | 50 | init_Cockpit(); |
158 | KeyOz | 51 | |
52 | init_Objects(); |
||
53 | init_Connections(); |
||
54 | |||
55 | init_Plot(); |
||
56 | } |
||
57 | |||
58 | void MKTool::init_GUI() |
||
59 | { |
||
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
||
61 | |||
167 | KeyOz | 62 | // Tab mit Debug-Elementen verbergen |
314 | KeyOz | 63 | tab_Main->removeTab(6); |
272 | KeyOz | 64 | // Develop - Nicht gebrauchte sachen abschalten. |
65 | pb_SettingsReset->hide(); |
||
66 | pb_Flash->hide(); |
||
67 | rb_NC->hide(); |
||
167 | KeyOz | 68 | |
279 | KeyOz | 69 | // Beta-Sachen einschalten. |
70 | #ifdef _BETA_ |
||
71 | ac_QMKServer->setEnabled(true); |
||
307 | KeyOz | 72 | #else |
73 | ac_MotorMixer->setVisible(false); |
||
279 | KeyOz | 74 | #endif |
167 | KeyOz | 75 | // Settings-Tab hinzufügen. |
76 | f_Settings = new wdg_Settings( this ); |
||
227 | KeyOz | 77 | f_Settings->set_Config(Settings); |
78 | tab_Main->insertTab ( 2, f_Settings, ac_View2->icon(), "FC-Settings"); |
||
167 | KeyOz | 79 | tab_Main->widget(2)->setObjectName("Tab_2"); |
80 | |||
81 | // Zusätzliche Widgets in die Toolbar. |
||
227 | KeyOz | 82 | tb_TTY->addWidget(lb_Port); |
83 | tb_TTY->addWidget(le_Port); |
||
166 | KeyOz | 84 | |
227 | KeyOz | 85 | tb_Hardware->addWidget(rb_SelFC); |
86 | tb_Hardware->addWidget(rb_SelNC); |
||
87 | tb_Hardware->addWidget(rb_SelMag); |
||
166 | KeyOz | 88 | |
227 | KeyOz | 89 | tb_Allgemein->setVisible(Settings->GUI.ToolViews[0]); |
90 | tb_Werkzeuge->setVisible(Settings->GUI.ToolViews[1]); |
||
91 | tb_Debug->setVisible(Settings->GUI.ToolViews[2]); |
||
92 | tb_TTY->setVisible(Settings->GUI.ToolViews[3]); |
||
93 | tb_Hardware->setVisible(Settings->GUI.ToolViews[4]); |
||
94 | |||
272 | KeyOz | 95 | #ifdef _EEEPC_ |
96 | lb_Status->hide(); |
||
97 | #endif |
||
98 | |||
199 | KeyOz | 99 | lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!")); |
100 | |||
158 | KeyOz | 101 | resize(Settings->GUI.Size); |
102 | move(Settings->GUI.Point); |
||
103 | |||
104 | if (Settings->GUI.isMax) |
||
105 | { |
||
106 | showMaximized(); |
||
107 | } |
||
108 | |||
199 | KeyOz | 109 | // Analoglabels anzeigen |
158 | KeyOz | 110 | for (int a = 0; a < MaxAnalog; a++) |
111 | { |
||
162 | KeyOz | 112 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
158 | KeyOz | 113 | } |
114 | |||
199 | KeyOz | 115 | // Kopie der Tabs anlegen |
272 | KeyOz | 116 | for (int b = 0; b < 7; b++) |
158 | KeyOz | 117 | { |
118 | TabWidgets[b] = tab_Main->widget(b); |
||
119 | } |
||
120 | |||
199 | KeyOz | 121 | // Ausgeblendete Tabs ausblenden |
272 | KeyOz | 122 | for (int c = 0; c < 7; c++) |
158 | KeyOz | 123 | { |
124 | if (Settings->GUI.TabViews[c] == false) |
||
125 | { |
||
126 | QString TabName = QString("Tab_%1").arg(c); |
||
127 | |||
128 | for (int d = 0; d < tab_Main->count(); d++) |
||
129 | { |
||
130 | if (tab_Main->widget(d)->objectName() == TabName) |
||
131 | { |
||
132 | tab_Main->removeTab(d); |
||
133 | } |
||
134 | } |
||
135 | } |
||
136 | } |
||
137 | |||
138 | ac_View0->setChecked(Settings->GUI.TabViews[0]); |
||
139 | ac_View1->setChecked(Settings->GUI.TabViews[1]); |
||
140 | ac_View2->setChecked(Settings->GUI.TabViews[2]); |
||
141 | ac_View3->setChecked(Settings->GUI.TabViews[3]); |
||
142 | ac_View4->setChecked(Settings->GUI.TabViews[4]); |
||
143 | ac_View5->setChecked(Settings->GUI.TabViews[5]); |
||
272 | KeyOz | 144 | ac_View6->setChecked(Settings->GUI.TabViews[6]); |
158 | KeyOz | 145 | |
146 | le_Port->setText(Settings->TTY.Port); |
||
162 | KeyOz | 147 | |
148 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
||
149 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
||
150 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
||
158 | KeyOz | 151 | } |
152 | |||
306 | KeyOz | 153 | void MKTool::init_Cockpit() |
154 | { |
||
155 | // Cockpit-Elemente |
||
156 | QPalette newPalette; |
||
157 | |||
158 | newPalette.setColor(QPalette::Base, Qt::darkBlue); |
||
159 | newPalette.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
||
160 | newPalette.setColor(QPalette::Text, Qt::white); |
||
161 | |||
162 | Compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel); |
||
163 | Compass->setScaleTicks(0, 0, 3); |
||
164 | Compass->setScale(36, 5, 0); |
||
165 | |||
166 | Compass->setNeedle(new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow, true, Qt::red, QColor(Qt::gray).light(130))); |
||
167 | Compass->setPalette(newPalette); |
||
168 | Compass->setMaximumSize(QSize(MeterSize, MeterSize)); |
||
169 | Compass->setMinimumSize(QSize(MeterSize, MeterSize)); |
||
170 | |||
171 | QPalette newPalette1; |
||
172 | |||
173 | newPalette1.setColor(QPalette::Base, Qt::darkBlue); |
||
174 | newPalette1.setColor(QPalette::Foreground, QColor(255,128,0).dark(120)); |
||
175 | newPalette1.setColor(QPalette::Text, Qt::white); |
||
176 | |||
177 | Attitude = new AttitudeIndicator(this); |
||
178 | Attitude->setMaximumSize(QSize(MeterSize, MeterSize)); |
||
179 | Attitude->setMinimumSize(QSize(MeterSize, MeterSize)); |
||
180 | Attitude->setPalette(newPalette1); |
||
181 | |||
182 | verticalLayout->addWidget(Attitude); |
||
183 | |||
184 | qwt_Rate->setRange(-10.0, 10.0, 0.1, 0); |
||
185 | |||
186 | newPalette1.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
||
187 | |||
188 | SpeedMeter = new cSpeedMeter(this); |
||
189 | SpeedMeter->setMaximumSize(QSize(MeterSize, MeterSize)); |
||
190 | SpeedMeter->setMinimumSize(QSize(MeterSize, MeterSize)); |
||
191 | SpeedMeter->setPalette(newPalette1); |
||
192 | SpeedMeter->setRange(0.0, 5.0); |
||
193 | SpeedMeter->setScale(1, 2, 0.5); |
||
194 | SpeedMeter->setProperty("END", 5); |
||
195 | |||
196 | LayOut_Speed->addWidget(SpeedMeter); |
||
197 | } |
||
198 | |||
158 | KeyOz | 199 | void MKTool::init_Objects() |
200 | { |
||
201 | // QTimer-Instanzen |
||
199 | KeyOz | 202 | Ticker = new QTimer(this); |
158 | KeyOz | 203 | |
306 | KeyOz | 204 | // Verbindungsobject |
205 | o_Connection = new cConnection(); |
||
250 | KeyOz | 206 | |
239 | Brean | 207 | // neuer Logger |
240 | Brean | 208 | logger = new Logger(Settings, &Mode); |
159 | KeyOz | 209 | |
227 | KeyOz | 210 | // LCD-Dialog |
211 | f_LCD = new dlg_LCD(this); |
||
212 | |||
305 | KeyOz | 213 | // LCD-Dialog |
307 | KeyOz | 214 | f_MotorMixer = new dlg_MotorMixer(this); |
215 | |||
216 | // LCD-Dialog |
||
305 | KeyOz | 217 | f_Map = new dlg_Map(this); |
306 | KeyOz | 218 | f_Map->create_Map(Settings); |
305 | KeyOz | 219 | |
306 | KeyOz | 220 | KML_Server = new cKML_Server(); |
199 | KeyOz | 221 | |
272 | KeyOz | 222 | QMK_Server = new cQMK_Server(); |
223 | QMK_Server->setProperty("Connect", false); |
||
199 | KeyOz | 224 | |
225 | if (Settings->Server.StartServer) |
||
226 | { |
||
227 | ac_StartServer->setChecked(true); |
||
306 | KeyOz | 228 | KML_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
199 | KeyOz | 229 | } |
158 | KeyOz | 230 | } |
231 | |||
232 | void MKTool::init_Connections() |
||
233 | { |
||
250 | KeyOz | 234 | connect(Dec, SIGNAL(clicked()), this, SLOT(slot_Test())); |
199 | KeyOz | 235 | |
306 | KeyOz | 236 | // Waypoints übergeben |
237 | connect(f_Map, SIGNAL(set_Target(sWayPoint)), this , SLOT(slot_MAP_SetTarget(sWayPoint))); |
||
238 | |||
250 | KeyOz | 239 | // Daten Senden / Empfangen |
306 | KeyOz | 240 | connect(o_Connection, SIGNAL(newData(sRxData)), this, SLOT(slot_newData(sRxData))); |
241 | connect(o_Connection, SIGNAL(showTerminal(int, QString)), this, SLOT(slot_showTerminal(int, QString))); |
||
158 | KeyOz | 242 | |
199 | KeyOz | 243 | // Serielle Verbundung öffnen / schließen |
244 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
||
245 | |||
227 | KeyOz | 246 | // TCP-Connection verbinden / trennen |
247 | connect(ac_QMKServer, SIGNAL(triggered()), this, SLOT(slot_QMKS_Connect())); |
||
248 | |||
167 | KeyOz | 249 | // Buttons Settings lesen / schreiben |
199 | KeyOz | 250 | connect(f_Settings->pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetFCSettings())); |
251 | connect(f_Settings->pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetFCSettings())); |
||
158 | KeyOz | 252 | |
253 | // Actions |
||
254 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
||
159 | KeyOz | 255 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
158 | KeyOz | 256 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
307 | KeyOz | 257 | connect(ac_MotorMixer, SIGNAL(triggered()), this, SLOT(slot_ac_MotorMixer())); |
227 | KeyOz | 258 | connect(ac_LCD, SIGNAL(triggered()), this, SLOT(slot_ac_LCD())); |
305 | KeyOz | 259 | connect(ac_Map, SIGNAL(triggered()), this, SLOT(slot_ac_Map())); |
199 | KeyOz | 260 | connect(ac_FastDebug, SIGNAL(triggered()), this, SLOT(slot_ac_FastDebug())); |
261 | connect(ac_NoDebug, SIGNAL(triggered()), this, SLOT(slot_ac_NoDebug())); |
||
262 | connect(ac_FastNavi, SIGNAL(triggered()), this, SLOT(slot_ac_FastNavi())); |
||
263 | connect(ac_NoNavi, SIGNAL(triggered()), this, SLOT(slot_ac_NoNavi())); |
||
158 | KeyOz | 264 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
265 | |||
167 | KeyOz | 266 | // Plotter starten / scrollen |
267 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
||
268 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
||
199 | KeyOz | 269 | connect(ac_StartServer, SIGNAL(triggered()), this, SLOT(slot_ac_StartServer())); |
167 | KeyOz | 270 | |
158 | KeyOz | 271 | // Tabs ein & ausblenden |
272 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
273 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
274 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
275 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
276 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
277 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
||
227 | KeyOz | 278 | connect(ac_View6, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
158 | KeyOz | 279 | |
199 | KeyOz | 280 | connect(ac_SelNC, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
281 | connect(ac_SelFC, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
||
282 | connect(ac_SelMag, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
||
283 | |||
284 | connect(rb_SelNC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
||
285 | connect(rb_SelFC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
||
286 | connect(rb_SelMag, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
||
287 | |||
167 | KeyOz | 288 | // firmeware Updateen / flashen |
199 | KeyOz | 289 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
166 | KeyOz | 290 | connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
158 | KeyOz | 291 | |
250 | KeyOz | 292 | // Wegpunkt-Befehl |
293 | connect(pb_FlyTo, SIGNAL(clicked()), this, SLOT(slot_pb_SendWaypoint())); |
||
294 | |||
167 | KeyOz | 295 | // CVS-Record starten / stoppen |
239 | Brean | 296 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordLog())); |
158 | KeyOz | 297 | |
298 | // Timer-Events |
||
299 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
||
300 | |||
167 | KeyOz | 301 | // Seitenwechsel |
199 | KeyOz | 302 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
306 | KeyOz | 303 | // connect(f_Settings->tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
304 | connect(f_Settings->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slot_TabChanged(int))); |
||
158 | KeyOz | 305 | |
167 | KeyOz | 306 | // About QMK & About-QT Dialog einfügen |
307 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
||
158 | KeyOz | 308 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
309 | } |
||
310 | |||
311 | void MKTool::init_Arrays() |
||
312 | { |
||
313 | lb_Analog[0] = lb_A_0; |
||
314 | lb_Analog[1] = lb_A_1; |
||
315 | lb_Analog[2] = lb_A_2; |
||
316 | lb_Analog[3] = lb_A_3; |
||
317 | lb_Analog[4] = lb_A_4; |
||
318 | lb_Analog[5] = lb_A_5; |
||
319 | lb_Analog[6] = lb_A_6; |
||
320 | lb_Analog[7] = lb_A_7; |
||
321 | lb_Analog[8] = lb_A_8; |
||
322 | lb_Analog[9] = lb_A_9; |
||
323 | lb_Analog[10] = lb_A_10; |
||
324 | lb_Analog[11] = lb_A_11; |
||
325 | lb_Analog[12] = lb_A_12; |
||
326 | lb_Analog[13] = lb_A_13; |
||
327 | lb_Analog[14] = lb_A_14; |
||
328 | lb_Analog[15] = lb_A_15; |
||
329 | lb_Analog[16] = lb_A_16; |
||
330 | lb_Analog[17] = lb_A_17; |
||
331 | lb_Analog[18] = lb_A_18; |
||
332 | lb_Analog[19] = lb_A_19; |
||
333 | lb_Analog[20] = lb_A_20; |
||
334 | lb_Analog[21] = lb_A_21; |
||
335 | lb_Analog[22] = lb_A_22; |
||
336 | lb_Analog[23] = lb_A_23; |
||
337 | lb_Analog[24] = lb_A_24; |
||
338 | lb_Analog[25] = lb_A_25; |
||
339 | lb_Analog[26] = lb_A_26; |
||
340 | lb_Analog[27] = lb_A_27; |
||
341 | lb_Analog[28] = lb_A_28; |
||
342 | lb_Analog[29] = lb_A_29; |
||
343 | lb_Analog[30] = lb_A_30; |
||
344 | lb_Analog[31] = lb_A_31; |
||
345 | } |
||
346 | |||
347 | void MKTool::init_Plot() |
||
348 | { |
||
349 | NextPlot = 0; |
||
350 | |||
351 | qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000))); |
||
352 | |||
353 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
||
354 | |||
355 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
||
356 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
||
357 | |||
358 | Grid->attach(qwtPlot); |
||
359 | |||
166 | KeyOz | 360 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
158 | KeyOz | 361 | |
362 | for (int a = 0; a < MaxAnalog; a++) |
||
363 | { |
||
162 | KeyOz | 364 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
365 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
||
250 | KeyOz | 366 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
158 | KeyOz | 367 | |
162 | KeyOz | 368 | if (Settings->Analog1.PlotView[a]) |
158 | KeyOz | 369 | Plot[a]->attach(qwtPlot); |
370 | } |
||
371 | qwtPlot->replot(); |
||
372 | } |
||
373 | |||
306 | KeyOz | 374 | void MKTool::slot_set_Settings(cSettings *t_Settings) |
375 | { |
||
376 | Settings = t_Settings; |
||
377 | } |
||
378 | |||
199 | KeyOz | 379 | void MKTool::slot_Test() |
158 | KeyOz | 380 | { |
272 | KeyOz | 381 | // qDebug("Decode Data"); |
382 | sRxData RX; |
||
383 | |||
384 | RX.String = IN->text(); |
||
385 | |||
386 | // qDebug(RX.String.toLatin1().data()); |
||
387 | |||
388 | // if (ToolBox::check_CRC(RX.String)) |
||
389 | { |
||
390 | qDebug("Decode Data CRC OK"); |
||
391 | RX.Input = RX.String.toLatin1().data(); |
||
392 | |||
393 | // qDebug(RX.Input); |
||
394 | |||
395 | slot_newData(RX); |
||
396 | } |
||
250 | KeyOz | 397 | } |
158 | KeyOz | 398 | |
272 | KeyOz | 399 | // KML-Datei nach Wegpunkt parsen |
400 | // TODO: Richtigen KML-Parser bauen |
||
250 | KeyOz | 401 | void MKTool::parse_TargetKML() |
402 | { |
||
403 | QString Tmp = te_KML->toPlainText().simplified(); |
||
404 | QStringList List; |
||
158 | KeyOz | 405 | |
250 | KeyOz | 406 | if ((Tmp.contains("<kml xmlns=\"http://earth.google.com/kml/2.2\">")) && (Tmp.contains("<coordinates>"))) |
407 | { |
||
408 | List = Tmp.split("<coordinates>"); |
||
409 | List = List[1].split(","); |
||
410 | |||
314 | KeyOz | 411 | le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 7)); |
412 | le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 7)); |
||
250 | KeyOz | 413 | } |
158 | KeyOz | 414 | } |
415 | |||
272 | KeyOz | 416 | // Waypoint zur NC Senden. |
250 | KeyOz | 417 | void MKTool::slot_pb_SendWaypoint() |
418 | { |
||
419 | if ((Navi.Current.Longitude == 0) && (Navi.Current.Latitude == 0)) |
||
420 | { |
||
421 | QMessageBox msgB; |
||
422 | QString msg; |
||
423 | msgB.setText("Fehler: Es konnten keine GPS-Daten vom Mikrokopter empfangen werden"); |
||
424 | msgB.exec(); |
||
425 | return; |
||
426 | } |
||
272 | KeyOz | 427 | |
250 | KeyOz | 428 | //erstelle einen Wegpunkt, den die NaviCtrl auswerten kann |
429 | Waypoint_t desired_pos; |
||
430 | bool ok_lat, ok_lon; |
||
431 | |||
432 | //eingegebene Daten holen |
||
433 | double desired_long, desired_lat; |
||
434 | |||
435 | desired_long = le_TarLong->text().toDouble(&ok_lon); |
||
436 | desired_lat = le_TarLat->text().toDouble(&ok_lat); |
||
437 | |||
438 | if (ok_lon && desired_long < 100) |
||
439 | desired_long *= 10000000+0.5; |
||
440 | |||
441 | if (ok_lat && desired_lat < 100) |
||
442 | desired_lat *= 10000000+0.5; |
||
443 | |||
444 | //fülle Wegpunkt-Daten |
||
445 | desired_pos.Position.Altitude = 0; |
||
446 | desired_pos.Position.Longitude = int32_t(desired_long); |
||
447 | desired_pos.Position.Latitude = int32_t(desired_lat); |
||
448 | desired_pos.Position.Status = NEWDATA; |
||
449 | desired_pos.Heading = -1; |
||
450 | desired_pos.ToleranceRadius = 1; |
||
451 | desired_pos.HoldTime = 60; |
||
452 | desired_pos.Event_Flag = 0; |
||
453 | desired_pos.reserve[0] = 0; // reserve |
||
454 | desired_pos.reserve[1] = 0; // reserve |
||
455 | desired_pos.reserve[2] = 0; // reserve |
||
456 | desired_pos.reserve[3] = 0; // reserve |
||
457 | |||
458 | //...und sende ihn an die NaviCtrl |
||
459 | int max_radius = 10000; |
||
460 | if (ok_lat && ok_lon && |
||
461 | abs(Navi.Current.Longitude - desired_pos.Position.Longitude) < max_radius && |
||
462 | abs(Navi.Current.Latitude - desired_pos.Position.Latitude) < max_radius) |
||
463 | { |
||
306 | KeyOz | 464 | o_Connection->send_Cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false); |
250 | KeyOz | 465 | } |
466 | else |
||
467 | { |
||
468 | QMessageBox msgB; |
||
469 | QString msg; |
||
470 | msg += "Bitte die Eingabe ueberpruefen!\n"; |
||
471 | msg += "Die Werte muessen sich in der Naehe der aktuellen Koordinaten befinden\n"; |
||
472 | msg += "(Lon: "; |
||
314 | KeyOz | 473 | msg += ToolBox::get_Float(Navi.Current.Longitude,7); |
250 | KeyOz | 474 | msg += ", "; |
475 | msg += "Lat: "; |
||
314 | KeyOz | 476 | msg += ToolBox::get_Float(Navi.Current.Latitude,7); |
250 | KeyOz | 477 | msg += ")"; |
478 | msgB.setText(msg); |
||
479 | msgB.exec(); |
||
480 | } |
||
481 | } |
||
482 | |||
199 | KeyOz | 483 | void MKTool::slot_ac_Hardware() |
484 | { |
||
485 | QAction *Action = (QAction*)sender(); |
||
158 | KeyOz | 486 | |
199 | KeyOz | 487 | if (Action->isChecked() == false) |
488 | { |
||
489 | Action->setChecked(true); |
||
490 | } |
||
491 | |||
492 | slot_rb_Hardware(); |
||
493 | } |
||
494 | |||
495 | void MKTool::slot_rb_Hardware() |
||
496 | { |
||
497 | if ((rb_SelNC->isChecked() == false) && (Mode.ID != ADDRESS_NC)) |
||
498 | { |
||
499 | lb_Status->setText(tr("Schalte um auf NaviCtrl.")); |
||
500 | TX_Data[0] = 0x1B; |
||
501 | TX_Data[1] = 0x1B; |
||
502 | TX_Data[2] = 0x55; |
||
503 | TX_Data[3] = 0xAA; |
||
504 | TX_Data[4] = 0x00; |
||
505 | TX_Data[5] = '\r'; |
||
306 | KeyOz | 506 | o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
227 | KeyOz | 507 | ToolBox::Wait(SLEEP); |
199 | KeyOz | 508 | } |
509 | |||
510 | if (rb_SelFC->isChecked()) |
||
511 | { |
||
512 | lb_Status->setText(tr("Schalte um auf FlightCtrl.")); |
||
513 | TX_Data[0] = 0; |
||
306 | KeyOz | 514 | o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
199 | KeyOz | 515 | } |
516 | else |
||
517 | if (rb_SelMag->isChecked()) |
||
518 | { |
||
519 | lb_Status->setText(tr("Schalte um auf MK3MAG.")); |
||
520 | TX_Data[0] = 1; |
||
306 | KeyOz | 521 | o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
199 | KeyOz | 522 | } |
523 | else |
||
524 | if (rb_SelNC->isChecked()) |
||
525 | { |
||
526 | lb_Status->setText(tr("Schalte um auf NaviCtrl.")); |
||
527 | TX_Data[0] = 0x1B; |
||
528 | TX_Data[1] = 0x1B; |
||
529 | TX_Data[2] = 0x55; |
||
530 | TX_Data[3] = 0xAA; |
||
531 | TX_Data[4] = 0x00; |
||
532 | TX_Data[5] = '\r'; |
||
306 | KeyOz | 533 | o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
199 | KeyOz | 534 | } |
227 | KeyOz | 535 | ToolBox::Wait(SLEEP); |
199 | KeyOz | 536 | |
537 | // qDebug("Select RB Hardware"); |
||
306 | KeyOz | 538 | o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
199 | KeyOz | 539 | } |
540 | |||
158 | KeyOz | 541 | // Ticker-Event |
542 | /////////////// |
||
543 | void MKTool::slot_Ticker() |
||
544 | { |
||
545 | if (TickerDiv) |
||
546 | TickerDiv = false; |
||
547 | else |
||
548 | TickerDiv = true; |
||
549 | |||
250 | KeyOz | 550 | if (cb_ClipBoard->isChecked()) |
551 | { |
||
552 | QString s_OLD = te_KML->toPlainText(); |
||
553 | te_KML->clear(); |
||
554 | te_KML->paste(); |
||
555 | if (s_OLD != te_KML->toPlainText()) |
||
556 | { |
||
557 | parse_TargetKML(); |
||
558 | } |
||
559 | } |
||
560 | |||
158 | KeyOz | 561 | for (int a = 0; a < MaxTickerEvents; a++) |
562 | { |
||
563 | if (TickerEvent[a] == true) |
||
564 | { |
||
565 | switch(a) |
||
566 | { |
||
567 | case 0 : |
||
568 | if (TickerDiv) |
||
569 | { |
||
570 | QByteArray Temp(LastSend.toUtf8()); |
||
250 | KeyOz | 571 | // serialPort->sendData(Temp); |
158 | KeyOz | 572 | } |
573 | break; |
||
574 | case 1 : |
||
159 | KeyOz | 575 | TX_Data[0] = 0; |
306 | KeyOz | 576 | o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false); |
158 | KeyOz | 577 | break; |
159 | KeyOz | 578 | case 2 : |
227 | KeyOz | 579 | if (f_LCD->cb_LCD->isChecked()) |
167 | KeyOz | 580 | { |
227 | KeyOz | 581 | if (!f_LCD->isVisible()) |
582 | { |
||
583 | Ticker->setInterval(2000); |
||
584 | TickerEvent[2] = false; |
||
585 | } |
||
167 | KeyOz | 586 | TX_Data[0] = LCD_Page; |
587 | TX_Data[1] = 0; |
||
306 | KeyOz | 588 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
167 | KeyOz | 589 | } |
159 | KeyOz | 590 | break; |
167 | KeyOz | 591 | case 3 : |
199 | KeyOz | 592 | if (ac_FastDebug->isChecked()) |
167 | KeyOz | 593 | { |
594 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
||
306 | KeyOz | 595 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
167 | KeyOz | 596 | } |
597 | else |
||
598 | { |
||
599 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
||
306 | KeyOz | 600 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
167 | KeyOz | 601 | } |
602 | break; |
||
158 | KeyOz | 603 | } |
604 | } |
||
605 | } |
||
606 | } |
||
607 | |||
227 | KeyOz | 608 | void MKTool::slot_QMKS_Connect() |
609 | { |
||
610 | if (ac_QMKServer->isChecked()) |
||
611 | { |
||
612 | lb_Status->setText(tr("Verbinde zum QMK-Datenserver.")); |
||
158 | KeyOz | 613 | |
272 | KeyOz | 614 | QMK_Server->Connect(Settings->Server.QMKS_Host, Settings->Server.QMKS_Port.toInt(), Settings->Server.QMKS_Login, Settings->Server.QMKS_Password); |
227 | KeyOz | 615 | |
272 | KeyOz | 616 | connect(QMK_Server, SIGNAL(sig_Connected()), this, SLOT(slot_QMKS_Connected())); |
617 | connect(QMK_Server, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_QMKS_Disconnected(int))); |
||
227 | KeyOz | 618 | } |
619 | else |
||
620 | { |
||
272 | KeyOz | 621 | if ((QMK_Server->property("Connect")) == true) |
227 | KeyOz | 622 | { |
272 | KeyOz | 623 | disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0); |
227 | KeyOz | 624 | lb_Status->setText(tr("Trenne vom QMK-Datenserver.")); |
625 | |||
272 | KeyOz | 626 | QMK_Server->Disconnect(); |
627 | QMK_Server->setProperty("Connect", false); |
||
227 | KeyOz | 628 | ac_QMKServer->setText("QMK-Server Verbinden"); |
629 | } |
||
630 | } |
||
631 | } |
||
632 | |||
633 | void MKTool::slot_QMKS_Connected() |
||
634 | { |
||
272 | KeyOz | 635 | QMK_Server->setProperty("Connect", true); |
227 | KeyOz | 636 | ac_QMKServer->setText("QMK-Server Trennnen"); |
637 | lb_Status->setText(tr("Verbunden mit QMK-Datenserver.")); |
||
638 | } |
||
639 | |||
640 | void MKTool::slot_QMKS_Disconnected(int Error) |
||
641 | { |
||
272 | KeyOz | 642 | QMK_Server->setProperty("Connect", false); |
227 | KeyOz | 643 | ac_QMKServer->setText("QMK-Server Verbinden"); |
644 | ac_QMKServer->setChecked(false); |
||
645 | |||
272 | KeyOz | 646 | disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0); |
227 | KeyOz | 647 | |
648 | switch (Error) |
||
649 | { |
||
650 | case 1 : |
||
651 | { |
||
652 | lb_Status->setText(tr("Verbindung vom Server beendet.")); |
||
653 | QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Verbindung wurde vom Server beendet.", QMessageBox::Ok); |
||
654 | } |
||
655 | break; |
||
656 | case 2 : |
||
657 | { |
||
658 | lb_Status->setText(tr("Server nicht gefunden.")); |
||
659 | QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Kann nicht zum Server verbinden.", QMessageBox::Ok); |
||
660 | } |
||
661 | break; |
||
662 | case 3 : |
||
663 | { |
||
664 | lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch.")); |
||
665 | QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Loginname oder Password falsch.", QMessageBox::Ok); |
||
666 | } |
||
667 | break; |
||
668 | default : |
||
669 | { |
||
670 | lb_Status->setText(tr("Getrennt vom QMK-Datenserver.")); |
||
671 | } |
||
672 | break; |
||
673 | } |
||
674 | } |
||
675 | |||
158 | KeyOz | 676 | // Slots der Actions (Menüpunkte, Buttons) |
677 | ////////////////////////////////////////// |
||
678 | void MKTool::slot_ac_Motortest() |
||
679 | { |
||
680 | dlg_Motortest *f_Motortest = new dlg_Motortest(this); |
||
681 | |||
682 | connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int))); |
||
683 | |||
684 | if (f_Motortest->exec()==QDialog::Accepted) |
||
685 | { |
||
686 | } |
||
687 | |||
688 | disconnect(f_Motortest, 0,0,0); |
||
689 | slot_Motortest(0,0,0,0); |
||
690 | } |
||
691 | |||
307 | KeyOz | 692 | void MKTool::slot_ac_MotorMixer() |
693 | { |
||
694 | f_MotorMixer->set_Objects(o_Connection, Settings); |
||
695 | f_MotorMixer->read_Mixer(); |
||
696 | |||
697 | if (f_MotorMixer->exec()==QDialog::Accepted) |
||
698 | { |
||
699 | } |
||
700 | } |
||
701 | |||
227 | KeyOz | 702 | void MKTool::slot_ac_LCD() |
703 | { |
||
704 | if (!f_LCD->isVisible()) |
||
705 | { |
||
306 | KeyOz | 706 | delete f_LCD; |
227 | KeyOz | 707 | f_LCD = new dlg_LCD(this); |
708 | |||
709 | // LCD auf / ab |
||
710 | connect(f_LCD->pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
||
711 | connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
||
712 | |||
713 | f_LCD->show(); |
||
714 | TX_Data[0] = 0; |
||
715 | TX_Data[1] = 0; |
||
306 | KeyOz | 716 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
227 | KeyOz | 717 | |
718 | Ticker->setInterval(500); |
||
719 | TickerEvent[2] = true; |
||
720 | } |
||
721 | } |
||
722 | |||
305 | KeyOz | 723 | void MKTool::slot_ac_Map() |
724 | { |
||
725 | if (!f_Map->isVisible()) |
||
726 | { |
||
727 | f_Map->show(); |
||
728 | } |
||
729 | } |
||
730 | |||
306 | KeyOz | 731 | void MKTool::slot_MAP_SetTarget(sWayPoint Target) |
732 | { |
||
315 | KeyOz | 733 | |
734 | QString s_Lon, s_Lat; |
||
735 | QTextStream t_Lon(&s_Lon); |
||
736 | QTextStream t_Lat(&s_Lat); |
||
737 | |||
738 | t_Lon.setRealNumberPrecision(9); |
||
739 | t_Lat.setRealNumberPrecision(9); |
||
740 | t_Lon << Target.Longitude; |
||
741 | t_Lat << Target.Latitude; |
||
742 | |||
743 | le_TarLong->setText(s_Lon); |
||
744 | le_TarLat->setText(s_Lat); |
||
306 | KeyOz | 745 | sb_TarTime->setValue(Target.Time); |
305 | KeyOz | 746 | |
306 | KeyOz | 747 | slot_pb_SendWaypoint(); |
748 | } |
||
749 | |||
158 | KeyOz | 750 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
751 | { |
||
752 | TX_Data[0] = Motor1; |
||
753 | TX_Data[1] = Motor2; |
||
754 | TX_Data[2] = Motor3; |
||
755 | TX_Data[3] = Motor4; |
||
306 | KeyOz | 756 | o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false); |
158 | KeyOz | 757 | } |
758 | |||
759 | void MKTool::slot_ac_Config() |
||
760 | { |
||
162 | KeyOz | 761 | set_Analog Old_Analog1; |
158 | KeyOz | 762 | |
162 | KeyOz | 763 | Old_Analog1 = Settings->Analog1; |
764 | |||
158 | KeyOz | 765 | dlg_Config *f_Config = new dlg_Config(this); |
162 | KeyOz | 766 | f_Config->set_Settings(Settings, Mode.ID); |
158 | KeyOz | 767 | |
768 | if (f_Config->exec()==QDialog::Accepted) |
||
769 | { |
||
770 | Settings = f_Config->get_Settings(); |
||
162 | KeyOz | 771 | Settings->write_Settings_Analog(Mode.ID); |
158 | KeyOz | 772 | |
163 | KeyOz | 773 | // Plotter neu einrichten |
774 | if (Old_Analog1.PlotView != Settings->Analog1.PlotView) |
||
158 | KeyOz | 775 | { |
163 | KeyOz | 776 | config_Plot(); |
158 | KeyOz | 777 | } |
778 | |||
163 | KeyOz | 779 | // CVS-Datei neu anlegen. |
241 | KeyOz | 780 | if ((logger->is_active()) && (Old_Analog1.LogView != Settings->Analog1.LogView)) |
158 | KeyOz | 781 | { |
239 | Brean | 782 | logger->close(); |
240 | Brean | 783 | logger->start_Log(); |
158 | KeyOz | 784 | } |
785 | |||
786 | } |
||
787 | } |
||
788 | |||
239 | Brean | 789 | //aktualisiere Logging-Status |
241 | KeyOz | 790 | void MKTool::update_Log() |
791 | { |
||
239 | Brean | 792 | if (logger->is_active()) |
793 | { |
||
272 | KeyOz | 794 | |
239 | Brean | 795 | ac_RecordCSV->setText("Log Stop"); |
796 | lb_Status->setText(tr("Log-Record gestartet.")); |
||
797 | } |
||
798 | else |
||
799 | { |
||
241 | KeyOz | 800 | ac_RecordCSV->setText("Log Aufzeichnen"); |
239 | Brean | 801 | lb_Status->setText(tr("Log-Record gestopt.")); |
802 | } |
||
803 | } |
||
804 | |||
805 | //starte/stoppe Logging, wenn auf den entsprechenden Button gedrückt wurde |
||
806 | void MKTool::slot_RecordLog() |
||
807 | { |
||
808 | if (!logger->is_active()) |
||
809 | logger->start_Log(); |
||
810 | else |
||
811 | logger->close(); |
||
241 | KeyOz | 812 | |
239 | Brean | 813 | update_Log(); |
814 | } |
||
815 | |||
159 | KeyOz | 816 | void MKTool::slot_ac_Preferences() |
817 | { |
||
818 | dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
||
819 | |||
166 | KeyOz | 820 | Settings->TTY.Port = le_Port->text(); |
163 | KeyOz | 821 | f_Preferences->set_Settings(Settings); |
822 | |||
159 | KeyOz | 823 | if (f_Preferences->exec()==QDialog::Accepted) |
824 | { |
||
163 | KeyOz | 825 | Settings = f_Preferences->get_Settings(); |
826 | Settings->write_Settings(); |
||
166 | KeyOz | 827 | le_Port->setText(Settings->TTY.Port); |
828 | config_Plot(); |
||
159 | KeyOz | 829 | } |
830 | } |
||
831 | |||
158 | KeyOz | 832 | void MKTool::slot_ac_StartPlotter() |
833 | { |
||
834 | if (ac_StartPlotter->isChecked()) |
||
835 | { |
||
199 | KeyOz | 836 | lb_Status->setText(tr("Datenplotter gestartet.")); |
158 | KeyOz | 837 | ac_StartPlotter->setText("Stop Plotter"); |
838 | pb_StartPlotter->setText("Stop Plotter"); |
||
839 | } |
||
840 | else |
||
841 | { |
||
199 | KeyOz | 842 | lb_Status->setText(tr("Datenplotter gestopt.")); |
158 | KeyOz | 843 | ac_StartPlotter->setText("Start Plotter"); |
844 | pb_StartPlotter->setText("Start Plotter"); |
||
845 | } |
||
846 | } |
||
847 | |||
848 | void MKTool::slot_ac_View() |
||
849 | { |
||
227 | KeyOz | 850 | int Aktive = -1; |
158 | KeyOz | 851 | |
852 | QAction *Action = (QAction*)sender(); |
||
853 | |||
854 | if (Action->objectName() == QString("ac_View0")) |
||
855 | Aktive = 0; |
||
856 | if (Action->objectName() == QString("ac_View1")) |
||
857 | Aktive = 1; |
||
858 | if (Action->objectName() == QString("ac_View2")) |
||
859 | Aktive = 2; |
||
860 | if (Action->objectName() == QString("ac_View3")) |
||
861 | Aktive = 3; |
||
862 | if (Action->objectName() == QString("ac_View4")) |
||
863 | Aktive = 4; |
||
864 | if (Action->objectName() == QString("ac_View5")) |
||
865 | Aktive = 5; |
||
272 | KeyOz | 866 | if (Action->objectName() == QString("ac_View6")) |
867 | Aktive = 6; |
||
158 | KeyOz | 868 | |
869 | QString TabName = QString("Tab_%1").arg(Aktive); |
||
870 | |||
871 | if (!Action->isChecked()) |
||
872 | { |
||
873 | for (int a = 0; a < tab_Main->count(); a++) |
||
874 | { |
||
875 | if (tab_Main->widget(a)->objectName() == TabName) |
||
876 | { |
||
877 | tab_Main->removeTab(a); |
||
878 | } |
||
879 | } |
||
880 | } |
||
881 | else |
||
882 | { |
||
227 | KeyOz | 883 | tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->icon(), Action->text()); |
158 | KeyOz | 884 | } |
885 | } |
||
886 | |||
199 | KeyOz | 887 | void MKTool::slot_ac_FastNavi() // DONE NC 0.12i |
158 | KeyOz | 888 | { |
199 | KeyOz | 889 | if (!ac_NoNavi->isChecked()) |
158 | KeyOz | 890 | { |
199 | KeyOz | 891 | if (ac_FastNavi->isChecked()) |
166 | KeyOz | 892 | { |
199 | KeyOz | 893 | lb_Status->setText(tr("Fordere schnelle NaviDaten an.")); |
894 | TX_Data[0] = Settings->Data.Navi_Fast / 10; |
||
895 | } |
||
896 | else |
||
897 | { |
||
898 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
||
899 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
||
900 | } |
||
306 | KeyOz | 901 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
199 | KeyOz | 902 | } |
903 | } |
||
904 | |||
905 | void MKTool::slot_ac_NoNavi() // DONE NC 0.12i |
||
906 | { |
||
907 | if (ac_NoNavi->isChecked()) |
||
908 | { |
||
909 | lb_Status->setText(tr("NaviDaten abstellen.")); |
||
910 | TX_Data[0] = 0; |
||
911 | } |
||
912 | else |
||
913 | { |
||
914 | if (ac_FastNavi->isChecked()) |
||
915 | { |
||
916 | lb_Status->setText(tr("Fordere schnelle NaviDaten an.")); |
||
917 | TX_Data[0] = Settings->Data.Navi_Fast / 10; |
||
918 | } |
||
919 | else |
||
920 | { |
||
921 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
||
922 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
||
923 | } |
||
924 | } |
||
306 | KeyOz | 925 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
199 | KeyOz | 926 | } |
927 | |||
928 | void MKTool::slot_ac_FastDebug() // DONE 0.71g |
||
929 | { |
||
930 | if (!ac_NoDebug->isChecked()) |
||
931 | { |
||
932 | if (ac_FastDebug->isChecked()) |
||
933 | { |
||
934 | lb_Status->setText(tr("Fordere schnelle DebugDaten an.")); |
||
166 | KeyOz | 935 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
936 | } |
||
937 | else |
||
938 | { |
||
199 | KeyOz | 939 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
166 | KeyOz | 940 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
941 | } |
||
306 | KeyOz | 942 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
166 | KeyOz | 943 | } |
944 | } |
||
945 | |||
199 | KeyOz | 946 | void MKTool::slot_ac_NoDebug() // DONE 0.71g |
166 | KeyOz | 947 | { |
199 | KeyOz | 948 | if (ac_NoDebug->isChecked()) |
166 | KeyOz | 949 | { |
199 | KeyOz | 950 | lb_Status->setText(tr("DebugDaten abstellen.")); |
167 | KeyOz | 951 | TickerEvent[3] = false; |
166 | KeyOz | 952 | TX_Data[0] = 0; |
953 | } |
||
158 | KeyOz | 954 | else |
955 | { |
||
167 | KeyOz | 956 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
957 | if (Mode.ID == ADDRESS_MK3MAG) |
||
958 | TickerEvent[3] = true; |
||
959 | |||
199 | KeyOz | 960 | if (ac_FastDebug->isChecked()) |
166 | KeyOz | 961 | { |
199 | KeyOz | 962 | lb_Status->setText(tr("Fordere schnelle DebugDaten an.")); |
166 | KeyOz | 963 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
964 | } |
||
965 | else |
||
966 | { |
||
199 | KeyOz | 967 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
166 | KeyOz | 968 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
969 | } |
||
970 | } |
||
306 | KeyOz | 971 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
158 | KeyOz | 972 | } |
973 | |||
974 | void MKTool::slot_ac_About() |
||
975 | { |
||
976 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
||
977 | } |
||
978 | |||
159 | KeyOz | 979 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
158 | KeyOz | 980 | { |
199 | KeyOz | 981 | lb_Status->setText(tr("Analoglabels auslesen.")); |
158 | KeyOz | 982 | TX_Data[0] = 0; |
306 | KeyOz | 983 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
158 | KeyOz | 984 | } |
985 | |||
199 | KeyOz | 986 | void MKTool::slot_ac_StartServer() |
987 | { |
||
988 | if (ac_StartServer->isChecked()) |
||
989 | { |
||
306 | KeyOz | 990 | lb_Status->setText(tr("KML-Server gestartet.")); |
991 | KML_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
||
199 | KeyOz | 992 | } |
993 | else |
||
994 | { |
||
306 | KeyOz | 995 | lb_Status->setText(tr("KML-Server gestopt.")); |
996 | KML_Server->stop_Server(); |
||
199 | KeyOz | 997 | } |
998 | } |
||
159 | KeyOz | 999 | |
227 | KeyOz | 1000 | |
158 | KeyOz | 1001 | // Daten-Plotter |
1002 | ///////////////// |
||
1003 | void MKTool::update_Plot() |
||
1004 | { |
||
1005 | for (int a = 0; a < MaxAnalog; a++) |
||
1006 | { |
||
1007 | Plot[a]->setData(aID,aData[a],NextPlot - 1); |
||
1008 | } |
||
1009 | |||
166 | KeyOz | 1010 | if ((NextPlot > Settings->Data.Plotter_Count)) |
158 | KeyOz | 1011 | { |
166 | KeyOz | 1012 | scroll_plot->setMaximum(NextPlot - Settings->Data.Plotter_Count); |
158 | KeyOz | 1013 | } |
1014 | |||
166 | KeyOz | 1015 | if ((scroll_plot->value() == NextPlot - (Settings->Data.Plotter_Count + 1))) |
158 | KeyOz | 1016 | { |
166 | KeyOz | 1017 | qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - Settings->Data.Plotter_Count,NextPlot,0); |
1018 | scroll_plot->setValue(NextPlot - Settings->Data.Plotter_Count); |
||
158 | KeyOz | 1019 | } |
1020 | |||
1021 | qwtPlot->replot(); |
||
1022 | } |
||
1023 | |||
1024 | void MKTool::config_Plot() |
||
1025 | { |
||
166 | KeyOz | 1026 | // qDebug("Plotter rekonfiguriert..!!"); |
1027 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
||
1028 | |||
158 | KeyOz | 1029 | for (int a = 0; a < MaxAnalog; a++) |
1030 | { |
||
1031 | Plot[a]->detach(); |
||
162 | KeyOz | 1032 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
158 | KeyOz | 1033 | |
162 | KeyOz | 1034 | if (Settings->Analog1.PlotView[a]) |
1035 | { |
||
1036 | Plot[a]->setTitle(Settings->Analog1.Label[a]); |
||
158 | KeyOz | 1037 | Plot[a]->attach(qwtPlot); |
162 | KeyOz | 1038 | } |
158 | KeyOz | 1039 | } |
166 | KeyOz | 1040 | qwtPlot->replot(); |
158 | KeyOz | 1041 | } |
1042 | |||
1043 | void MKTool::slot_ScrollPlot(int Pos) |
||
1044 | { |
||
166 | KeyOz | 1045 | qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + Settings->Data.Plotter_Count,0); |
158 | KeyOz | 1046 | qwtPlot->replot(); |
1047 | } |
||
1048 | |||
1049 | |||
1050 | // Firmeware-Update |
||
1051 | /////////////////// |
||
1052 | void MKTool::slot_pb_Update() |
||
1053 | { |
||
167 | KeyOz | 1054 | QString Device; |
1055 | QString Hardware; |
||
158 | KeyOz | 1056 | |
167 | KeyOz | 1057 | if (rb_FC->isChecked()) |
1058 | { |
||
1059 | Device = "m644"; |
||
1060 | Hardware = "FlightCtrl"; |
||
1061 | } |
||
1062 | else if (rb_MK3MAG->isChecked()) |
||
1063 | { |
||
1064 | Device = "m168"; |
||
1065 | Hardware = "MK3MAG"; |
||
1066 | } |
||
1067 | else if (rb_BL->isChecked()) |
||
1068 | { |
||
1069 | Device = "m8"; |
||
1070 | Hardware = "BL-Ctrl"; |
||
1071 | } |
||
166 | KeyOz | 1072 | |
1073 | QString Message = "Firmeware-Datei \n\n"; |
||
1074 | Message = Message + le_HexFile->text() + "\n\n"; |
||
167 | KeyOz | 1075 | Message = Message + "an " + Hardware + trUtf8(" mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n"); |
166 | KeyOz | 1076 | |
1077 | if (le_HexFile->text() == "") |
||
162 | KeyOz | 1078 | { |
166 | KeyOz | 1079 | QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
162 | KeyOz | 1080 | } |
166 | KeyOz | 1081 | else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
1082 | { |
||
306 | KeyOz | 1083 | QString Programm = Settings->DIR.AVRDUDE; |
162 | KeyOz | 1084 | |
166 | KeyOz | 1085 | QStringList Argumente; |
162 | KeyOz | 1086 | |
166 | KeyOz | 1087 | Update = new QProcess(); |
162 | KeyOz | 1088 | |
306 | KeyOz | 1089 | if (o_Connection->isOpen()) |
166 | KeyOz | 1090 | { |
1091 | slot_OpenPort(); |
||
1092 | } |
||
1093 | |||
1094 | Argumente << "-P"; |
||
1095 | Argumente << le_Port->text(); |
||
1096 | Argumente << "-p"; |
||
1097 | Argumente << Device; |
||
1098 | Argumente << "-c"; |
||
1099 | Argumente << "butterfly"; |
||
1100 | Argumente << "-b"; |
||
1101 | Argumente << "57600"; |
||
1102 | Argumente << "-U"; |
||
1103 | Argumente << "flash:w:" + le_HexFile->text(); |
||
1104 | |||
1105 | // QString Programm = "/home/Manuel/bin/avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:/home/Manuel/Documents/Mikrokopter/Firmeware/FlightCtrl/Flight-Ctrl_MEGA644_V0_71h.hex"; |
||
1106 | |||
1107 | te_Shell->setText(""); // Ausgabefenster säubern |
||
1108 | |||
1109 | connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
||
1110 | connect(Update, SIGNAL(readyReadStandardError()), this, SLOT(slot_UpdateShell()) ); |
||
1111 | |||
1112 | Update->start(Programm, Argumente); // Programmaufruf |
||
1113 | } |
||
158 | KeyOz | 1114 | } |
1115 | |||
1116 | void MKTool::slot_UpdateShell() |
||
1117 | { |
||
162 | KeyOz | 1118 | QByteArray Output; |
158 | KeyOz | 1119 | |
166 | KeyOz | 1120 | Output = Update->readAllStandardError(); // Shellausgabe an Variable |
162 | KeyOz | 1121 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1122 | te_Shell->insertPlainText(QString::fromUtf8(Output)); |
||
158 | KeyOz | 1123 | |
166 | KeyOz | 1124 | Output = Update->readAll(); |
1125 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
||
1126 | te_Shell->insertPlainText(QString::fromUtf8(Output)); |
||
158 | KeyOz | 1127 | } |
1128 | |||
166 | KeyOz | 1129 | void MKTool::slot_pb_HexFile() |
1130 | { |
||
1131 | QString FileName = QFileDialog::getOpenFileName(this,trUtf8(("Firmeware-Datei wählen")),"", |
||
1132 | tr("Intel Hex(*.hex);;Alle Dateien (*)")); |
||
1133 | if (!FileName.isEmpty()) |
||
1134 | { |
||
1135 | le_HexFile->setText(FileName); |
||
1136 | } |
||
1137 | } |
||
158 | KeyOz | 1138 | |
1139 | |||
167 | KeyOz | 1140 | // Wechsel der Tabs erkennen |
159 | KeyOz | 1141 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
158 | KeyOz | 1142 | { |
1143 | Tab = Tab; |
||
162 | KeyOz | 1144 | if (tab_Main->count() != 0) |
158 | KeyOz | 1145 | { |
306 | KeyOz | 1146 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->listWidget->currentRow() == 1)) |
162 | KeyOz | 1147 | { |
1148 | TX_Data[0] = 0; |
||
313 | KeyOz | 1149 | o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false); |
159 | KeyOz | 1150 | |
162 | KeyOz | 1151 | Ticker->setInterval(500); |
1152 | TickerEvent[1] = true; |
||
1153 | } |
||
1154 | else |
||
1155 | { |
||
1156 | Ticker->setInterval(2000); |
||
1157 | TickerEvent[1] = false; |
||
1158 | } |
||
159 | KeyOz | 1159 | } |
158 | KeyOz | 1160 | } |
1161 | |||
167 | KeyOz | 1162 | // LCD-Seiten weiterschalten |
159 | KeyOz | 1163 | void MKTool::slot_LCD_UP() // DONE 0.71g |
158 | KeyOz | 1164 | { |
159 | KeyOz | 1165 | if (LCD_Page == LCD_MAX_Page) |
1166 | TX_Data[0] = 0; |
||
1167 | else |
||
1168 | TX_Data[0] = LCD_Page + 1; |
||
1169 | |||
1170 | TX_Data[1] = 0; |
||
306 | KeyOz | 1171 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
159 | KeyOz | 1172 | } |
1173 | |||
1174 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
||
1175 | { |
||
1176 | if (LCD_Page == 0) |
||
1177 | TX_Data[0] = LCD_MAX_Page; |
||
1178 | else |
||
1179 | TX_Data[0] = LCD_Page - 1; |
||
1180 | |||
1181 | TX_Data[1] = 0; |
||
306 | KeyOz | 1182 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
159 | KeyOz | 1183 | } |
1184 | |||
167 | KeyOz | 1185 | // Settings aus MK lesen / in MK schreiben |
199 | KeyOz | 1186 | void MKTool::slot_GetFCSettings() // DONE 0.71g |
159 | KeyOz | 1187 | { |
199 | KeyOz | 1188 | lb_Status->setText(tr("Lese FlightCtrl-Settings aus.")); |
167 | KeyOz | 1189 | TX_Data[0] = f_Settings->sb_Set->value(); |
158 | KeyOz | 1190 | TX_Data[1] = 0; |
313 | KeyOz | 1191 | o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true); |
158 | KeyOz | 1192 | } |
1193 | |||
199 | KeyOz | 1194 | void MKTool::slot_SetFCSettings() // DONE 0.71g |
158 | KeyOz | 1195 | { |
199 | KeyOz | 1196 | char *TX_Data2 = f_Settings->GetFCSettings(); |
158 | KeyOz | 1197 | |
199 | KeyOz | 1198 | lb_Status->setText(tr("Schreibe FlightCtrl-Settings.")); |
167 | KeyOz | 1199 | |
313 | KeyOz | 1200 | o_Connection->send_Cmd('s', ADDRESS_FC, TX_Data2, MaxParameter + 2, true); |
158 | KeyOz | 1201 | } |
1202 | |||
159 | KeyOz | 1203 | |
167 | KeyOz | 1204 | // Save GUI-Preferences |
1205 | /////////////////////// |
||
1206 | void MKTool::set_Preferences() |
||
158 | KeyOz | 1207 | { |
163 | KeyOz | 1208 | Settings->GUI.TabViews.setBit(0, ac_View0->isChecked()); |
1209 | Settings->GUI.TabViews.setBit(1, ac_View1->isChecked()); |
||
1210 | Settings->GUI.TabViews.setBit(2, ac_View2->isChecked()); |
||
1211 | Settings->GUI.TabViews.setBit(3, ac_View3->isChecked()); |
||
1212 | Settings->GUI.TabViews.setBit(4, ac_View4->isChecked()); |
||
1213 | Settings->GUI.TabViews.setBit(5, ac_View5->isChecked()); |
||
227 | KeyOz | 1214 | Settings->GUI.TabViews.setBit(6, ac_View6->isChecked()); |
158 | KeyOz | 1215 | |
227 | KeyOz | 1216 | Settings->GUI.ToolViews.setBit(0, tb_Allgemein->isVisibleTo(this)); |
1217 | Settings->GUI.ToolViews.setBit(1, tb_Werkzeuge->isVisibleTo(this)); |
||
1218 | Settings->GUI.ToolViews.setBit(2, tb_Debug->isVisibleTo(this)); |
||
1219 | Settings->GUI.ToolViews.setBit(3, tb_TTY->isVisibleTo(this)); |
||
1220 | Settings->GUI.ToolViews.setBit(4, tb_Hardware->isVisibleTo(this)); |
||
1221 | |||
162 | KeyOz | 1222 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
1223 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
||
1224 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
||
166 | KeyOz | 1225 | Settings->GUI.Term_Send = cb_ShowSend->isChecked(); |
167 | KeyOz | 1226 | Settings->GUI.isMax = isMaximized(); |
1227 | Settings->GUI.Size = size(); |
||
1228 | Settings->GUI.Point = pos(); |
||
162 | KeyOz | 1229 | |
163 | KeyOz | 1230 | Settings->TTY.Port = le_Port->text(); |
158 | KeyOz | 1231 | } |
1232 | |||
1233 | void MKTool::show_DebugData() |
||
1234 | { |
||
241 | KeyOz | 1235 | if (logger->is_active()) |
1236 | logger->write(AnalogData); |
||
158 | KeyOz | 1237 | |
1238 | if (ac_StartPlotter->isChecked()) |
||
1239 | { |
||
1240 | aID[NextPlot] = NextPlot; |
||
1241 | |||
1242 | for (int a = 0; a < MaxAnalog; a++) |
||
1243 | { |
||
1244 | aData[a][NextPlot] = AnalogData[a]; |
||
1245 | } |
||
1246 | NextPlot++; |
||
1247 | |||
1248 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_1"))) |
||
1249 | update_Plot(); |
||
1250 | } |
||
1251 | |||
1252 | le_A_0->setText(QString("%1").arg(AnalogData[0])); |
||
1253 | le_A_1->setText(QString("%1").arg(AnalogData[1])); |
||
1254 | le_A_2->setText(QString("%1").arg(AnalogData[2])); |
||
1255 | le_A_3->setText(QString("%1").arg(AnalogData[3])); |
||
1256 | le_A_4->setText(QString("%1").arg(AnalogData[4])); |
||
1257 | le_A_5->setText(QString("%1").arg(AnalogData[5])); |
||
1258 | le_A_6->setText(QString("%1").arg(AnalogData[6])); |
||
1259 | le_A_7->setText(QString("%1").arg(AnalogData[7])); |
||
1260 | le_A_8->setText(QString("%1").arg(AnalogData[8])); |
||
1261 | le_A_9->setText(QString("%1").arg(AnalogData[9])); |
||
1262 | le_A_10->setText(QString("%1").arg(AnalogData[10])); |
||
1263 | le_A_11->setText(QString("%1").arg(AnalogData[11])); |
||
1264 | le_A_12->setText(QString("%1").arg(AnalogData[12])); |
||
1265 | le_A_13->setText(QString("%1").arg(AnalogData[13])); |
||
1266 | le_A_14->setText(QString("%1").arg(AnalogData[14])); |
||
1267 | le_A_15->setText(QString("%1").arg(AnalogData[15])); |
||
1268 | le_A_16->setText(QString("%1").arg(AnalogData[16])); |
||
1269 | le_A_17->setText(QString("%1").arg(AnalogData[17])); |
||
1270 | le_A_18->setText(QString("%1").arg(AnalogData[18])); |
||
1271 | le_A_19->setText(QString("%1").arg(AnalogData[19])); |
||
1272 | le_A_20->setText(QString("%1").arg(AnalogData[20])); |
||
1273 | le_A_21->setText(QString("%1").arg(AnalogData[21])); |
||
1274 | le_A_22->setText(QString("%1").arg(AnalogData[22])); |
||
1275 | le_A_23->setText(QString("%1").arg(AnalogData[23])); |
||
1276 | le_A_24->setText(QString("%1").arg(AnalogData[24])); |
||
1277 | le_A_25->setText(QString("%1").arg(AnalogData[25])); |
||
1278 | le_A_26->setText(QString("%1").arg(AnalogData[26])); |
||
1279 | le_A_27->setText(QString("%1").arg(AnalogData[27])); |
||
1280 | le_A_28->setText(QString("%1").arg(AnalogData[28])); |
||
1281 | le_A_29->setText(QString("%1").arg(AnalogData[29])); |
||
1282 | le_A_30->setText(QString("%1").arg(AnalogData[30])); |
||
1283 | le_A_31->setText(QString("%1").arg(AnalogData[31])); |
||
227 | KeyOz | 1284 | |
1285 | if ((Mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0)) |
||
1286 | { |
||
1287 | bar_UBAT->setValue(AnalogData[9]); |
||
1288 | bar_RX->setValue(AnalogData[10]); |
||
1289 | |||
1290 | Compass->setValue(AnalogData[8]); |
||
1291 | |||
1292 | int Roll = (AnalogData[1] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024; |
||
1293 | int Nick = (AnalogData[0] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024; |
||
1294 | |||
1295 | if (Roll > 128) |
||
1296 | Roll = Roll - 255; |
||
1297 | |||
1298 | if (Nick > 128) |
||
1299 | Nick = Nick - 255; |
||
1300 | |||
1301 | Attitude->setAngle(Roll); |
||
1302 | Attitude->setGradient(double(double(Nick) / 100.0)); |
||
1303 | } |
||
158 | KeyOz | 1304 | } |
1305 | |||
199 | KeyOz | 1306 | void MKTool::new_NaviData(sRxData RX) |
1307 | { |
||
306 | KeyOz | 1308 | // qDebug("Navi-Data"); |
1309 | |||
1310 | switch(RX.Decode[N_NC_FLAGS]) |
||
1311 | { |
||
1312 | case 1 : lb_Mode->setText("Free"); break; |
||
1313 | case 2 : lb_Mode->setText("Position Hold"); break; |
||
1314 | case 4 : lb_Mode->setText("Coming Home"); break; |
||
1315 | case 8 : lb_Mode->setText("Range Limit"); break; |
||
1316 | } |
||
1317 | |||
246 | KeyOz | 1318 | Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, N_CUR_LONGITUDE, true); |
1319 | Navi.Current.Latitude = ToolBox::Data2Long(RX.Decode, N_CUR_LATITUDE, true); |
||
1320 | Navi.Current.Altitude = ToolBox::Data2Long(RX.Decode, N_CUR_ALTITUDE, true); |
||
1321 | Navi.Target.Longitude = ToolBox::Data2Long(RX.Decode, N_TAR_LONGITUDE, true); |
||
1322 | Navi.Target.Latitude = ToolBox::Data2Long(RX.Decode, N_TAR_LATITUDE, true); |
||
1323 | Navi.Target.Altitude = ToolBox::Data2Long(RX.Decode, N_TAR_ALTITUDE, true); |
||
199 | KeyOz | 1324 | |
246 | KeyOz | 1325 | le_CDistance->setText(QString("%1 cm").arg(ToolBox::Data2Int(RX.Decode, N_HOME_DISTANCE))); |
1326 | le_CWPA->setText(QString("%1").arg(RX.Decode[N_WP_INDEX])); |
||
1327 | le_CWPT->setText(QString("%1").arg(RX.Decode[N_WP_NUMBER])); |
||
1328 | le_CSats->setText(QString("%1").arg(RX.Decode[N_SATS_IN_USER])); |
||
227 | KeyOz | 1329 | |
246 | KeyOz | 1330 | qwt_Rate->setValue(double(ToolBox::Data2Int(RX.Decode, N_VARIOMETER, true))); |
227 | KeyOz | 1331 | |
246 | KeyOz | 1332 | le_CTime->setText(QString("%1 sec.").arg(ToolBox::Data2Int(RX.Decode, N_FLYING_TIME))); |
227 | KeyOz | 1333 | |
246 | KeyOz | 1334 | bar_UBAT->setValue(RX.Decode[N_UBAT]); |
227 | KeyOz | 1335 | |
246 | KeyOz | 1336 | double Speed = double((ToolBox::Data2Int(RX.Decode, N_GROUND_SPEED)) / 10.0); |
227 | KeyOz | 1337 | |
1338 | if ((Speed > 4.5) && SpeedMeter->property("END") == 5) |
||
1339 | { |
||
1340 | SpeedMeter->setRange(0.0, 10.0); |
||
1341 | SpeedMeter->setScale(1, 2, 1); |
||
1342 | SpeedMeter->setProperty("END", 10); |
||
1343 | } |
||
1344 | |||
1345 | if ((Speed > 9) && SpeedMeter->property("END") == 10) |
||
1346 | { |
||
1347 | SpeedMeter->setRange(0.0, 20.0); |
||
1348 | SpeedMeter->setScale(1, 2, 2); |
||
1349 | SpeedMeter->setProperty("END", 20); |
||
1350 | } |
||
1351 | |||
1352 | SpeedMeter->setValue(Speed); |
||
1353 | |||
246 | KeyOz | 1354 | Compass->setValue(ToolBox::Data2Int(RX.Decode, N_COMAPSS_HEADING)); //(68) |
227 | KeyOz | 1355 | |
246 | KeyOz | 1356 | bar_RX->setValue(RX.Decode[N_RC_QUALITY]); |
227 | KeyOz | 1357 | |
246 | KeyOz | 1358 | int Nick = RX.Decode[N_ANGLE_NICK]; |
1359 | int Roll = RX.Decode[N_ANGLE_ROLL]; |
||
227 | KeyOz | 1360 | |
1361 | if (Roll > 128) |
||
1362 | Roll = Roll - 255; |
||
1363 | |||
1364 | if (Nick > 128) |
||
1365 | Nick = Nick - 255; |
||
1366 | |||
1367 | Attitude->setAngle(Roll); |
||
234 | KeyOz | 1368 | Attitude->setGradient(double(0.0 - (double(Nick) / 100.0))); |
227 | KeyOz | 1369 | |
199 | KeyOz | 1370 | sNaviString NaviString; |
1371 | |||
314 | KeyOz | 1372 | NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,7); |
1373 | NaviString.Latitude = ToolBox::get_Float(Navi.Current.Latitude,7); |
||
1374 | NaviString.Altitude = ToolBox::get_Float(Navi.Current.Altitude,3); |
||
199 | KeyOz | 1375 | |
306 | KeyOz | 1376 | le_CurLong->setText(NaviString.Longitude); |
1377 | le_CurLat->setText(NaviString.Latitude); |
||
199 | KeyOz | 1378 | |
306 | KeyOz | 1379 | KML_Server->store_NaviString(NaviString); |
1380 | |||
305 | KeyOz | 1381 | f_Map->add_Position(NaviString.Longitude.toDouble(), NaviString.Latitude.toDouble()); |
1382 | |||
272 | KeyOz | 1383 | if ((QMK_Server->property("Connect")) == true) |
227 | KeyOz | 1384 | { |
272 | KeyOz | 1385 | // qDebug("Send Data to Server..!!"); |
1386 | QMK_Server->NewPosition(NaviString); |
||
227 | KeyOz | 1387 | } |
199 | KeyOz | 1388 | } |
1389 | |||
272 | KeyOz | 1390 | // Kopter-Kommunikations-Bereich, Befehle senden und Daten empfangen |
1391 | //////////////////////////////////////////////////////////////////// |
||
158 | KeyOz | 1392 | |
1393 | // Neues Datenpacket empfangen -> Verarbeiten |
||
250 | KeyOz | 1394 | void MKTool::slot_newData(sRxData RX) // DONE 0.71g |
158 | KeyOz | 1395 | { |
1396 | if (LastSend.length() > 2) |
||
1397 | { |
||
1398 | } |
||
162 | KeyOz | 1399 | int HardwareID = RX.Input[1] - 'a'; |
1400 | |||
167 | KeyOz | 1401 | switch(HardwareID) |
158 | KeyOz | 1402 | { |
167 | KeyOz | 1403 | case ADDRESS_FC : |
1404 | switch(RX.Input[2]) |
||
1405 | { |
||
307 | KeyOz | 1406 | // Motor-Mixer |
1407 | case 'N' : |
||
1408 | if (ToolBox::Decode64(RX)) |
||
1409 | { |
||
313 | KeyOz | 1410 | o_Connection->stop_ReSend(); |
1411 | |||
307 | KeyOz | 1412 | if (RX.Decode[0] == VERSION_MIXER) |
1413 | { |
||
1414 | f_MotorMixer->set_MotorConfig(RX); |
||
1415 | } |
||
1416 | } |
||
1417 | break; |
||
1418 | // Motor-Mixer Schreib-Bestätigung |
||
1419 | case 'M' : |
||
1420 | if (ToolBox::Decode64(RX)) |
||
1421 | { |
||
313 | KeyOz | 1422 | o_Connection->stop_ReSend(); |
1423 | |||
307 | KeyOz | 1424 | if (RX.Decode[0] == 1) |
1425 | { |
||
1426 | lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben.")); |
||
1427 | } |
||
1428 | } |
||
1429 | break; |
||
1430 | |||
167 | KeyOz | 1431 | // Stick-Belegung der Fernsteuerung |
1432 | case 'P' : // DONE 0.71g |
||
1433 | if (ToolBox::Decode64(RX)) |
||
158 | KeyOz | 1434 | { |
167 | KeyOz | 1435 | f_Settings->pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
1436 | f_Settings->pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
||
1437 | f_Settings->pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
||
1438 | f_Settings->pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
||
1439 | f_Settings->pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 10 ,true)); |
||
1440 | f_Settings->pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
||
1441 | f_Settings->pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
||
1442 | f_Settings->pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 16,true)); |
||
1443 | } |
||
1444 | break; |
||
1445 | // Settings lesen |
||
1446 | case 'Q' : // DONE 0.71g |
||
1447 | if (ToolBox::Decode64(RX)) |
||
1448 | { |
||
313 | KeyOz | 1449 | o_Connection->stop_ReSend(); |
167 | KeyOz | 1450 | |
1451 | if (RX.Decode[1] == VERSION_SETTINGS) |
||
1452 | { |
||
1453 | int Settings_ID = RX.Decode[0]; |
||
1454 | for (int a = 0; a < MaxParameter; a++) |
||
1455 | { |
||
199 | KeyOz | 1456 | FCSettings[a] = RX.Decode[a + 2]; |
167 | KeyOz | 1457 | } |
199 | KeyOz | 1458 | f_Settings->show_FCSettings(Settings_ID, FCSettings); |
1459 | f_Settings->pb_Read->setEnabled(true); |
||
1460 | f_Settings->pb_Write->setEnabled(true); |
||
167 | KeyOz | 1461 | } |
1462 | else |
||
1463 | { |
||
1464 | f_Settings->pb_Read->setDisabled(true); |
||
1465 | f_Settings->pb_Write->setDisabled(true); |
||
1466 | |||
1467 | QMessageBox::warning(this, QA_NAME, |
||
1468 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
||
1469 | } |
||
1470 | } |
||
1471 | break; |
||
1472 | // Settings geschrieben |
||
1473 | case 'S' : // DONE 0.71g |
||
313 | KeyOz | 1474 | o_Connection->stop_ReSend(); |
167 | KeyOz | 1475 | break; |
1476 | } |
||
1477 | |||
1478 | case ADDRESS_NC : |
||
1479 | switch(RX.Input[2]) |
||
1480 | { |
||
1481 | // Navigationsdaten |
||
1482 | case 'O' : // NOT DONE 0.12h |
||
1483 | if (ToolBox::Decode64(RX)) |
||
1484 | { |
||
199 | KeyOz | 1485 | new_NaviData(RX); |
167 | KeyOz | 1486 | } |
1487 | break; |
||
1488 | } |
||
1489 | // case ADDRESS_MK3MAG : |
||
1490 | |||
1491 | default : |
||
1492 | switch(RX.Input[2]) |
||
1493 | { |
||
1494 | // LCD-Anzeige |
||
1495 | case 'L' : // DONE 0.71g |
||
1496 | if (ToolBox::Decode64(RX)) |
||
1497 | { |
||
313 | KeyOz | 1498 | o_Connection->stop_ReSend(); |
1499 | |||
159 | KeyOz | 1500 | int LCD[150]; |
1501 | memcpy(LCD,RX.Decode, sizeof(RX.Decode)); |
||
1502 | |||
227 | KeyOz | 1503 | f_LCD->show_Data(LCD); |
1504 | |||
159 | KeyOz | 1505 | LCD_Page = RX.Decode[0]; |
1506 | LCD_MAX_Page = RX.Decode[1]; |
||
158 | KeyOz | 1507 | } |
1508 | break; |
||
167 | KeyOz | 1509 | // Analoglabels |
1510 | case 'A' : // DONE 0.71g |
||
1511 | if (ToolBox::Decode64(RX)) |
||
158 | KeyOz | 1512 | { |
313 | KeyOz | 1513 | o_Connection->stop_ReSend(); |
1514 | |||
159 | KeyOz | 1515 | int Position = RX.Decode[0]; |
163 | KeyOz | 1516 | if (Position != 31) |
158 | KeyOz | 1517 | { |
162 | KeyOz | 1518 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
167 | KeyOz | 1519 | if (Settings->Analog1.Label[Position] == "") |
1520 | { |
||
1521 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
||
1522 | } |
||
158 | KeyOz | 1523 | Position ++; |
1524 | TX_Data[0] = Position; |
||
306 | KeyOz | 1525 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
158 | KeyOz | 1526 | } |
166 | KeyOz | 1527 | if (Position == 31) |
158 | KeyOz | 1528 | { |
1529 | for (int a = 0; a < MaxAnalog; a++) |
||
1530 | { |
||
162 | KeyOz | 1531 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
158 | KeyOz | 1532 | } |
163 | KeyOz | 1533 | Settings->Analog1.Version = Mode.Version; |
162 | KeyOz | 1534 | Settings->write_Settings_AnalogLabels(HardwareID); |
158 | KeyOz | 1535 | config_Plot(); |
1536 | } |
||
1537 | } |
||
1538 | break; |
||
167 | KeyOz | 1539 | // Debug-Daten |
1540 | case 'D' : // DONE 0.71g |
||
1541 | if (ToolBox::Decode64(RX)) |
||
158 | KeyOz | 1542 | { |
1543 | for (int i = 0; i < MaxAnalog; i++) |
||
1544 | { |
||
1545 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
||
1546 | } |
||
1547 | show_DebugData(); |
||
1548 | } |
||
1549 | break; |
||
167 | KeyOz | 1550 | // Version |
1551 | case 'V' : // DONE 0.71h |
||
1552 | if (ToolBox::Decode64(RX)) |
||
159 | KeyOz | 1553 | { |
313 | KeyOz | 1554 | o_Connection->stop_ReSend(); |
159 | KeyOz | 1555 | |
167 | KeyOz | 1556 | Mode.ID = HardwareID; |
1557 | Mode.VERSION_MAJOR = RX.Decode[0]; |
||
1558 | Mode.VERSION_MINOR = RX.Decode[1]; |
||
1559 | Mode.VERSION_PATCH = RX.Decode[4]; |
||
1560 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
||
1561 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
||
159 | KeyOz | 1562 | |
167 | KeyOz | 1563 | Mode.Hardware = HardwareType[Mode.ID]; |
1564 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
||
158 | KeyOz | 1565 | |
167 | KeyOz | 1566 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
158 | KeyOz | 1567 | |
167 | KeyOz | 1568 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1569 | { |
||
272 | KeyOz | 1570 | // AllowSend = false; |
167 | KeyOz | 1571 | QMessageBox::warning(this, QA_NAME, |
1572 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
||
1573 | } |
||
159 | KeyOz | 1574 | |
199 | KeyOz | 1575 | if (ac_NoDebug->isChecked()) |
1576 | { |
||
1577 | TX_Data[0] = 0; |
||
1578 | } |
||
1579 | else |
||
1580 | if (ac_FastDebug->isChecked()) |
||
1581 | { |
||
1582 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
||
1583 | } |
||
1584 | else |
||
1585 | { |
||
1586 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
||
1587 | } |
||
1588 | |||
306 | KeyOz | 1589 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
199 | KeyOz | 1590 | |
167 | KeyOz | 1591 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
1592 | if (Mode.ID == ADDRESS_MK3MAG) |
||
1593 | { |
||
1594 | TickerEvent[3] = true; |
||
199 | KeyOz | 1595 | rb_SelMag->setChecked(true); |
167 | KeyOz | 1596 | } |
158 | KeyOz | 1597 | |
199 | KeyOz | 1598 | // Wenn NaviCtrl dann hier. |
1599 | if (Mode.ID == ADDRESS_NC) |
||
1600 | { |
||
1601 | rb_SelNC->setChecked(true); |
||
158 | KeyOz | 1602 | |
199 | KeyOz | 1603 | if (ac_NoNavi->isChecked()) |
1604 | { |
||
1605 | TX_Data[0] = 0; |
||
1606 | } |
||
1607 | else |
||
1608 | if (ac_FastNavi->isChecked()) |
||
1609 | { |
||
1610 | TX_Data[0] = Settings->Data.Navi_Fast / 10; |
||
1611 | } |
||
1612 | else |
||
1613 | { |
||
1614 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
||
1615 | } |
||
1616 | |||
306 | KeyOz | 1617 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
199 | KeyOz | 1618 | } |
1619 | |||
1620 | |||
167 | KeyOz | 1621 | // Wenn FlightCtrl dann Settings abfragen. |
1622 | if (Mode.ID == ADDRESS_FC) |
||
1623 | { |
||
199 | KeyOz | 1624 | rb_SelFC->setChecked(true); |
167 | KeyOz | 1625 | { |
1626 | TX_Data[0] = 0xff; |
||
1627 | TX_Data[1] = 0; |
||
250 | KeyOz | 1628 | |
1629 | // DEP: Raus wenn Resend implementiert. |
||
1630 | ToolBox::Wait(SLEEP); |
||
306 | KeyOz | 1631 | o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true); |
250 | KeyOz | 1632 | qDebug("FC - Get Settings"); |
167 | KeyOz | 1633 | } |
1634 | } |
||
1635 | // Wenn nicht Lesen und Schreiben der Settings deaktivieren. |
||
1636 | else |
||
1637 | { |
||
1638 | f_Settings->pb_Read->setDisabled(true); |
||
1639 | f_Settings->pb_Write->setDisabled(true); |
||
1640 | } |
||
158 | KeyOz | 1641 | |
167 | KeyOz | 1642 | Settings->read_Settings_Analog(HardwareID); |
1643 | Settings->read_Settings_AnalogLabels(HardwareID); |
||
159 | KeyOz | 1644 | |
167 | KeyOz | 1645 | if (Settings->Analog1.Version != Mode.Version) |
158 | KeyOz | 1646 | { |
167 | KeyOz | 1647 | lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus."); |
1648 | slot_ac_GetLabels(); |
||
158 | KeyOz | 1649 | } |
167 | KeyOz | 1650 | else |
1651 | for (int a = 0; a < MaxAnalog; a++) |
||
1652 | { |
||
1653 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
||
1654 | } |
||
1655 | config_Plot(); |
||
158 | KeyOz | 1656 | } |
1657 | break; |
||
167 | KeyOz | 1658 | } |
158 | KeyOz | 1659 | } |
272 | KeyOz | 1660 | |
1661 | // TODO: Roh-Daten senden zum QMK-Server dazu Sendebuffer bauen. |
||
1662 | if ((QMK_Server->property("Connect")) == true) |
||
1663 | { |
||
1664 | // QMK_Server->send_RawData(RX.String); |
||
1665 | } |
||
1666 | |||
1667 | slot_showTerminal(1, RX.String); |
||
158 | KeyOz | 1668 | } |
1669 | |||
250 | KeyOz | 1670 | void MKTool::slot_showTerminal(int Typ, QString Text) |
158 | KeyOz | 1671 | { |
250 | KeyOz | 1672 | switch(Typ) |
158 | KeyOz | 1673 | { |
250 | KeyOz | 1674 | case 1 : |
158 | KeyOz | 1675 | { |
250 | KeyOz | 1676 | if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
158 | KeyOz | 1677 | { |
250 | KeyOz | 1678 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1679 | te_RX->insertHtml("<span style=\"color:#00008b;\">" + Text + "<br /></span>"); |
||
158 | KeyOz | 1680 | } |
250 | KeyOz | 1681 | } |
1682 | break; |
||
1683 | case 2 : |
||
1684 | { |
||
1685 | if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
||
158 | KeyOz | 1686 | { |
307 | KeyOz | 1687 | if (Text.length() > 0) |
1688 | { |
||
1689 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
||
1690 | te_RX->insertHtml("<span style=\"color:#008b00;\">" + Text + "</span><br />"); |
||
1691 | } |
||
158 | KeyOz | 1692 | } |
1693 | } |
||
250 | KeyOz | 1694 | break; |
1695 | case 3 : |
||
158 | KeyOz | 1696 | { |
250 | KeyOz | 1697 | if (cb_ShowSend->isChecked()) |
158 | KeyOz | 1698 | { |
250 | KeyOz | 1699 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1700 | te_RX->insertHtml("<span style='color:#8b0000;'>" + Text + "<br /></span>"); |
||
158 | KeyOz | 1701 | } |
1702 | } |
||
250 | KeyOz | 1703 | break; |
158 | KeyOz | 1704 | } |
1705 | } |
||
1706 | |||
272 | KeyOz | 1707 | // Verbindung zum Kopter herstellen / Trennen |
158 | KeyOz | 1708 | void MKTool::slot_OpenPort() |
1709 | { |
||
306 | KeyOz | 1710 | if (o_Connection->isOpen()) |
250 | KeyOz | 1711 | { |
199 | KeyOz | 1712 | TX_Data[0] = Settings->Data.Debug_Off / 10; |
306 | KeyOz | 1713 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
227 | KeyOz | 1714 | ToolBox::Wait(SLEEP); |
158 | KeyOz | 1715 | |
199 | KeyOz | 1716 | if (Mode.ID == ADDRESS_NC) |
1717 | { |
||
1718 | TX_Data[0] = Settings->Data.Navi_Off / 10; |
||
306 | KeyOz | 1719 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
227 | KeyOz | 1720 | ToolBox::Wait(SLEEP); |
199 | KeyOz | 1721 | } |
1722 | |||
272 | KeyOz | 1723 | if (Mode.ID == ADDRESS_FC) |
199 | KeyOz | 1724 | { |
1725 | TX_Data[0] = 0; |
||
1726 | TX_Data[1] = 0; |
||
1727 | TX_Data[2] = 0; |
||
1728 | TX_Data[3] = 0; |
||
306 | KeyOz | 1729 | o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false); |
227 | KeyOz | 1730 | ToolBox::Wait(SLEEP); |
199 | KeyOz | 1731 | } |
250 | KeyOz | 1732 | |
306 | KeyOz | 1733 | o_Connection->Close(); |
250 | KeyOz | 1734 | |
263 | KeyOz | 1735 | ac_ConnectTTY->setText("Kopter Verbinden"); |
199 | KeyOz | 1736 | le_Port->setEnabled(true); |
1737 | |||
167 | KeyOz | 1738 | Ticker->stop(); |
158 | KeyOz | 1739 | } |
1740 | else |
||
1741 | { |
||
263 | KeyOz | 1742 | int i_Type; |
1743 | if (le_Port->text().contains(QString("IP:"))) |
||
158 | KeyOz | 1744 | { |
263 | KeyOz | 1745 | i_Type = C_IP; |
1746 | } |
||
1747 | else |
||
1748 | { |
||
1749 | i_Type = C_TTY; |
||
1750 | } |
||
1751 | |||
306 | KeyOz | 1752 | if (o_Connection->Open(i_Type, le_Port->text())) |
263 | KeyOz | 1753 | { |
1754 | ac_ConnectTTY->setText("Kopter Trennen"); |
||
199 | KeyOz | 1755 | le_Port->setEnabled(false); |
158 | KeyOz | 1756 | |
306 | KeyOz | 1757 | o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
159 | KeyOz | 1758 | |
167 | KeyOz | 1759 | Ticker->start(2000); |
158 | KeyOz | 1760 | } |
1761 | } |
||
1762 | } |
||
1763 | |||
1764 | // Programm beenden |
||
1765 | /////////////////// |
||
162 | KeyOz | 1766 | |
1767 | MKTool::~MKTool() |
||
158 | KeyOz | 1768 | { |
306 | KeyOz | 1769 | if (o_Connection->isOpen()) |
158 | KeyOz | 1770 | { |
306 | KeyOz | 1771 | o_Connection->Close(); |
158 | KeyOz | 1772 | } |
1773 | |||
167 | KeyOz | 1774 | set_Preferences(); |
162 | KeyOz | 1775 | Settings->write_Settings(); |
158 | KeyOz | 1776 | |
239 | Brean | 1777 | logger->close(); |
158 | KeyOz | 1778 | } |