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