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