Rev 162 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 162 | Rev 163 | ||
---|---|---|---|
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 | 28 | ||
29 | #include "mktool.h" |
29 | #include "mktool.h" |
30 | #include "dlg_Config.h" |
30 | #include "dlg_Config.h" |
31 | #include "dlg_Motortest.h" |
31 | #include "dlg_Motortest.h" |
32 | #include "dlg_Preferences.h" |
32 | #include "dlg_Preferences.h" |
33 | #include "../global.h" |
33 | #include "../global.h" |
34 | #include "../ToolBox.h" |
34 | #include "../ToolBox.h" |
35 | 35 | ||
36 | #include <stdlib.h> |
36 | #include <stdlib.h> |
37 | 37 | ||
38 | MKTool::MKTool() |
38 | MKTool::MKTool() |
39 | { |
39 | { |
40 | setupUi(this); |
40 | setupUi(this); |
41 | 41 | ||
42 | Settings = new cSettings; |
42 | Settings = new cSettings; |
43 | // Settings->read_Settings(); |
43 | // Settings->read_Settings(); |
44 | // Settings->read_Settings_FC(); |
44 | // Settings->read_Settings_FC(); |
45 | 45 | ||
46 | init_Arrays(); |
46 | init_Arrays(); |
47 | init_Icons(); |
47 | init_Icons(); |
48 | init_GUI(); |
48 | init_GUI(); |
49 | 49 | ||
50 | init_Objects(); |
50 | init_Objects(); |
51 | init_Connections(); |
51 | init_Connections(); |
52 | 52 | ||
53 | init_Plot(); |
53 | init_Plot(); |
54 | 54 | ||
55 | Ticker->start(2000); |
55 | Ticker->start(2000); |
56 | } |
56 | } |
57 | 57 | ||
58 | void MKTool::init_GUI() |
58 | void MKTool::init_GUI() |
59 | { |
59 | { |
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
61 | 61 | ||
62 | #ifdef _EEEPC_ |
62 | #ifdef _EEEPC_ |
63 | toolBar->hide(); |
63 | toolBar->hide(); |
64 | #endif |
64 | #endif |
65 | 65 | ||
66 | resize(Settings->GUI.Size); |
66 | resize(Settings->GUI.Size); |
67 | move(Settings->GUI.Point); |
67 | move(Settings->GUI.Point); |
68 | 68 | ||
69 | if (Settings->GUI.isMax) |
69 | if (Settings->GUI.isMax) |
70 | { |
70 | { |
71 | showMaximized(); |
71 | showMaximized(); |
72 | } |
72 | } |
73 | 73 | ||
74 | for (int a = 0; a < MaxAnalog; a++) |
74 | for (int a = 0; a < MaxAnalog; a++) |
75 | { |
75 | { |
76 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
76 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
77 | } |
77 | } |
78 | 78 | ||
79 | for (int b = 0; b < 6; b++) |
79 | for (int b = 0; b < 6; b++) |
80 | { |
80 | { |
81 | TabWidgets[b] = tab_Main->widget(b); |
81 | TabWidgets[b] = tab_Main->widget(b); |
82 | } |
82 | } |
83 | 83 | ||
84 | for (int c = 0; c < 6; c++) |
84 | for (int c = 0; c < 6; c++) |
85 | { |
85 | { |
86 | if (Settings->GUI.TabViews[c] == false) |
86 | if (Settings->GUI.TabViews[c] == false) |
87 | { |
87 | { |
88 | QString TabName = QString("Tab_%1").arg(c); |
88 | QString TabName = QString("Tab_%1").arg(c); |
89 | 89 | ||
90 | for (int d = 0; d < tab_Main->count(); d++) |
90 | for (int d = 0; d < tab_Main->count(); d++) |
91 | { |
91 | { |
92 | if (tab_Main->widget(d)->objectName() == TabName) |
92 | if (tab_Main->widget(d)->objectName() == TabName) |
93 | { |
93 | { |
94 | tab_Main->removeTab(d); |
94 | tab_Main->removeTab(d); |
95 | } |
95 | } |
96 | } |
96 | } |
97 | } |
97 | } |
98 | } |
98 | } |
99 | 99 | ||
100 | ac_View0->setChecked(Settings->GUI.TabViews[0]); |
100 | ac_View0->setChecked(Settings->GUI.TabViews[0]); |
101 | ac_View1->setChecked(Settings->GUI.TabViews[1]); |
101 | ac_View1->setChecked(Settings->GUI.TabViews[1]); |
102 | ac_View2->setChecked(Settings->GUI.TabViews[2]); |
102 | ac_View2->setChecked(Settings->GUI.TabViews[2]); |
103 | ac_View3->setChecked(Settings->GUI.TabViews[3]); |
103 | ac_View3->setChecked(Settings->GUI.TabViews[3]); |
104 | ac_View4->setChecked(Settings->GUI.TabViews[4]); |
104 | ac_View4->setChecked(Settings->GUI.TabViews[4]); |
105 | ac_View5->setChecked(Settings->GUI.TabViews[5]); |
105 | ac_View5->setChecked(Settings->GUI.TabViews[5]); |
106 | 106 | ||
107 | le_Port->setText(Settings->TTY.Port); |
107 | le_Port->setText(Settings->TTY.Port); |
108 | 108 | ||
109 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
109 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
110 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
110 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
111 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
111 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
112 | } |
112 | } |
113 | 113 | ||
114 | void MKTool::init_Objects() |
114 | void MKTool::init_Objects() |
115 | { |
115 | { |
116 | // QTimer-Instanzen |
116 | // QTimer-Instanzen |
117 | Ticker = new QTimer(this); |
117 | Ticker = new QTimer(this); |
118 | 118 | ||
119 | // Seriell-Port |
119 | // Seriell-Port |
120 | serialPort = new ManageSerialPort; |
120 | serialPort = new ManageSerialPort; |
121 | 121 | ||
122 | // QFile-Instanz (Log-Datei) |
122 | // QFile-Instanz (Log-Datei) |
123 | CSVFile = new QFile(""); |
123 | CSVFile = new QFile(""); |
124 | 124 | ||
125 | AllowSend = true; |
125 | AllowSend = true; |
126 | } |
126 | } |
127 | 127 | ||
128 | void MKTool::init_Connections() |
128 | void MKTool::init_Connections() |
129 | { |
129 | { |
130 | // Seriel-Port Empfang |
130 | // Seriel-Port Empfang |
131 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
131 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
132 | 132 | ||
133 | // Buttons und Menüpunkte / Toolbar |
133 | // Buttons und Menüpunkte / Toolbar |
134 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
134 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
135 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
135 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
136 | connect(pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
136 | connect(pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
137 | connect(pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
137 | connect(pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
138 | 138 | ||
139 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
139 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
140 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
140 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
141 | 141 | ||
142 | // Actions |
142 | // Actions |
143 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
143 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
144 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
144 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
145 | 145 | ||
146 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
146 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
147 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
147 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
148 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
148 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
149 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
149 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
150 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
150 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
151 | 151 | ||
152 | // Tabs ein & ausblenden |
152 | // Tabs ein & ausblenden |
153 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
153 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
154 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
154 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
155 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
155 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
156 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
156 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
157 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
157 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
158 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
158 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
159 | 159 | ||
160 | // connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
160 | // connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
161 | 161 | ||
162 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
162 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
163 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
163 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
164 | - | ||
165 | connect(ac_LogDir, SIGNAL(triggered()), this, SLOT(slot_SetLogDir())); |
- | |
166 | connect(ac_ParameterDir, SIGNAL(triggered()), this, SLOT(slot_SetParDir())); |
- | |
167 | 164 | ||
168 | // Timer-Events |
165 | // Timer-Events |
169 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
166 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
170 | 167 | ||
171 | // Seitenwechsel :) |
168 | // Seitenwechsel :) |
172 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
169 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
173 | connect(tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
170 | connect(tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
174 | 171 | ||
175 | // Parameterevents |
172 | // Parameterevents |
176 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
173 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
177 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
174 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
178 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
175 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
179 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
176 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
180 | 177 | ||
181 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
178 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
182 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
179 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
183 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
180 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
184 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
181 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
185 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
182 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
186 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
183 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
187 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
184 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
188 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
185 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
189 | 186 | ||
190 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
187 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
191 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
188 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
192 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
189 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
193 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
190 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
194 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
191 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
195 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
192 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
196 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
193 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
197 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
194 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
198 | 195 | ||
199 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
196 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
200 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
197 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
201 | 198 | ||
202 | // Plotter |
199 | // Plotter |
203 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
200 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
204 | 201 | ||
205 | // About-QT Dialog einfügen |
202 | // About-QT Dialog einfügen |
206 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
203 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
207 | } |
204 | } |
208 | 205 | ||
209 | void MKTool::init_Arrays() |
206 | void MKTool::init_Arrays() |
210 | { |
207 | { |
211 | lb_Analog[0] = lb_A_0; |
208 | lb_Analog[0] = lb_A_0; |
212 | lb_Analog[1] = lb_A_1; |
209 | lb_Analog[1] = lb_A_1; |
213 | lb_Analog[2] = lb_A_2; |
210 | lb_Analog[2] = lb_A_2; |
214 | lb_Analog[3] = lb_A_3; |
211 | lb_Analog[3] = lb_A_3; |
215 | lb_Analog[4] = lb_A_4; |
212 | lb_Analog[4] = lb_A_4; |
216 | lb_Analog[5] = lb_A_5; |
213 | lb_Analog[5] = lb_A_5; |
217 | lb_Analog[6] = lb_A_6; |
214 | lb_Analog[6] = lb_A_6; |
218 | lb_Analog[7] = lb_A_7; |
215 | lb_Analog[7] = lb_A_7; |
219 | lb_Analog[8] = lb_A_8; |
216 | lb_Analog[8] = lb_A_8; |
220 | lb_Analog[9] = lb_A_9; |
217 | lb_Analog[9] = lb_A_9; |
221 | lb_Analog[10] = lb_A_10; |
218 | lb_Analog[10] = lb_A_10; |
222 | lb_Analog[11] = lb_A_11; |
219 | lb_Analog[11] = lb_A_11; |
223 | lb_Analog[12] = lb_A_12; |
220 | lb_Analog[12] = lb_A_12; |
224 | lb_Analog[13] = lb_A_13; |
221 | lb_Analog[13] = lb_A_13; |
225 | lb_Analog[14] = lb_A_14; |
222 | lb_Analog[14] = lb_A_14; |
226 | lb_Analog[15] = lb_A_15; |
223 | lb_Analog[15] = lb_A_15; |
227 | lb_Analog[16] = lb_A_16; |
224 | lb_Analog[16] = lb_A_16; |
228 | lb_Analog[17] = lb_A_17; |
225 | lb_Analog[17] = lb_A_17; |
229 | lb_Analog[18] = lb_A_18; |
226 | lb_Analog[18] = lb_A_18; |
230 | lb_Analog[19] = lb_A_19; |
227 | lb_Analog[19] = lb_A_19; |
231 | lb_Analog[20] = lb_A_20; |
228 | lb_Analog[20] = lb_A_20; |
232 | lb_Analog[21] = lb_A_21; |
229 | lb_Analog[21] = lb_A_21; |
233 | lb_Analog[22] = lb_A_22; |
230 | lb_Analog[22] = lb_A_22; |
234 | lb_Analog[23] = lb_A_23; |
231 | lb_Analog[23] = lb_A_23; |
235 | lb_Analog[24] = lb_A_24; |
232 | lb_Analog[24] = lb_A_24; |
236 | lb_Analog[25] = lb_A_25; |
233 | lb_Analog[25] = lb_A_25; |
237 | lb_Analog[26] = lb_A_26; |
234 | lb_Analog[26] = lb_A_26; |
238 | lb_Analog[27] = lb_A_27; |
235 | lb_Analog[27] = lb_A_27; |
239 | lb_Analog[28] = lb_A_28; |
236 | lb_Analog[28] = lb_A_28; |
240 | lb_Analog[29] = lb_A_29; |
237 | lb_Analog[29] = lb_A_29; |
241 | lb_Analog[30] = lb_A_30; |
238 | lb_Analog[30] = lb_A_30; |
242 | lb_Analog[31] = lb_A_31; |
239 | lb_Analog[31] = lb_A_31; |
243 | } |
240 | } |
244 | 241 | ||
245 | void MKTool::init_Plot() |
242 | void MKTool::init_Plot() |
246 | { |
243 | { |
247 | NextPlot = 0; |
244 | NextPlot = 0; |
248 | 245 | ||
249 | qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000))); |
246 | qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000))); |
250 | 247 | ||
251 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
248 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
252 | 249 | ||
253 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
250 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
254 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
251 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
255 | 252 | ||
256 | 253 | ||
257 | Grid->attach(qwtPlot); |
254 | Grid->attach(qwtPlot); |
258 | 255 | ||
259 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,PlotWide,0); |
256 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,PlotWide,0); |
260 | 257 | ||
261 | for (int a = 0; a < MaxAnalog; a++) |
258 | for (int a = 0; a < MaxAnalog; a++) |
262 | { |
259 | { |
263 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
260 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
264 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
261 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
265 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
262 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
266 | 263 | ||
267 | if (Settings->Analog1.PlotView[a]) |
264 | if (Settings->Analog1.PlotView[a]) |
268 | Plot[a]->attach(qwtPlot); |
265 | Plot[a]->attach(qwtPlot); |
269 | } |
266 | } |
270 | qwtPlot->replot(); |
267 | qwtPlot->replot(); |
271 | } |
268 | } |
272 | 269 | ||
273 | void MKTool::init_Icons() |
270 | void MKTool::init_Icons() |
274 | { |
271 | { |
275 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
272 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
276 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
273 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
277 | Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
274 | Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
278 | Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
275 | Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
279 | 276 | ||
280 | Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
277 | Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
281 | Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
278 | Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
282 | Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
279 | Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
283 | Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
280 | Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
284 | Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
281 | Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
285 | Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
282 | Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
286 | 283 | ||
287 | Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
284 | Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
288 | Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
285 | Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
289 | Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
286 | Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
290 | Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
287 | Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
291 | Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
288 | Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
292 | Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
289 | Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
293 | Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
290 | Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
294 | Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
291 | Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
295 | } |
292 | } |
296 | 293 | ||
297 | 294 | ||
298 | // Ticker-Event |
295 | // Ticker-Event |
299 | /////////////// |
296 | /////////////// |
300 | void MKTool::slot_Ticker() |
297 | void MKTool::slot_Ticker() |
301 | { |
298 | { |
302 | if (TickerDiv) |
299 | if (TickerDiv) |
303 | TickerDiv = false; |
300 | TickerDiv = false; |
304 | else |
301 | else |
305 | TickerDiv = true; |
302 | TickerDiv = true; |
306 | 303 | ||
307 | for (int a = 0; a < MaxTickerEvents; a++) |
304 | for (int a = 0; a < MaxTickerEvents; a++) |
308 | { |
305 | { |
309 | if (TickerEvent[a] == true) |
306 | if (TickerEvent[a] == true) |
310 | { |
307 | { |
311 | switch(a) |
308 | switch(a) |
312 | { |
309 | { |
313 | case 0 : |
310 | case 0 : |
314 | if (TickerDiv) |
311 | if (TickerDiv) |
315 | { |
312 | { |
316 | QByteArray Temp(LastSend.toUtf8()); |
313 | QByteArray Temp(LastSend.toUtf8()); |
317 | serialPort->sendData(Temp); |
314 | serialPort->sendData(Temp); |
318 | } |
315 | } |
319 | break; |
316 | break; |
320 | case 1 : |
317 | case 1 : |
321 | TX_Data[0] = 0; |
318 | TX_Data[0] = 0; |
322 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
319 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
323 | break; |
320 | break; |
324 | case 2 : |
321 | case 2 : |
325 | TX_Data[0] = LCD_Page; |
322 | TX_Data[0] = LCD_Page; |
326 | TX_Data[1] = 0; |
323 | TX_Data[1] = 0; |
327 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
324 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
328 | break; |
325 | break; |
329 | } |
326 | } |
330 | } |
327 | } |
331 | } |
328 | } |
332 | } |
329 | } |
333 | 330 | ||
334 | 331 | ||
335 | // Slots der Actions (Menüpunkte, Buttons) |
332 | // Slots der Actions (Menüpunkte, Buttons) |
336 | ////////////////////////////////////////// |
333 | ////////////////////////////////////////// |
337 | void MKTool::slot_ac_Motortest() |
334 | void MKTool::slot_ac_Motortest() |
338 | { |
335 | { |
339 | dlg_Motortest *f_Motortest = new dlg_Motortest(this); |
336 | dlg_Motortest *f_Motortest = new dlg_Motortest(this); |
340 | 337 | ||
341 | connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int))); |
338 | connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int))); |
342 | 339 | ||
343 | if (f_Motortest->exec()==QDialog::Accepted) |
340 | if (f_Motortest->exec()==QDialog::Accepted) |
344 | { |
341 | { |
345 | } |
342 | } |
346 | 343 | ||
347 | disconnect(f_Motortest, 0,0,0); |
344 | disconnect(f_Motortest, 0,0,0); |
348 | slot_Motortest(0,0,0,0); |
345 | slot_Motortest(0,0,0,0); |
349 | } |
346 | } |
350 | 347 | ||
351 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
348 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
352 | { |
349 | { |
353 | TX_Data[0] = Motor1; |
350 | TX_Data[0] = Motor1; |
354 | TX_Data[1] = Motor2; |
351 | TX_Data[1] = Motor2; |
355 | TX_Data[2] = Motor3; |
352 | TX_Data[2] = Motor3; |
356 | TX_Data[3] = Motor4; |
353 | TX_Data[3] = Motor4; |
357 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
354 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
358 | } |
355 | } |
359 | 356 | ||
360 | void MKTool::slot_ac_Config() |
357 | void MKTool::slot_ac_Config() |
361 | { |
358 | { |
362 | set_Analog Old_Analog1; |
359 | set_Analog Old_Analog1; |
363 | 360 | ||
364 | Old_Analog1 = Settings->Analog1; |
361 | Old_Analog1 = Settings->Analog1; |
365 | 362 | ||
366 | dlg_Config *f_Config = new dlg_Config(this); |
363 | dlg_Config *f_Config = new dlg_Config(this); |
367 | f_Config->set_Settings(Settings, Mode.ID); |
364 | f_Config->set_Settings(Settings, Mode.ID); |
368 | 365 | ||
369 | if (f_Config->exec()==QDialog::Accepted) |
366 | if (f_Config->exec()==QDialog::Accepted) |
370 | { |
367 | { |
371 | Settings = f_Config->get_Settings(); |
368 | Settings = f_Config->get_Settings(); |
372 | Settings->write_Settings_Analog(Mode.ID); |
369 | Settings->write_Settings_Analog(Mode.ID); |
373 | 370 | ||
- | 371 | // Plotter neu einrichten |
|
374 | for (int a = 0; a < MaxAnalog; a++) |
372 | if (Old_Analog1.PlotView != Settings->Analog1.PlotView) |
375 | { |
- | |
376 | if (Old_Analog1.PlotView[a] == Settings->Analog1.PlotView[a]) |
- | |
377 | continue; |
- | |
378 | else |
- | |
379 | { |
373 | { |
380 | config_Plot(); |
- | |
381 | break; |
- | |
382 | } |
374 | config_Plot(); |
383 | } |
375 | } |
- | 376 | ||
384 | 377 | // CVS-Datei neu anlegen. |
|
385 | if (CSVFile->isOpen()) |
- | |
386 | { |
- | |
387 | for (int a = 0; a < MaxAnalog; a++) |
- | |
388 | { |
- | |
389 | if (Old_Analog1.LogView[a] == Settings->Analog1.LogView[a]) |
- | |
390 | continue; |
- | |
391 | else |
378 | if ((CSVFile->isOpen()) && (Old_Analog1.LogView != Settings->Analog1.LogView)) |
392 | { |
379 | { |
393 | slot_RecordCSV(); |
- | |
394 | slot_RecordCSV(); |
- | |
395 | break; |
- | |
396 | } |
380 | slot_RecordCSV(); |
397 | } |
381 | slot_RecordCSV(); |
398 | } |
382 | } |
399 | 383 | ||
400 | } |
384 | } |
401 | } |
385 | } |
402 | 386 | ||
403 | void MKTool::slot_ac_Preferences() |
387 | void MKTool::slot_ac_Preferences() |
404 | { |
388 | { |
405 | dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
389 | dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
- | 390 | ||
- | 391 | f_Preferences->set_Settings(Settings); |
|
406 | 392 | ||
407 | if (f_Preferences->exec()==QDialog::Accepted) |
393 | if (f_Preferences->exec()==QDialog::Accepted) |
408 | { |
- | |
- | 394 | { |
|
- | 395 | Settings = f_Preferences->get_Settings(); |
|
409 | 396 | Settings->write_Settings(); |
|
410 | } |
397 | } |
411 | } |
398 | } |
412 | 399 | ||
413 | void MKTool::slot_ac_StartPlotter() |
400 | void MKTool::slot_ac_StartPlotter() |
414 | { |
401 | { |
415 | if (ac_StartPlotter->isChecked()) |
402 | if (ac_StartPlotter->isChecked()) |
416 | { |
403 | { |
417 | ac_StartPlotter->setText("Stop Plotter"); |
404 | ac_StartPlotter->setText("Stop Plotter"); |
418 | pb_StartPlotter->setText("Stop Plotter"); |
405 | pb_StartPlotter->setText("Stop Plotter"); |
419 | } |
406 | } |
420 | else |
407 | else |
421 | { |
408 | { |
422 | ac_StartPlotter->setText("Start Plotter"); |
409 | ac_StartPlotter->setText("Start Plotter"); |
423 | pb_StartPlotter->setText("Start Plotter"); |
410 | pb_StartPlotter->setText("Start Plotter"); |
424 | } |
411 | } |
425 | } |
412 | } |
426 | 413 | ||
427 | void MKTool::slot_ac_View() |
414 | void MKTool::slot_ac_View() |
428 | { |
415 | { |
429 | int Aktive; |
416 | int Aktive; |
430 | 417 | ||
431 | QAction *Action = (QAction*)sender(); |
418 | QAction *Action = (QAction*)sender(); |
432 | 419 | ||
433 | if (Action->objectName() == QString("ac_View0")) |
420 | if (Action->objectName() == QString("ac_View0")) |
434 | Aktive = 0; |
421 | Aktive = 0; |
435 | if (Action->objectName() == QString("ac_View1")) |
422 | if (Action->objectName() == QString("ac_View1")) |
436 | Aktive = 1; |
423 | Aktive = 1; |
437 | if (Action->objectName() == QString("ac_View2")) |
424 | if (Action->objectName() == QString("ac_View2")) |
438 | Aktive = 2; |
425 | Aktive = 2; |
439 | if (Action->objectName() == QString("ac_View3")) |
426 | if (Action->objectName() == QString("ac_View3")) |
440 | Aktive = 3; |
427 | Aktive = 3; |
441 | if (Action->objectName() == QString("ac_View4")) |
428 | if (Action->objectName() == QString("ac_View4")) |
442 | Aktive = 4; |
429 | Aktive = 4; |
443 | if (Action->objectName() == QString("ac_View5")) |
430 | if (Action->objectName() == QString("ac_View5")) |
444 | Aktive = 5; |
431 | Aktive = 5; |
445 | 432 | ||
446 | QString TabName = QString("Tab_%1").arg(Aktive); |
433 | QString TabName = QString("Tab_%1").arg(Aktive); |
447 | 434 | ||
448 | if (!Action->isChecked()) |
435 | if (!Action->isChecked()) |
449 | { |
436 | { |
450 | for (int a = 0; a < tab_Main->count(); a++) |
437 | for (int a = 0; a < tab_Main->count(); a++) |
451 | { |
438 | { |
452 | if (tab_Main->widget(a)->objectName() == TabName) |
439 | if (tab_Main->widget(a)->objectName() == TabName) |
453 | { |
440 | { |
454 | tab_Main->removeTab(a); |
441 | tab_Main->removeTab(a); |
455 | } |
442 | } |
456 | } |
443 | } |
457 | 444 | ||
458 | // Action->setChecked(false); |
445 | // Action->setChecked(false); |
459 | } |
446 | } |
460 | else |
447 | else |
461 | { |
448 | { |
462 | // Action->setChecked(true); |
449 | // Action->setChecked(true); |
463 | tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->text()); |
450 | tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->text()); |
464 | } |
451 | } |
465 | } |
452 | } |
466 | 453 | ||
467 | void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
454 | void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
468 | { |
455 | { |
469 | if (ac_MehrDaten->isChecked()) |
456 | if (ac_MehrDaten->isChecked()) |
470 | { |
457 | { |
471 | TX_Data[0] = 10; |
458 | TX_Data[0] = 10; |
472 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
459 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
473 | else |
460 | else |
474 | { |
461 | { |
475 | TX_Data[0] = 50; |
462 | TX_Data[0] = 50; |
476 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
463 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
477 | } |
464 | } |
478 | 465 | ||
479 | void MKTool::slot_ac_About() |
466 | void MKTool::slot_ac_About() |
480 | { |
467 | { |
481 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
468 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
482 | } |
469 | } |
483 | 470 | ||
484 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
471 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
485 | { |
472 | { |
486 | TX_Data[0] = 0; |
473 | TX_Data[0] = 0; |
487 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
474 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
488 | } |
475 | } |
489 | 476 | ||
490 | 477 | ||
491 | // Daten-Plotter |
478 | // Daten-Plotter |
492 | ///////////////// |
479 | ///////////////// |
493 | void MKTool::update_Plot() |
480 | void MKTool::update_Plot() |
494 | { |
481 | { |
495 | for (int a = 0; a < MaxAnalog; a++) |
482 | for (int a = 0; a < MaxAnalog; a++) |
496 | { |
483 | { |
497 | Plot[a]->setData(aID,aData[a],NextPlot - 1); |
484 | Plot[a]->setData(aID,aData[a],NextPlot - 1); |
498 | } |
485 | } |
499 | 486 | ||
500 | if ((NextPlot > PlotWide)) |
487 | if ((NextPlot > PlotWide)) |
501 | { |
488 | { |
502 | scroll_plot->setMaximum(NextPlot - PlotWide); |
489 | scroll_plot->setMaximum(NextPlot - PlotWide); |
503 | } |
490 | } |
504 | 491 | ||
505 | if ((scroll_plot->value() == NextPlot - (PlotWide + 1))) |
492 | if ((scroll_plot->value() == NextPlot - (PlotWide + 1))) |
506 | { |
493 | { |
507 | qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - PlotWide,NextPlot,0); |
494 | qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - PlotWide,NextPlot,0); |
508 | scroll_plot->setValue(NextPlot - PlotWide); |
495 | scroll_plot->setValue(NextPlot - PlotWide); |
509 | } |
496 | } |
510 | 497 | ||
511 | qwtPlot->replot(); |
498 | qwtPlot->replot(); |
512 | } |
499 | } |
513 | 500 | ||
514 | void MKTool::config_Plot() |
501 | void MKTool::config_Plot() |
515 | { |
502 | { |
516 | for (int a = 0; a < MaxAnalog; a++) |
503 | for (int a = 0; a < MaxAnalog; a++) |
517 | { |
504 | { |
518 | Plot[a]->detach(); |
505 | Plot[a]->detach(); |
519 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
506 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
520 | 507 | ||
521 | if (Settings->Analog1.PlotView[a]) |
508 | if (Settings->Analog1.PlotView[a]) |
522 | { |
509 | { |
523 | Plot[a]->setTitle(Settings->Analog1.Label[a]); |
510 | Plot[a]->setTitle(Settings->Analog1.Label[a]); |
524 | Plot[a]->attach(qwtPlot); |
511 | Plot[a]->attach(qwtPlot); |
525 | } |
512 | } |
526 | } |
513 | } |
527 | } |
514 | } |
528 | 515 | ||
529 | void MKTool::slot_ScrollPlot(int Pos) |
516 | void MKTool::slot_ScrollPlot(int Pos) |
530 | { |
517 | { |
531 | qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + PlotWide,0); |
518 | qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + PlotWide,0); |
532 | qwtPlot->replot(); |
519 | qwtPlot->replot(); |
533 | } |
520 | } |
534 | 521 | ||
535 | 522 | ||
536 | // Firmeware-Update |
523 | // Firmeware-Update |
537 | /////////////////// |
524 | /////////////////// |
538 | void MKTool::slot_pb_Update() |
525 | void MKTool::slot_pb_Update() |
539 | { |
526 | { |
540 | qDebug("Update"); |
527 | qDebug("Update"); |
541 | 528 | ||
542 | if (serialPort->isOpen()) |
529 | if (serialPort->isOpen()) |
543 | { |
530 | { |
544 | slot_OpenPort(); |
531 | slot_OpenPort(); |
545 | } |
532 | } |
546 | 533 | ||
547 | Update = new QProcess(); |
534 | Update = new QProcess(); |
548 | 535 | ||
549 | const QString Programm = "avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:Flight-Ctrl_MEGA644_V0_71f.hex"; |
536 | const QString Programm = "avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:Flight-Ctrl_MEGA644_V0_71f.hex"; |
550 | const QStringList Argumente = (QStringList() << "-?"); |
537 | const QStringList Argumente = (QStringList() << "-?"); |
551 | 538 | ||
552 | te_Shell->setText(""); // Ausgabefenster säubern |
539 | te_Shell->setText(""); // Ausgabefenster säubern |
553 | Update->start(Programm); // Programmaufruf |
540 | Update->start(Programm); // Programmaufruf |
554 | // Update.waitForFinished(); // auf Rückmeldung warten |
541 | // Update.waitForFinished(); // auf Rückmeldung warten |
555 | // Update.close(); // Kanal schließen |
542 | // Update.close(); // Kanal schließen |
556 | connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
543 | connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
557 | } |
544 | } |
558 | 545 | ||
559 | void MKTool::slot_UpdateShell() |
546 | void MKTool::slot_UpdateShell() |
560 | { |
547 | { |
561 | QByteArray Output; |
548 | QByteArray Output; |
562 | // te_Shell->setText(""); // Ausgabefenster säubern |
549 | // te_Shell->setText(""); // Ausgabefenster säubern |
563 | Output = Update->readAllStandardOutput(); // Shellausgabe an Variable |
550 | Output = Update->readAllStandardOutput(); // Shellausgabe an Variable |
564 | 551 | ||
565 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
552 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
566 | te_Shell->insertPlainText(QString::fromUtf8(Output)); |
553 | te_Shell->insertPlainText(QString::fromUtf8(Output)); |
567 | 554 | ||
568 | te_Shell->setText(QString::fromUtf8(Output)); // ...und endlich: Ausgabe im QLabel |
555 | te_Shell->setText(QString::fromUtf8(Output)); // ...und endlich: Ausgabe im QLabel |
569 | qDebug("Shell"); |
556 | qDebug("Shell"); |
570 | } |
557 | } |
571 | - | ||
572 | // Configuration -> Verzeichnisse |
- | |
573 | ///////////////////////////////// |
- | |
574 | void MKTool::slot_SetLogDir() |
- | |
575 | { |
- | |
576 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für CSV-Logdateien", Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
- | |
577 | - | ||
578 | if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory)) |
- | |
579 | { |
- | |
580 | Settings->DIR.Logging = directory; |
- | |
581 | Settings->write_Settings(); |
- | |
582 | } |
- | |
583 | } |
- | |
584 | - | ||
585 | void MKTool::slot_SetParDir() |
- | |
586 | { |
- | |
587 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für Parameter-Dateien", Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
- | |
588 | - | ||
589 | if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory)) |
- | |
590 | { |
- | |
591 | Settings->DIR.Parameter = directory; |
- | |
592 | Settings->write_Settings(); |
- | |
593 | } |
- | |
594 | - | ||
595 | } |
- | |
596 | 558 | ||
597 | 559 | ||
598 | // Settings-Bereich |
560 | // Settings-Bereich |
599 | /////////////////// |
561 | /////////////////// |
600 | 562 | ||
601 | void MKTool::slot_LEDtoValue() |
563 | void MKTool::slot_LEDtoValue() |
602 | { |
564 | { |
603 | QToolButton *ToolButton = (QToolButton*)sender(); |
565 | QToolButton *ToolButton = (QToolButton*)sender(); |
604 | if (ToolButton->text() == QString("0")) |
566 | if (ToolButton->text() == QString("0")) |
605 | { |
567 | { |
606 | set_LED(ToolButton, true); |
568 | set_LED(ToolButton, true); |
607 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
569 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
608 | } |
570 | } |
609 | else if (ToolButton->text() == QString("1")) |
571 | else if (ToolButton->text() == QString("1")) |
610 | { |
572 | { |
611 | set_LED(ToolButton); |
573 | set_LED(ToolButton); |
612 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
574 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
613 | } |
575 | } |
614 | else if (ToolButton->text() == QString("00")) |
576 | else if (ToolButton->text() == QString("00")) |
615 | { |
577 | { |
616 | set_LED(ToolButton, true); |
578 | set_LED(ToolButton, true); |
617 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
579 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
618 | } |
580 | } |
619 | else if (ToolButton->text() == QString("11")) |
581 | else if (ToolButton->text() == QString("11")) |
620 | { |
582 | { |
621 | set_LED(ToolButton); |
583 | set_LED(ToolButton); |
622 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
584 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
623 | } |
585 | } |
624 | } |
586 | } |
625 | 587 | ||
626 | void MKTool::slot_ValuetoLED16(int Wert) |
588 | void MKTool::slot_ValuetoLED16(int Wert) |
627 | { |
589 | { |
628 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
590 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
629 | 591 | ||
630 | // int Wert = SpinBox->value(); |
592 | // int Wert = SpinBox->value(); |
631 | 593 | ||
632 | set_LED(J16_0); |
594 | set_LED(J16_0); |
633 | set_LED(J16_1); |
595 | set_LED(J16_1); |
634 | set_LED(J16_2); |
596 | set_LED(J16_2); |
635 | set_LED(J16_3); |
597 | set_LED(J16_3); |
636 | set_LED(J16_4); |
598 | set_LED(J16_4); |
637 | set_LED(J16_5); |
599 | set_LED(J16_5); |
638 | set_LED(J16_6); |
600 | set_LED(J16_6); |
639 | set_LED(J16_7); |
601 | set_LED(J16_7); |
640 | 602 | ||
641 | for (int a = 0; a < 8; a++) |
603 | for (int a = 0; a < 8; a++) |
642 | { |
604 | { |
643 | if (Wert > 127) |
605 | if (Wert > 127) |
644 | { |
606 | { |
645 | set_LED(J16_0, true); |
607 | set_LED(J16_0, true); |
646 | Wert = Wert - 128; |
608 | Wert = Wert - 128; |
647 | } |
609 | } |
648 | if (Wert > 63) |
610 | if (Wert > 63) |
649 | { |
611 | { |
650 | set_LED(J16_1, true); |
612 | set_LED(J16_1, true); |
651 | Wert = Wert - 64; |
613 | Wert = Wert - 64; |
652 | } |
614 | } |
653 | if (Wert > 31) |
615 | if (Wert > 31) |
654 | { |
616 | { |
655 | set_LED(J16_2, true); |
617 | set_LED(J16_2, true); |
656 | Wert = Wert - 32; |
618 | Wert = Wert - 32; |
657 | } |
619 | } |
658 | if (Wert > 15) |
620 | if (Wert > 15) |
659 | { |
621 | { |
660 | set_LED(J16_3, true); |
622 | set_LED(J16_3, true); |
661 | Wert = Wert - 16; |
623 | Wert = Wert - 16; |
662 | } |
624 | } |
663 | if (Wert > 7) |
625 | if (Wert > 7) |
664 | { |
626 | { |
665 | set_LED(J16_4, true); |
627 | set_LED(J16_4, true); |
666 | Wert = Wert - 8; |
628 | Wert = Wert - 8; |
667 | } |
629 | } |
668 | if (Wert > 3) |
630 | if (Wert > 3) |
669 | { |
631 | { |
670 | set_LED(J16_5, true); |
632 | set_LED(J16_5, true); |
671 | Wert = Wert - 4; |
633 | Wert = Wert - 4; |
672 | } |
634 | } |
673 | if (Wert > 1) |
635 | if (Wert > 1) |
674 | { |
636 | { |
675 | set_LED(J16_6, true); |
637 | set_LED(J16_6, true); |
676 | Wert = Wert - 2; |
638 | Wert = Wert - 2; |
677 | } |
639 | } |
678 | if (Wert > 0) |
640 | if (Wert > 0) |
679 | { |
641 | { |
680 | set_LED(J16_7, true); |
642 | set_LED(J16_7, true); |
681 | Wert = Wert - 1; |
643 | Wert = Wert - 1; |
682 | } |
644 | } |
683 | } |
645 | } |
684 | } |
646 | } |
685 | 647 | ||
686 | void MKTool::slot_ValuetoLED17(int Wert) |
648 | void MKTool::slot_ValuetoLED17(int Wert) |
687 | { |
649 | { |
688 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
650 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
689 | 651 | ||
690 | // int Wert = SpinBox->value(); |
652 | // int Wert = SpinBox->value(); |
691 | 653 | ||
692 | set_LED(J17_0); |
654 | set_LED(J17_0); |
693 | set_LED(J17_1); |
655 | set_LED(J17_1); |
694 | set_LED(J17_2); |
656 | set_LED(J17_2); |
695 | set_LED(J17_3); |
657 | set_LED(J17_3); |
696 | set_LED(J17_4); |
658 | set_LED(J17_4); |
697 | set_LED(J17_5); |
659 | set_LED(J17_5); |
698 | set_LED(J17_6); |
660 | set_LED(J17_6); |
699 | set_LED(J17_7); |
661 | set_LED(J17_7); |
700 | 662 | ||
701 | for (int a = 0; a < 8; a++) |
663 | for (int a = 0; a < 8; a++) |
702 | { |
664 | { |
703 | if (Wert > 127) |
665 | if (Wert > 127) |
704 | { |
666 | { |
705 | set_LED(J17_0, true); |
667 | set_LED(J17_0, true); |
706 | Wert = Wert - 128; |
668 | Wert = Wert - 128; |
707 | } |
669 | } |
708 | if (Wert > 63) |
670 | if (Wert > 63) |
709 | { |
671 | { |
710 | set_LED(J17_1, true); |
672 | set_LED(J17_1, true); |
711 | Wert = Wert - 64; |
673 | Wert = Wert - 64; |
712 | } |
674 | } |
713 | if (Wert > 31) |
675 | if (Wert > 31) |
714 | { |
676 | { |
715 | set_LED(J17_2, true); |
677 | set_LED(J17_2, true); |
716 | Wert = Wert - 32; |
678 | Wert = Wert - 32; |
717 | } |
679 | } |
718 | if (Wert > 15) |
680 | if (Wert > 15) |
719 | { |
681 | { |
720 | set_LED(J17_3, true); |
682 | set_LED(J17_3, true); |
721 | Wert = Wert - 16; |
683 | Wert = Wert - 16; |
722 | } |
684 | } |
723 | if (Wert > 7) |
685 | if (Wert > 7) |
724 | { |
686 | { |
725 | set_LED(J17_4, true); |
687 | set_LED(J17_4, true); |
726 | Wert = Wert - 8; |
688 | Wert = Wert - 8; |
727 | } |
689 | } |
728 | if (Wert > 3) |
690 | if (Wert > 3) |
729 | { |
691 | { |
730 | set_LED(J17_5, true); |
692 | set_LED(J17_5, true); |
731 | Wert = Wert - 4; |
693 | Wert = Wert - 4; |
732 | } |
694 | } |
733 | if (Wert > 1) |
695 | if (Wert > 1) |
734 | { |
696 | { |
735 | set_LED(J17_6, true); |
697 | set_LED(J17_6, true); |
736 | Wert = Wert - 2; |
698 | Wert = Wert - 2; |
737 | } |
699 | } |
738 | if (Wert > 0) |
700 | if (Wert > 0) |
739 | { |
701 | { |
740 | set_LED(J17_7, true); |
702 | set_LED(J17_7, true); |
741 | Wert = Wert - 1; |
703 | Wert = Wert - 1; |
742 | } |
704 | } |
743 | } |
705 | } |
744 | } |
706 | } |
745 | 707 | ||
746 | void MKTool::set_LED(QToolButton *ToolButton, bool On) |
708 | void MKTool::set_LED(QToolButton *ToolButton, bool On) |
747 | { |
709 | { |
748 | if (ToolButton->text() == QString("0") && On) |
710 | if (ToolButton->text() == QString("0") && On) |
749 | { |
711 | { |
750 | ToolButton->setIcon(Icons[0]); |
712 | ToolButton->setIcon(Icons[0]); |
751 | ToolButton->setText("1"); |
713 | ToolButton->setText("1"); |
752 | } |
714 | } |
753 | else if (ToolButton->text() == QString("1") && !On) |
715 | else if (ToolButton->text() == QString("1") && !On) |
754 | { |
716 | { |
755 | ToolButton->setIcon(Icons[4]); |
717 | ToolButton->setIcon(Icons[4]); |
756 | ToolButton->setText("0"); |
718 | ToolButton->setText("0"); |
757 | } |
719 | } |
758 | else if (ToolButton->text() == QString("00") && On) |
720 | else if (ToolButton->text() == QString("00") && On) |
759 | { |
721 | { |
760 | ToolButton->setIcon(Icons[0]); |
722 | ToolButton->setIcon(Icons[0]); |
761 | ToolButton->setText("11"); |
723 | ToolButton->setText("11"); |
762 | } |
724 | } |
763 | else if (ToolButton->text() == QString("11") && !On) |
725 | else if (ToolButton->text() == QString("11") && !On) |
764 | { |
726 | { |
765 | ToolButton->setIcon(Icons[4]); |
727 | ToolButton->setIcon(Icons[4]); |
766 | ToolButton->setText("00"); |
728 | ToolButton->setText("00"); |
767 | } |
729 | } |
768 | } |
730 | } |
769 | 731 | ||
770 | void MKTool::slot_tbUp() |
732 | void MKTool::slot_tbUp() |
771 | { |
733 | { |
772 | if (tb_9_6->text() == QString("0")) |
734 | if (tb_9_6->text() == QString("0")) |
773 | { |
735 | { |
774 | tb_9_6->setIcon(Icons[20]); |
736 | tb_9_6->setIcon(Icons[20]); |
775 | tb_9_6->setText("1"); |
737 | tb_9_6->setText("1"); |
776 | } |
738 | } |
777 | else |
739 | else |
778 | { |
740 | { |
779 | tb_9_6->setIcon(Icons[21]); |
741 | tb_9_6->setIcon(Icons[21]); |
780 | tb_9_6->setText("0"); |
742 | tb_9_6->setText("0"); |
781 | } |
743 | } |
782 | } |
744 | } |
783 | 745 | ||
784 | void MKTool::slot_tbDown() |
746 | void MKTool::slot_tbDown() |
785 | { |
747 | { |
786 | if (tb_9_7->text() == QString("0")) |
748 | if (tb_9_7->text() == QString("0")) |
787 | { |
749 | { |
788 | tb_9_7->setIcon(Icons[22]); |
750 | tb_9_7->setIcon(Icons[22]); |
789 | tb_9_7->setText("1"); |
751 | tb_9_7->setText("1"); |
790 | } |
752 | } |
791 | else |
753 | else |
792 | { |
754 | { |
793 | tb_9_7->setIcon(Icons[23]); |
755 | tb_9_7->setIcon(Icons[23]); |
794 | tb_9_7->setText("0"); |
756 | tb_9_7->setText("0"); |
795 | } |
757 | } |
796 | } |
758 | } |
797 | 759 | ||
798 | void MKTool::slot_tbLeft() |
760 | void MKTool::slot_tbLeft() |
799 | { |
761 | { |
800 | if (tb_9_8->text() == QString("0")) |
762 | if (tb_9_8->text() == QString("0")) |
801 | { |
763 | { |
802 | tb_9_8->setIcon(Icons[24]); |
764 | tb_9_8->setIcon(Icons[24]); |
803 | tb_9_8->setText("1"); |
765 | tb_9_8->setText("1"); |
804 | } |
766 | } |
805 | else |
767 | else |
806 | { |
768 | { |
807 | tb_9_8->setIcon(Icons[25]); |
769 | tb_9_8->setIcon(Icons[25]); |
808 | tb_9_8->setText("0"); |
770 | tb_9_8->setText("0"); |
809 | } |
771 | } |
810 | } |
772 | } |
811 | 773 | ||
812 | void MKTool::slot_tbRight() |
774 | void MKTool::slot_tbRight() |
813 | { |
775 | { |
814 | if (tb_9_9->text() == QString("0")) |
776 | if (tb_9_9->text() == QString("0")) |
815 | { |
777 | { |
816 | tb_9_9->setIcon(Icons[26]); |
778 | tb_9_9->setIcon(Icons[26]); |
817 | tb_9_9->setText("1"); |
779 | tb_9_9->setText("1"); |
818 | } |
780 | } |
819 | else |
781 | else |
820 | { |
782 | { |
821 | tb_9_9->setIcon(Icons[27]); |
783 | tb_9_9->setIcon(Icons[27]); |
822 | tb_9_9->setText("0"); |
784 | tb_9_9->setText("0"); |
823 | } |
785 | } |
824 | } |
786 | } |
825 | 787 | ||
826 | QComboBox *MKTool::setCombo(QComboBox *Combo, int Set, int Wert) |
788 | QComboBox *MKTool::setCombo(QComboBox *Combo, int Set, int Wert) |
827 | { |
789 | { |
828 | if (ParameterSet[Set][Wert] <= 250) |
790 | if (ParameterSet[Set][Wert] <= 250) |
829 | { |
791 | { |
830 | Combo->setItemText(4, QString("%1").arg(ParameterSet[Set][Wert])); |
792 | Combo->setItemText(4, QString("%1").arg(ParameterSet[Set][Wert])); |
831 | Combo->setCurrentIndex(4); |
793 | Combo->setCurrentIndex(4); |
832 | } |
794 | } |
833 | else |
795 | else |
834 | { |
796 | { |
835 | Combo->setCurrentIndex(ParameterSet[Set][Wert] - 251); |
797 | Combo->setCurrentIndex(ParameterSet[Set][Wert] - 251); |
836 | } |
798 | } |
837 | return Combo; |
799 | return Combo; |
838 | } |
800 | } |
839 | 801 | ||
840 | int MKTool::get_Value(QComboBox *Combo) |
802 | int MKTool::get_Value(QComboBox *Combo) |
841 | { |
803 | { |
842 | if (Combo->currentText() == QString("Poti 1")) |
804 | if (Combo->currentText() == QString("Poti 1")) |
843 | return 251; |
805 | return 251; |
844 | if (Combo->currentText() == QString("Poti 2")) |
806 | if (Combo->currentText() == QString("Poti 2")) |
845 | return 252; |
807 | return 252; |
846 | if (Combo->currentText() == QString("Poti 3")) |
808 | if (Combo->currentText() == QString("Poti 3")) |
847 | return 253; |
809 | return 253; |
848 | if (Combo->currentText() == QString("Poti 4")) |
810 | if (Combo->currentText() == QString("Poti 4")) |
849 | return 254; |
811 | return 254; |
850 | return Combo->currentText().toInt(); |
812 | return Combo->currentText().toInt(); |
851 | } |
813 | } |
852 | 814 | ||
853 | void MKTool::store_ParameterSet(int Set) // DONE 0.71g |
815 | void MKTool::store_ParameterSet(int Set) // DONE 0.71g |
854 | { |
816 | { |
855 | char *Name = le_SetName->text().toLatin1().data(); |
817 | char *Name = le_SetName->text().toLatin1().data(); |
856 | 818 | ||
857 | int a; |
819 | int a; |
858 | 820 | ||
859 | for (a = 0; a < le_SetName->text().length(); a++) |
821 | for (a = 0; a < le_SetName->text().length(); a++) |
860 | { |
822 | { |
861 | ParameterSet[Set][P_NAME+a] = Name[a]; |
823 | ParameterSet[Set][P_NAME+a] = Name[a]; |
862 | } |
824 | } |
863 | 825 | ||
864 | while(a < 12) |
826 | while(a < 12) |
865 | { |
827 | { |
866 | ParameterSet[Set][P_NAME+a] = 0; |
828 | ParameterSet[Set][P_NAME+a] = 0; |
867 | a++; |
829 | a++; |
868 | } |
830 | } |
869 | 831 | ||
870 | // Seite 1 |
832 | // Seite 1 |
871 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
833 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
872 | 834 | ||
873 | if (cb_1_1->isChecked()) |
835 | if (cb_1_1->isChecked()) |
874 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
836 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
875 | if (cb_1_2->isChecked()) |
837 | if (cb_1_2->isChecked()) |
876 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
838 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
877 | if (cb_1_3->isChecked()) |
839 | if (cb_1_3->isChecked()) |
878 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
840 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
879 | if (cb_1_4->isChecked()) |
841 | if (cb_1_4->isChecked()) |
880 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
842 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
881 | if (cb_1_5->isChecked()) |
843 | if (cb_1_5->isChecked()) |
882 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
844 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
883 | if (cb_1_6->isChecked()) |
845 | if (cb_1_6->isChecked()) |
884 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
846 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
885 | if (cb_1_7->isChecked()) |
847 | if (cb_1_7->isChecked()) |
886 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
848 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
887 | if (cb_1_8->isChecked()) |
849 | if (cb_1_8->isChecked()) |
888 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
850 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
889 | 851 | ||
890 | // Seite 2 |
852 | // Seite 2 |
891 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
853 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
892 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
854 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
893 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
855 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
894 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
856 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
895 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
857 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
896 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
858 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
897 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
859 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
898 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
860 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
899 | 861 | ||
900 | // Seite 3 |
862 | // Seite 3 |
901 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
863 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
902 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
864 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
903 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
865 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
904 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
866 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
905 | 867 | ||
906 | // Seite 4 |
868 | // Seite 4 |
907 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
869 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
908 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
870 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
909 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
871 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
910 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
872 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
911 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
873 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
912 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
874 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
913 | 875 | ||
914 | // Seite 5 |
876 | // Seite 5 |
915 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
877 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
916 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
878 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
917 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
879 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
918 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
880 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
919 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
881 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
920 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
882 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
921 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
883 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
922 | 884 | ||
923 | // Seite 6 |
885 | // Seite 6 |
924 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
886 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
925 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
887 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
926 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
888 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
927 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
889 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
928 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
890 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
929 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
891 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
930 | 892 | ||
931 | // Seite 7 |
893 | // Seite 7 |
932 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
894 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
933 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
895 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
934 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
896 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
935 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
897 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
936 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
898 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
937 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
899 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
938 | 900 | ||
939 | // Seite 8 |
901 | // Seite 8 |
940 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
902 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
941 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
903 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
942 | 904 | ||
943 | // Seite 9 |
905 | // Seite 9 |
944 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
906 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
945 | if (tb_9_6->text() == QString("1")) |
907 | if (tb_9_6->text() == QString("1")) |
946 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
908 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
947 | if (tb_9_7->text() == QString("1")) |
909 | if (tb_9_7->text() == QString("1")) |
948 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
910 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
949 | if (tb_9_8->text() == QString("1")) |
911 | if (tb_9_8->text() == QString("1")) |
950 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
912 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
951 | if (tb_9_9->text() == QString("1")) |
913 | if (tb_9_9->text() == QString("1")) |
952 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
914 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
953 | if (cb_4_7->isChecked()) |
915 | if (cb_4_7->isChecked()) |
954 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
916 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
955 | 917 | ||
956 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
918 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
957 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
919 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
958 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
920 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
959 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
921 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
960 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
922 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
961 | 923 | ||
962 | // Seite 10 |
924 | // Seite 10 |
963 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
925 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
964 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
926 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
965 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
927 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
966 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
928 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
967 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
929 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
968 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
930 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
969 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
931 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
970 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
932 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
971 | 933 | ||
972 | // Seite 11 |
934 | // Seite 11 |
973 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
935 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
974 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
936 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
975 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
937 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
976 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
938 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
977 | 939 | ||
978 | // Seite 12 |
940 | // Seite 12 |
979 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
941 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
980 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
942 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
981 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
943 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
982 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
944 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
983 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
945 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
984 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
946 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
985 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
947 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
986 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
948 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
987 | 949 | ||
988 | //Seite 13 |
950 | //Seite 13 |
989 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
951 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
990 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
952 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
991 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
953 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
992 | } |
954 | } |
993 | 955 | ||
994 | void MKTool::slot_SaveParameter() // DONE 0.71g |
956 | void MKTool::slot_SaveParameter() // DONE 0.71g |
995 | { |
957 | { |
996 | int Set = sb_Set->value() + 5; |
958 | int Set = sb_Set->value() + 5; |
997 | 959 | ||
998 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Settings->DIR.Parameter + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
960 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Settings->DIR.Parameter + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
999 | 961 | ||
1000 | if (!Filename.isEmpty()) |
962 | if (!Filename.isEmpty()) |
1001 | { |
963 | { |
1002 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
964 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
1003 | { |
965 | { |
1004 | Filename = Filename + QString(".mkp"); |
966 | Filename = Filename + QString(".mkp"); |
1005 | } |
967 | } |
1006 | store_ParameterSet(Set); |
968 | store_ParameterSet(Set); |
1007 | QSettings Setting(Filename, QSettings::IniFormat); |
969 | QSettings Setting(Filename, QSettings::IniFormat); |
1008 | 970 | ||
1009 | Setting.beginGroup("Setup"); |
971 | Setting.beginGroup("Setup"); |
1010 | Setting.setValue("Name", le_SetName->text()); |
972 | Setting.setValue("Name", le_SetName->text()); |
1011 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
973 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
1012 | Setting.endGroup(); |
974 | Setting.endGroup(); |
1013 | 975 | ||
1014 | Setting.beginGroup("Channels"); |
976 | Setting.beginGroup("Channels"); |
1015 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
977 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
1016 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
978 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
1017 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
979 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
1018 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
980 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
1019 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
981 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
1020 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
982 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
1021 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
983 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
1022 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
984 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
1023 | Setting.endGroup(); |
985 | Setting.endGroup(); |
1024 | 986 | ||
1025 | Setting.beginGroup("Stick"); |
987 | Setting.beginGroup("Stick"); |
1026 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
988 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
1027 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
989 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
1028 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
990 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
1029 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
991 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
1030 | Setting.endGroup(); |
992 | Setting.endGroup(); |
1031 | 993 | ||
1032 | Setting.beginGroup("Altitude"); |
994 | Setting.beginGroup("Altitude"); |
1033 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
995 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
1034 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
996 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
1035 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
997 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
1036 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
998 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
1037 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
999 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
1038 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
1000 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
1039 | Setting.endGroup(); |
1001 | Setting.endGroup(); |
1040 | 1002 | ||
1041 | Setting.beginGroup("Gyro"); |
1003 | Setting.beginGroup("Gyro"); |
1042 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
1004 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
1043 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
1005 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
1044 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
1006 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
1045 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1007 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1046 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1008 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1047 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
1009 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
1048 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
1010 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
1049 | Setting.endGroup(); |
1011 | Setting.endGroup(); |
1050 | 1012 | ||
1051 | Setting.beginGroup("Camera"); |
1013 | Setting.beginGroup("Camera"); |
1052 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
1014 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
1053 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
1015 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
1054 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1016 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1055 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
1017 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
1056 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
1018 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
1057 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
1019 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
1058 | Setting.endGroup(); |
1020 | Setting.endGroup(); |
1059 | 1021 | ||
1060 | Setting.beginGroup("Others"); |
1022 | Setting.beginGroup("Others"); |
1061 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
1023 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
1062 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
1024 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
1063 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
1025 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
1064 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
1026 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
1065 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
1027 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
1066 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
1028 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
1067 | Setting.endGroup(); |
1029 | Setting.endGroup(); |
1068 | 1030 | ||
1069 | Setting.beginGroup("Coupling"); |
1031 | Setting.beginGroup("Coupling"); |
1070 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
1032 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
1071 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
1033 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
1072 | Setting.endGroup(); |
1034 | Setting.endGroup(); |
1073 | 1035 | ||
1074 | Setting.beginGroup("Loop"); |
1036 | Setting.beginGroup("Loop"); |
1075 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
1037 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
1076 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
1038 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
1077 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
1039 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
1078 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
1040 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
1079 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
1041 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
1080 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
1042 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
1081 | Setting.endGroup(); |
1043 | Setting.endGroup(); |
1082 | 1044 | ||
1083 | Setting.beginGroup("User"); |
1045 | Setting.beginGroup("User"); |
1084 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
1046 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
1085 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
1047 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
1086 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
1048 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
1087 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
1049 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
1088 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
1050 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
1089 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
1051 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
1090 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
1052 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
1091 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
1053 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
1092 | Setting.endGroup(); |
1054 | Setting.endGroup(); |
1093 | 1055 | ||
1094 | Setting.beginGroup("Output"); |
1056 | Setting.beginGroup("Output"); |
1095 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
1057 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
1096 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
1058 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
1097 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
1059 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
1098 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
1060 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
1099 | Setting.endGroup(); |
1061 | Setting.endGroup(); |
1100 | 1062 | ||
1101 | Setting.beginGroup("NaviCtrl"); |
1063 | Setting.beginGroup("NaviCtrl"); |
1102 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
1064 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
1103 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
1065 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
1104 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
1066 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
1105 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
1067 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
1106 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
1068 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
1107 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
1069 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
1108 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
1070 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
1109 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
1071 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
1110 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
1072 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
1111 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
1073 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
1112 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
1074 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
1113 | Setting.endGroup(); |
1075 | Setting.endGroup(); |
1114 | } |
1076 | } |
1115 | } |
1077 | } |
1116 | 1078 | ||
1117 | void MKTool::slot_LoadParameter() // DONE 0.71g |
1079 | void MKTool::slot_LoadParameter() // DONE 0.71g |
1118 | { |
1080 | { |
1119 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Settings->DIR.Parameter, "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
1081 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Settings->DIR.Parameter, "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
1120 | 1082 | ||
1121 | if (!Filename.isEmpty()) |
1083 | if (!Filename.isEmpty()) |
1122 | { |
1084 | { |
1123 | int Set = sb_Set->value(); |
1085 | int Set = sb_Set->value(); |
1124 | QSettings Setting(Filename, QSettings::IniFormat); |
1086 | QSettings Setting(Filename, QSettings::IniFormat); |
1125 | 1087 | ||
1126 | Setting.beginGroup("Setup"); |
1088 | Setting.beginGroup("Setup"); |
1127 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
1089 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
1128 | char *CName = Name.toLatin1().data(); |
1090 | char *CName = Name.toLatin1().data(); |
1129 | int a; |
1091 | int a; |
1130 | 1092 | ||
1131 | for (a=0; a < Name.length(); a++) |
1093 | for (a=0; a < Name.length(); a++) |
1132 | { |
1094 | { |
1133 | ParameterSet[Set][P_NAME+a] = CName[a]; |
1095 | ParameterSet[Set][P_NAME+a] = CName[a]; |
1134 | } |
1096 | } |
1135 | while (a < 12) |
1097 | while (a < 12) |
1136 | { |
1098 | { |
1137 | ParameterSet[Set][P_NAME+a] = 0; |
1099 | ParameterSet[Set][P_NAME+a] = 0; |
1138 | a++; |
1100 | a++; |
1139 | } |
1101 | } |
1140 | 1102 | ||
1141 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
1103 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
1142 | Setting.endGroup(); |
1104 | Setting.endGroup(); |
1143 | 1105 | ||
1144 | Setting.beginGroup("Channels"); |
1106 | Setting.beginGroup("Channels"); |
1145 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
1107 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
1146 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
1108 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
1147 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
1109 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
1148 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
1110 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
1149 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
1111 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
1150 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
1112 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
1151 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
1113 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
1152 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
1114 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
1153 | Setting.endGroup(); |
1115 | Setting.endGroup(); |
1154 | 1116 | ||
1155 | Setting.beginGroup("Stick"); |
1117 | Setting.beginGroup("Stick"); |
1156 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
1118 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
1157 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
1119 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
1158 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
1120 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
1159 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
1121 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
1160 | Setting.endGroup(); |
1122 | Setting.endGroup(); |
1161 | 1123 | ||
1162 | Setting.beginGroup("Altitude"); |
1124 | Setting.beginGroup("Altitude"); |
1163 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
1125 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
1164 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
1126 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
1165 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
1127 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
1166 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
1128 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
1167 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
1129 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
1168 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
1130 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
1169 | Setting.endGroup(); |
1131 | Setting.endGroup(); |
1170 | 1132 | ||
1171 | Setting.beginGroup("Gyro"); |
1133 | Setting.beginGroup("Gyro"); |
1172 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
1134 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
1173 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
1135 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
1174 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
1136 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
1175 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
1137 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
1176 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
1138 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
1177 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
1139 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
1178 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
1140 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
1179 | Setting.endGroup(); |
1141 | Setting.endGroup(); |
1180 | 1142 | ||
1181 | Setting.beginGroup("Camera"); |
1143 | Setting.beginGroup("Camera"); |
1182 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
1144 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
1183 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
1145 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
1184 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
1146 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
1185 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
1147 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
1186 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
1148 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
1187 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
1149 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
1188 | Setting.endGroup(); |
1150 | Setting.endGroup(); |
1189 | 1151 | ||
1190 | Setting.beginGroup("Others"); |
1152 | Setting.beginGroup("Others"); |
1191 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
1153 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
1192 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
1154 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
1193 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
1155 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
1194 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
1156 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
1195 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
1157 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
1196 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
1158 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
1197 | Setting.endGroup(); |
1159 | Setting.endGroup(); |
1198 | 1160 | ||
1199 | Setting.beginGroup("Coupling"); |
1161 | Setting.beginGroup("Coupling"); |
1200 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
1162 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
1201 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
1163 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
1202 | Setting.endGroup(); |
1164 | Setting.endGroup(); |
1203 | 1165 | ||
1204 | Setting.beginGroup("Loop"); |
1166 | Setting.beginGroup("Loop"); |
1205 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
1167 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
1206 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
1168 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
1207 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
1169 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
1208 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
1170 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
1209 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
1171 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
1210 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
1172 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
1211 | Setting.endGroup(); |
1173 | Setting.endGroup(); |
1212 | 1174 | ||
1213 | Setting.beginGroup("User"); |
1175 | Setting.beginGroup("User"); |
1214 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
1176 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
1215 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
1177 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
1216 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
1178 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
1217 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
1179 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
1218 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
1180 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
1219 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
1181 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
1220 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
1182 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
1221 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
1183 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
1222 | Setting.endGroup(); |
1184 | Setting.endGroup(); |
1223 | 1185 | ||
1224 | Setting.beginGroup("Output"); |
1186 | Setting.beginGroup("Output"); |
1225 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
1187 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
1226 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
1188 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
1227 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
1189 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
1228 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
1190 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
1229 | Setting.endGroup(); |
1191 | Setting.endGroup(); |
1230 | 1192 | ||
1231 | Setting.beginGroup("NaviCtrl"); |
1193 | Setting.beginGroup("NaviCtrl"); |
1232 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
1194 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
1233 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
1195 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
1234 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
1196 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
1235 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
1197 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
1236 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
1198 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
1237 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
1199 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
1238 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
1200 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
1239 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
1201 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
1240 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
1202 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
1241 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
1203 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
1242 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
1204 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
1243 | Setting.endGroup(); |
1205 | Setting.endGroup(); |
1244 | 1206 | ||
1245 | show_ParameterSet(Set); |
1207 | show_ParameterSet(Set); |
1246 | } |
1208 | } |
1247 | } |
1209 | } |
1248 | 1210 | ||
1249 | void MKTool::show_ParameterSet(int Set) // DONE 0.71g |
1211 | void MKTool::show_ParameterSet(int Set) // DONE 0.71g |
1250 | { |
1212 | { |
1251 | char Name[12]; |
1213 | char Name[12]; |
1252 | for (int a = 0; a < 12; a++) |
1214 | for (int a = 0; a < 12; a++) |
1253 | { |
1215 | { |
1254 | Name[a] = ParameterSet[Set][P_NAME+a]; |
1216 | Name[a] = ParameterSet[Set][P_NAME+a]; |
1255 | } |
1217 | } |
1256 | le_SetName->setText(QString(Name)); |
1218 | le_SetName->setText(QString(Name)); |
1257 | 1219 | ||
1258 | // Seite 1 |
1220 | // Seite 1 |
1259 | { |
1221 | { |
1260 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
1222 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
1261 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
1223 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
1262 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
1224 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
1263 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
1225 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
1264 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
1226 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
1265 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
1227 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
1266 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
1228 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
1267 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
1229 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
1268 | } |
1230 | } |
1269 | // Seite 2 |
1231 | // Seite 2 |
1270 | { |
1232 | { |
1271 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
1233 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
1272 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
1234 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
1273 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
1235 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
1274 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
1236 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
1275 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
1237 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
1276 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
1238 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
1277 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
1239 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
1278 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
1240 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
1279 | } |
1241 | } |
1280 | // Seite 3 |
1242 | // Seite 3 |
1281 | { |
1243 | { |
1282 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
1244 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
1283 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
1245 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
1284 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
1246 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
1285 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
1247 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
1286 | } |
1248 | } |
1287 | // Seite 4 |
1249 | // Seite 4 |
1288 | { |
1250 | { |
1289 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
1251 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
1290 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
1252 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
1291 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
1253 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
1292 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
1254 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
1293 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
1255 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
1294 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
1256 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
1295 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
1257 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
1296 | } |
1258 | } |
1297 | // Seite 5 |
1259 | // Seite 5 |
1298 | { |
1260 | { |
1299 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
1261 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
1300 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
1262 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
1301 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
1263 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
1302 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1264 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1303 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1265 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1304 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
1266 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
1305 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
1267 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
1306 | } |
1268 | } |
1307 | // Seite 6 |
1269 | // Seite 6 |
1308 | { |
1270 | { |
1309 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
1271 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
1310 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
1272 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
1311 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
1273 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
1312 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
1274 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
1313 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
1275 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
1314 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1276 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1315 | } |
1277 | } |
1316 | // Seite 7 |
1278 | // Seite 7 |
1317 | { |
1279 | { |
1318 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
1280 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
1319 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
1281 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
1320 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
1282 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
1321 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
1283 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
1322 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
1284 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
1323 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
1285 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
1324 | } |
1286 | } |
1325 | // Seite 8 |
1287 | // Seite 8 |
1326 | { |
1288 | { |
1327 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
1289 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
1328 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
1290 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
1329 | } |
1291 | } |
1330 | // Seite 9 |
1292 | // Seite 9 |
1331 | { |
1293 | { |
1332 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
1294 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
1333 | { |
1295 | { |
1334 | tb_9_6->setIcon(Icons[20]); |
1296 | tb_9_6->setIcon(Icons[20]); |
1335 | tb_9_6->setText("1"); |
1297 | tb_9_6->setText("1"); |
1336 | } |
1298 | } |
1337 | else |
1299 | else |
1338 | { |
1300 | { |
1339 | tb_9_6->setIcon(Icons[21]); |
1301 | tb_9_6->setIcon(Icons[21]); |
1340 | tb_9_6->setText("0"); |
1302 | tb_9_6->setText("0"); |
1341 | } |
1303 | } |
1342 | 1304 | ||
1343 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
1305 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
1344 | { |
1306 | { |
1345 | tb_9_7->setIcon(Icons[22]); |
1307 | tb_9_7->setIcon(Icons[22]); |
1346 | tb_9_7->setText("1"); |
1308 | tb_9_7->setText("1"); |
1347 | } |
1309 | } |
1348 | else |
1310 | else |
1349 | { |
1311 | { |
1350 | tb_9_7->setIcon(Icons[23]); |
1312 | tb_9_7->setIcon(Icons[23]); |
1351 | tb_9_7->setText("0"); |
1313 | tb_9_7->setText("0"); |
1352 | } |
1314 | } |
1353 | 1315 | ||
1354 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
1316 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
1355 | { |
1317 | { |
1356 | tb_9_8->setIcon(Icons[24]); |
1318 | tb_9_8->setIcon(Icons[24]); |
1357 | tb_9_8->setText("1"); |
1319 | tb_9_8->setText("1"); |
1358 | } |
1320 | } |
1359 | else |
1321 | else |
1360 | { |
1322 | { |
1361 | tb_9_8->setIcon(Icons[25]); |
1323 | tb_9_8->setIcon(Icons[25]); |
1362 | tb_9_8->setText("0"); |
1324 | tb_9_8->setText("0"); |
1363 | } |
1325 | } |
1364 | 1326 | ||
1365 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
1327 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
1366 | { |
1328 | { |
1367 | tb_9_9->setIcon(Icons[26]); |
1329 | tb_9_9->setIcon(Icons[26]); |
1368 | tb_9_9->setText("1"); |
1330 | tb_9_9->setText("1"); |
1369 | } |
1331 | } |
1370 | else |
1332 | else |
1371 | { |
1333 | { |
1372 | tb_9_9->setIcon(Icons[27]); |
1334 | tb_9_9->setIcon(Icons[27]); |
1373 | tb_9_9->setText("0"); |
1335 | tb_9_9->setText("0"); |
1374 | } |
1336 | } |
1375 | 1337 | ||
1376 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
1338 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
1377 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
1339 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
1378 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
1340 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
1379 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
1341 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
1380 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
1342 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
1381 | } |
1343 | } |
1382 | // Seite 10 |
1344 | // Seite 10 |
1383 | { |
1345 | { |
1384 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
1346 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
1385 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
1347 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
1386 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
1348 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
1387 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
1349 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
1388 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
1350 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
1389 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
1351 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
1390 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
1352 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
1391 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
1353 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
1392 | } |
1354 | } |
1393 | // Seite 11 |
1355 | // Seite 11 |
1394 | { |
1356 | { |
1395 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
1357 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
1396 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
1358 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
1397 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
1359 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
1398 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
1360 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
1399 | } |
1361 | } |
1400 | // Seite 12 |
1362 | // Seite 12 |
1401 | { |
1363 | { |
1402 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
1364 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
1403 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
1365 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
1404 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
1366 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
1405 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
1367 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
1406 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
1368 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
1407 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
1369 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
1408 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
1370 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
1409 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
1371 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
1410 | } |
1372 | } |
1411 | 1373 | ||
1412 | // Seite 13 |
1374 | // Seite 13 |
1413 | { |
1375 | { |
1414 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
1376 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
1415 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
1377 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
1416 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
1378 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
1417 | } |
1379 | } |
1418 | 1380 | ||
1419 | 1381 | ||
1420 | } |
1382 | } |
1421 | 1383 | ||
1422 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1384 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1423 | { |
1385 | { |
1424 | Tab = Tab; |
1386 | Tab = Tab; |
1425 | if (tab_Main->count() != 0) |
1387 | if (tab_Main->count() != 0) |
1426 | { |
1388 | { |
1427 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (tab_Par->currentIndex() == 1)) |
1389 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (tab_Par->currentIndex() == 1)) |
1428 | { |
1390 | { |
1429 | TX_Data[0] = 0; |
1391 | TX_Data[0] = 0; |
1430 | send_Data('p', ADDRESS_FC, TX_Data, 0, true); |
1392 | send_Data('p', ADDRESS_FC, TX_Data, 0, true); |
1431 | 1393 | ||
1432 | Ticker->setInterval(500); |
1394 | Ticker->setInterval(500); |
1433 | TickerEvent[1] = true; |
1395 | TickerEvent[1] = true; |
1434 | } |
1396 | } |
1435 | else |
1397 | else |
1436 | { |
1398 | { |
1437 | Ticker->setInterval(2000); |
1399 | Ticker->setInterval(2000); |
1438 | TickerEvent[1] = false; |
1400 | TickerEvent[1] = false; |
1439 | } |
1401 | } |
1440 | 1402 | ||
1441 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_4"))) |
1403 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_4"))) |
1442 | { |
1404 | { |
1443 | TX_Data[0] = 0; |
1405 | TX_Data[0] = 0; |
1444 | TX_Data[1] = 0; |
1406 | TX_Data[1] = 0; |
1445 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1407 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1446 | 1408 | ||
1447 | Ticker->setInterval(500); |
1409 | Ticker->setInterval(500); |
1448 | TickerEvent[2] = true; |
1410 | TickerEvent[2] = true; |
1449 | } |
1411 | } |
1450 | else |
1412 | else |
1451 | { |
1413 | { |
1452 | Ticker->setInterval(2000); |
1414 | Ticker->setInterval(2000); |
1453 | TickerEvent[2] = false; |
1415 | TickerEvent[2] = false; |
1454 | } |
1416 | } |
1455 | } |
1417 | } |
1456 | } |
1418 | } |
1457 | 1419 | ||
1458 | void MKTool::slot_LCD_UP() // DONE 0.71g |
1420 | void MKTool::slot_LCD_UP() // DONE 0.71g |
1459 | { |
1421 | { |
1460 | if (LCD_Page == LCD_MAX_Page) |
1422 | if (LCD_Page == LCD_MAX_Page) |
1461 | TX_Data[0] = 0; |
1423 | TX_Data[0] = 0; |
1462 | else |
1424 | else |
1463 | TX_Data[0] = LCD_Page + 1; |
1425 | TX_Data[0] = LCD_Page + 1; |
1464 | 1426 | ||
1465 | TX_Data[1] = 0; |
1427 | TX_Data[1] = 0; |
1466 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1428 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1467 | } |
1429 | } |
1468 | 1430 | ||
1469 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1431 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1470 | { |
1432 | { |
1471 | if (LCD_Page == 0) |
1433 | if (LCD_Page == 0) |
1472 | TX_Data[0] = LCD_MAX_Page; |
1434 | TX_Data[0] = LCD_MAX_Page; |
1473 | else |
1435 | else |
1474 | TX_Data[0] = LCD_Page - 1; |
1436 | TX_Data[0] = LCD_Page - 1; |
1475 | 1437 | ||
1476 | TX_Data[1] = 0; |
1438 | TX_Data[1] = 0; |
1477 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1439 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1478 | } |
1440 | } |
1479 | 1441 | ||
1480 | void MKTool::slot_GetParameter() // DONE 0.71g |
1442 | void MKTool::slot_GetParameter() // DONE 0.71g |
1481 | { |
1443 | { |
1482 | TX_Data[0] = sb_Set->value(); |
1444 | TX_Data[0] = sb_Set->value(); |
1483 | TX_Data[1] = 0; |
1445 | TX_Data[1] = 0; |
1484 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1446 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1485 | } |
1447 | } |
1486 | 1448 | ||
1487 | void MKTool::slot_SetParameter() // DONE 0.71g |
1449 | void MKTool::slot_SetParameter() // DONE 0.71g |
1488 | { |
1450 | { |
1489 | store_ParameterSet(sb_Set->value()); |
1451 | store_ParameterSet(sb_Set->value()); |
1490 | 1452 | ||
1491 | TX_Data[0] = sb_Set->value(); |
1453 | TX_Data[0] = sb_Set->value(); |
1492 | TX_Data[1] = VERSION_SETTINGS; |
1454 | TX_Data[1] = VERSION_SETTINGS; |
1493 | 1455 | ||
1494 | for (int a = 0; a < MaxParameter; a++) |
1456 | for (int a = 0; a < MaxParameter; a++) |
1495 | { |
1457 | { |
1496 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
1458 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
1497 | } |
1459 | } |
1498 | 1460 | ||
1499 | store_ParameterSet(sb_Set->value()); |
1461 | store_ParameterSet(sb_Set->value()); |
1500 | 1462 | ||
1501 | send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
1463 | send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
1502 | } |
1464 | } |
1503 | 1465 | ||
1504 | 1466 | ||
1505 | // Save GUI-Settings |
1467 | // Save GUI-Settings |
1506 | //////////////////// |
1468 | //////////////////// |
1507 | void MKTool::write_Settings() |
1469 | void MKTool::write_Settings() |
1508 | { |
1470 | { |
1509 | QBitArray TabViews(6); |
1471 | // QBitArray TabViews(6); |
1510 | TabViews.setBit(0, ac_View0->isChecked()); |
1472 | Settings->GUI.TabViews.setBit(0, ac_View0->isChecked()); |
1511 | TabViews.setBit(1, ac_View1->isChecked()); |
1473 | Settings->GUI.TabViews.setBit(1, ac_View1->isChecked()); |
1512 | TabViews.setBit(2, ac_View2->isChecked()); |
1474 | Settings->GUI.TabViews.setBit(2, ac_View2->isChecked()); |
1513 | TabViews.setBit(3, ac_View3->isChecked()); |
1475 | Settings->GUI.TabViews.setBit(3, ac_View3->isChecked()); |
1514 | TabViews.setBit(4, ac_View4->isChecked()); |
1476 | Settings->GUI.TabViews.setBit(4, ac_View4->isChecked()); |
1515 | TabViews.setBit(5, ac_View5->isChecked()); |
1477 | Settings->GUI.TabViews.setBit(5, ac_View5->isChecked()); |
1516 | 1478 | ||
1517 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
1479 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
1518 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
1480 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
1519 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
1481 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
1520 | 1482 | ||
1521 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
- | |
1522 | 1483 | Settings->TTY.Port = le_Port->text(); |
|
1523 | Setting.beginGroup("Port"); |
- | |
1524 | Setting.setValue("TTY", le_Port->text()); |
1484 | |
1525 | Setting.endGroup(); |
1485 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
1526 | 1486 | ||
1527 | Setting.beginGroup("GUI"); |
1487 | Setting.beginGroup("GUI"); |
1528 | Setting.setValue("IsMax", isMaximized()); |
1488 | Setting.setValue("IsMax", isMaximized()); |
1529 | Setting.setValue("Size", size()); |
1489 | Setting.setValue("Size", size()); |
1530 | Setting.setValue("Point", pos()); |
1490 | Setting.setValue("Point", pos()); |
1531 | Setting.setValue("TabViews", QBitArray(TabViews)); |
- | |
1532 | Setting.endGroup(); |
1491 | Setting.endGroup(); |
1533 | } |
1492 | } |
1534 | 1493 | ||
1535 | 1494 | ||
1536 | // Debug-Daten anzeigen und Aufzeichnen |
1495 | // Debug-Daten anzeigen und Aufzeichnen |
1537 | /////////////////////////////////////// |
1496 | /////////////////////////////////////// |
1538 | void MKTool::write_CSV() |
1497 | void MKTool::write_CSV() |
1539 | { |
1498 | { |
1540 | QTextStream Out(CSVFile); |
1499 | QTextStream Out(CSVFile); |
1541 | for (int a=0; a<MaxAnalog; a++) |
1500 | for (int a=0; a<MaxAnalog; a++) |
1542 | { |
1501 | { |
1543 | if (Settings->Analog1.LogView[a]) |
1502 | if (Settings->Analog1.LogView[a]) |
1544 | { |
1503 | { |
1545 | Out << AnalogData[a]; |
1504 | Out << AnalogData[a]; |
1546 | if (a < MaxAnalog - 1) |
1505 | if (a < MaxAnalog - 1) |
1547 | Out << ';'; |
1506 | Out << ';'; |
1548 | } |
1507 | } |
1549 | } |
1508 | } |
1550 | Out << "\n"; |
1509 | Out << "\n"; |
1551 | } |
1510 | } |
1552 | 1511 | ||
1553 | void MKTool::slot_RecordCSV() // DONE 0.71g |
1512 | void MKTool::slot_RecordCSV() // DONE 0.71g |
1554 | { |
1513 | { |
1555 | if (!CSVFile->isOpen()) |
1514 | if (!CSVFile->isOpen()) |
1556 | { |
1515 | { |
1557 | QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
1516 | QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
1558 | 1517 | ||
1559 | CSVFile = new QFile(Filename); |
1518 | CSVFile = new QFile(Filename); |
1560 | if (!CSVFile->exists()) |
1519 | if (!CSVFile->exists()) |
1561 | { |
1520 | { |
1562 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1521 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1563 | 1522 | ||
1564 | QTextStream Out(CSVFile); |
1523 | QTextStream Out(CSVFile); |
1565 | 1524 | ||
1566 | for (int a = 0; a < MaxAnalog; a++) |
1525 | for (int a = 0; a < MaxAnalog; a++) |
1567 | { |
1526 | { |
1568 | if (Settings->Analog1.LogView[a]) |
1527 | if (Settings->Analog1.LogView[a]) |
1569 | { |
1528 | { |
1570 | Out << Settings->Analog1.Label[a]; |
1529 | Out << Settings->Analog1.Label[a]; |
1571 | 1530 | ||
1572 | if (a < MaxAnalog - 1) |
1531 | if (a < MaxAnalog - 1) |
1573 | Out << ';'; |
1532 | Out << ';'; |
1574 | } |
1533 | } |
1575 | } |
1534 | } |
1576 | Out << "\n"; |
1535 | Out << "\n"; |
1577 | } |
1536 | } |
1578 | else |
1537 | else |
1579 | { |
1538 | { |
1580 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1539 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1581 | } |
1540 | } |
1582 | 1541 | ||
1583 | pb_Record->setIcon(Icons[6]); |
1542 | pb_Record->setIcon(Icons[6]); |
1584 | pb_Record->setText("CSV Stop"); |
1543 | pb_Record->setText("CSV Stop"); |
1585 | ac_RecordCSV->setIcon(Icons[6]); |
1544 | ac_RecordCSV->setIcon(Icons[6]); |
1586 | ac_RecordCSV->setText("CSV Stop"); |
1545 | ac_RecordCSV->setText("CSV Stop"); |
1587 | } |
1546 | } |
1588 | else |
1547 | else |
1589 | { |
1548 | { |
1590 | CSVFile->close(); |
1549 | CSVFile->close(); |
1591 | pb_Record->setIcon(Icons[7]); |
1550 | pb_Record->setIcon(Icons[7]); |
1592 | pb_Record->setText("CSV Aufzeichnen"); |
1551 | pb_Record->setText("CSV Aufzeichnen"); |
1593 | ac_RecordCSV->setIcon(Icons[7]); |
1552 | ac_RecordCSV->setIcon(Icons[7]); |
1594 | ac_RecordCSV->setText("CSV Aufzeichnen"); |
1553 | ac_RecordCSV->setText("CSV Aufzeichnen"); |
1595 | } |
1554 | } |
1596 | } |
1555 | } |
1597 | 1556 | ||
1598 | void MKTool::show_DebugData() |
1557 | void MKTool::show_DebugData() |
1599 | { |
1558 | { |
1600 | if (CSVFile->isOpen()) |
1559 | if (CSVFile->isOpen()) |
1601 | { |
1560 | { |
1602 | write_CSV(); |
1561 | write_CSV(); |
1603 | } |
1562 | } |
1604 | 1563 | ||
1605 | if (ac_StartPlotter->isChecked()) |
1564 | if (ac_StartPlotter->isChecked()) |
1606 | { |
1565 | { |
1607 | aID[NextPlot] = NextPlot; |
1566 | aID[NextPlot] = NextPlot; |
1608 | 1567 | ||
1609 | for (int a = 0; a < MaxAnalog; a++) |
1568 | for (int a = 0; a < MaxAnalog; a++) |
1610 | { |
1569 | { |
1611 | aData[a][NextPlot] = AnalogData[a]; |
1570 | aData[a][NextPlot] = AnalogData[a]; |
1612 | } |
1571 | } |
1613 | NextPlot++; |
1572 | NextPlot++; |
1614 | 1573 | ||
1615 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_1"))) |
1574 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_1"))) |
1616 | update_Plot(); |
1575 | update_Plot(); |
1617 | } |
1576 | } |
1618 | 1577 | ||
1619 | le_A_0->setText(QString("%1").arg(AnalogData[0])); |
1578 | le_A_0->setText(QString("%1").arg(AnalogData[0])); |
1620 | le_A_1->setText(QString("%1").arg(AnalogData[1])); |
1579 | le_A_1->setText(QString("%1").arg(AnalogData[1])); |
1621 | le_A_2->setText(QString("%1").arg(AnalogData[2])); |
1580 | le_A_2->setText(QString("%1").arg(AnalogData[2])); |
1622 | le_A_3->setText(QString("%1").arg(AnalogData[3])); |
1581 | le_A_3->setText(QString("%1").arg(AnalogData[3])); |
1623 | le_A_4->setText(QString("%1").arg(AnalogData[4])); |
1582 | le_A_4->setText(QString("%1").arg(AnalogData[4])); |
1624 | le_A_5->setText(QString("%1").arg(AnalogData[5])); |
1583 | le_A_5->setText(QString("%1").arg(AnalogData[5])); |
1625 | le_A_6->setText(QString("%1").arg(AnalogData[6])); |
1584 | le_A_6->setText(QString("%1").arg(AnalogData[6])); |
1626 | le_A_7->setText(QString("%1").arg(AnalogData[7])); |
1585 | le_A_7->setText(QString("%1").arg(AnalogData[7])); |
1627 | le_A_8->setText(QString("%1").arg(AnalogData[8])); |
1586 | le_A_8->setText(QString("%1").arg(AnalogData[8])); |
1628 | le_A_9->setText(QString("%1").arg(AnalogData[9])); |
1587 | le_A_9->setText(QString("%1").arg(AnalogData[9])); |
1629 | le_A_10->setText(QString("%1").arg(AnalogData[10])); |
1588 | le_A_10->setText(QString("%1").arg(AnalogData[10])); |
1630 | le_A_11->setText(QString("%1").arg(AnalogData[11])); |
1589 | le_A_11->setText(QString("%1").arg(AnalogData[11])); |
1631 | le_A_12->setText(QString("%1").arg(AnalogData[12])); |
1590 | le_A_12->setText(QString("%1").arg(AnalogData[12])); |
1632 | le_A_13->setText(QString("%1").arg(AnalogData[13])); |
1591 | le_A_13->setText(QString("%1").arg(AnalogData[13])); |
1633 | le_A_14->setText(QString("%1").arg(AnalogData[14])); |
1592 | le_A_14->setText(QString("%1").arg(AnalogData[14])); |
1634 | le_A_15->setText(QString("%1").arg(AnalogData[15])); |
1593 | le_A_15->setText(QString("%1").arg(AnalogData[15])); |
1635 | le_A_16->setText(QString("%1").arg(AnalogData[16])); |
1594 | le_A_16->setText(QString("%1").arg(AnalogData[16])); |
1636 | le_A_17->setText(QString("%1").arg(AnalogData[17])); |
1595 | le_A_17->setText(QString("%1").arg(AnalogData[17])); |
1637 | le_A_18->setText(QString("%1").arg(AnalogData[18])); |
1596 | le_A_18->setText(QString("%1").arg(AnalogData[18])); |
1638 | le_A_19->setText(QString("%1").arg(AnalogData[19])); |
1597 | le_A_19->setText(QString("%1").arg(AnalogData[19])); |
1639 | le_A_20->setText(QString("%1").arg(AnalogData[20])); |
1598 | le_A_20->setText(QString("%1").arg(AnalogData[20])); |
1640 | le_A_21->setText(QString("%1").arg(AnalogData[21])); |
1599 | le_A_21->setText(QString("%1").arg(AnalogData[21])); |
1641 | le_A_22->setText(QString("%1").arg(AnalogData[22])); |
1600 | le_A_22->setText(QString("%1").arg(AnalogData[22])); |
1642 | le_A_23->setText(QString("%1").arg(AnalogData[23])); |
1601 | le_A_23->setText(QString("%1").arg(AnalogData[23])); |
1643 | le_A_24->setText(QString("%1").arg(AnalogData[24])); |
1602 | le_A_24->setText(QString("%1").arg(AnalogData[24])); |
1644 | le_A_25->setText(QString("%1").arg(AnalogData[25])); |
1603 | le_A_25->setText(QString("%1").arg(AnalogData[25])); |
1645 | le_A_26->setText(QString("%1").arg(AnalogData[26])); |
1604 | le_A_26->setText(QString("%1").arg(AnalogData[26])); |
1646 | le_A_27->setText(QString("%1").arg(AnalogData[27])); |
1605 | le_A_27->setText(QString("%1").arg(AnalogData[27])); |
1647 | le_A_28->setText(QString("%1").arg(AnalogData[28])); |
1606 | le_A_28->setText(QString("%1").arg(AnalogData[28])); |
1648 | le_A_29->setText(QString("%1").arg(AnalogData[29])); |
1607 | le_A_29->setText(QString("%1").arg(AnalogData[29])); |
1649 | le_A_30->setText(QString("%1").arg(AnalogData[30])); |
1608 | le_A_30->setText(QString("%1").arg(AnalogData[30])); |
1650 | le_A_31->setText(QString("%1").arg(AnalogData[31])); |
1609 | le_A_31->setText(QString("%1").arg(AnalogData[31])); |
1651 | } |
1610 | } |
1652 | 1611 | ||
1653 | 1612 | ||
1654 | // Seriel-Port Bereich, Befehle senden und Daten empfangen |
1613 | // Seriel-Port Bereich, Befehle senden und Daten empfangen |
1655 | ////////////////////////////////////////////////////////// |
1614 | ////////////////////////////////////////////////////////// |
1656 | 1615 | ||
1657 | // Neues Datenpacket empfangen -> Verarbeiten |
1616 | // Neues Datenpacket empfangen -> Verarbeiten |
1658 | void MKTool::new_RXData(sRxData RX) // DONE 0.71g |
1617 | void MKTool::new_RXData(sRxData RX) // DONE 0.71g |
1659 | { |
1618 | { |
1660 | 1619 | ||
1661 | if (LastSend.length() > 2) |
1620 | if (LastSend.length() > 2) |
1662 | { |
1621 | { |
1663 | } |
1622 | } |
1664 | 1623 | ||
1665 | int HardwareID = RX.Input[1] - 'a'; |
1624 | int HardwareID = RX.Input[1] - 'a'; |
1666 | 1625 | ||
1667 | switch(RX.Input[2]) |
1626 | switch(RX.Input[2]) |
1668 | { |
1627 | { |
1669 | case 'L' : // DONE 0.71g |
1628 | case 'L' : // DONE 0.71g |
1670 | if (ToolBox::Decode64(RX, true)) |
1629 | if (ToolBox::Decode64(RX, true)) |
1671 | { |
1630 | { |
1672 | int LCD[150]; |
1631 | int LCD[150]; |
1673 | memcpy(LCD,RX.Decode, sizeof(RX.Decode)); |
1632 | memcpy(LCD,RX.Decode, sizeof(RX.Decode)); |
1674 | 1633 | ||
1675 | LCD_Page = RX.Decode[0]; |
1634 | LCD_Page = RX.Decode[0]; |
1676 | LCD_MAX_Page = RX.Decode[1]; |
1635 | LCD_MAX_Page = RX.Decode[1]; |
1677 | 1636 | ||
1678 | le_LCD0->setText(ToolBox::Data2QString(LCD,2,22)); |
1637 | le_LCD0->setText(ToolBox::Data2QString(LCD,2,22)); |
1679 | le_LCD1->setText(ToolBox::Data2QString(LCD,22,42)); |
1638 | le_LCD1->setText(ToolBox::Data2QString(LCD,22,42)); |
1680 | le_LCD2->setText(ToolBox::Data2QString(LCD,42,62)); |
1639 | le_LCD2->setText(ToolBox::Data2QString(LCD,42,62)); |
1681 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
1640 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
1682 | 1641 | ||
1683 | TickerEvent[0] = false; |
1642 | TickerEvent[0] = false; |
1684 | } |
1643 | } |
1685 | break; |
1644 | break; |
1686 | case 'P' : // DONE 0.71g |
1645 | case 'P' : // DONE 0.71g |
1687 | if (ToolBox::Decode64(RX, true)) |
1646 | if (ToolBox::Decode64(RX, true)) |
1688 | { |
1647 | { |
1689 | pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 0,true)); |
1648 | pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 0,true)); |
1690 | pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
1649 | pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
1691 | pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
1650 | pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
1692 | pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
1651 | pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
1693 | pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
1652 | pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
1694 | pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 10,true)); |
1653 | pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 10,true)); |
1695 | pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
1654 | pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
1696 | pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
1655 | pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
1697 | } |
1656 | } |
1698 | break; |
1657 | break; |
1699 | case 'A' : // DONE 0.71g |
1658 | case 'A' : // DONE 0.71g |
1700 | if (ToolBox::Decode64(RX, true)) |
1659 | if (ToolBox::Decode64(RX, true)) |
1701 | { |
1660 | { |
1702 | int Position = RX.Decode[0]; |
1661 | int Position = RX.Decode[0]; |
1703 | if (Position < 32) |
1662 | if (Position != 31) |
1704 | { |
1663 | { |
1705 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
1664 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
1706 | Position ++; |
1665 | Position ++; |
1707 | TX_Data[0] = Position; |
1666 | TX_Data[0] = Position; |
1708 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
1667 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
1709 | } |
1668 | } |
1710 | if (Position == 32) |
1669 | if (Position == 32) |
1711 | { |
1670 | { |
1712 | for (int a = 0; a < MaxAnalog; a++) |
1671 | for (int a = 0; a < MaxAnalog; a++) |
1713 | { |
1672 | { |
1714 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
1673 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
1715 | } |
1674 | } |
- | 1675 | Settings->Analog1.Version = Mode.Version; |
|
1716 | Settings->write_Settings_AnalogLabels(HardwareID); |
1676 | Settings->write_Settings_AnalogLabels(HardwareID); |
1717 | config_Plot(); |
1677 | config_Plot(); |
1718 | } |
1678 | } |
1719 | } |
1679 | } |
1720 | break; |
1680 | break; |
1721 | case 'D' : // DONE 0.71g |
1681 | case 'D' : // DONE 0.71g |
1722 | if (ToolBox::Decode64(RX, true)) |
1682 | if (ToolBox::Decode64(RX, true)) |
1723 | { |
1683 | { |
1724 | for (int i = 0; i < MaxAnalog; i++) |
1684 | for (int i = 0; i < MaxAnalog; i++) |
1725 | { |
1685 | { |
1726 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1686 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1727 | } |
1687 | } |
1728 | show_DebugData(); |
1688 | show_DebugData(); |
1729 | } |
1689 | } |
1730 | break; |
1690 | break; |
1731 | case 'Q' : // DONE 0.71g |
1691 | case 'Q' : // DONE 0.71g |
1732 | TickerEvent[0] = false; |
1692 | TickerEvent[0] = false; |
1733 | 1693 | ||
1734 | ToolBox::Decode64(RX, true); |
1694 | ToolBox::Decode64(RX, true); |
1735 | 1695 | ||
1736 | if (RX.Decode[1] == VERSION_SETTINGS) |
1696 | if (RX.Decode[1] == VERSION_SETTINGS) |
1737 | { |
1697 | { |
1738 | int Settings_ID = RX.Decode[0]; |
1698 | int Settings_ID = RX.Decode[0]; |
1739 | for (int a = 0; a < MaxParameter; a++) |
1699 | for (int a = 0; a < MaxParameter; a++) |
1740 | { |
1700 | { |
1741 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
1701 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
1742 | } |
1702 | } |
1743 | // memcpy(ParameterSet[Settings_ID],RX.Decode, sizeof(RX.Decode)); |
1703 | // memcpy(ParameterSet[Settings_ID],RX.Decode, sizeof(RX.Decode)); |
1744 | show_ParameterSet(Settings_ID); |
1704 | show_ParameterSet(Settings_ID); |
1745 | } |
1705 | } |
1746 | else |
1706 | else |
1747 | { |
1707 | { |
1748 | pb_Read->setDisabled(true); |
1708 | pb_Read->setDisabled(true); |
1749 | pb_Write->setDisabled(true); |
1709 | pb_Write->setDisabled(true); |
1750 | 1710 | ||
1751 | QMessageBox::warning(this, QA_NAME, |
1711 | QMessageBox::warning(this, QA_NAME, |
1752 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1712 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1753 | } |
1713 | } |
1754 | 1714 | ||
1755 | break; |
1715 | break; |
1756 | case 'S' : // DONE 0.71g |
1716 | case 'S' : // DONE 0.71g |
1757 | TickerEvent[0] = false; |
1717 | TickerEvent[0] = false; |
1758 | qDebug("Settings set...!!!"); |
1718 | qDebug("Settings set...!!!"); |
1759 | break; |
1719 | break; |
1760 | case 'V' : // DONE 0.71g |
1720 | case 'V' : // DONE 0.71g |
1761 | TickerEvent[0] = false; |
1721 | TickerEvent[0] = false; |
1762 | 1722 | ||
1763 | ToolBox::Decode64(RX, true); |
1723 | ToolBox::Decode64(RX, true); |
1764 | 1724 | ||
1765 | Mode.ID = RX.Input[1] - 'a'; |
1725 | Mode.ID = RX.Input[1] - 'a'; |
1766 | Mode.VERSION_MAJOR = RX.Decode[0]; |
1726 | Mode.VERSION_MAJOR = RX.Decode[0]; |
1767 | Mode.VERSION_MINOR = RX.Decode[1]; |
1727 | Mode.VERSION_MINOR = RX.Decode[1]; |
1768 | Mode.VERSION_PATCH = RX.Decode[4]; |
1728 | Mode.VERSION_PATCH = RX.Decode[4]; |
1769 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
1729 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
1770 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1730 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1771 | 1731 | ||
1772 | Mode.Hardware = HardwareType[Mode.ID]; |
1732 | Mode.Hardware = HardwareType[Mode.ID]; |
1773 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
1733 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
1774 | 1734 | ||
1775 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
1735 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
1776 | 1736 | ||
1777 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1737 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1778 | { |
1738 | { |
1779 | AllowSend = false; |
1739 | AllowSend = false; |
1780 | QMessageBox::warning(this, QA_NAME, |
1740 | QMessageBox::warning(this, QA_NAME, |
1781 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
1741 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
1782 | } |
1742 | } |
1783 | 1743 | ||
1784 | TX_Data[0] = 50; |
1744 | TX_Data[0] = 50; |
1785 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1745 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1786 | 1746 | ||
1787 | if (Mode.ID == ADDRESS_FC) |
1747 | if (Mode.ID == ADDRESS_FC) |
1788 | { |
1748 | { |
1789 | { |
1749 | { |
1790 | TX_Data[0] = 0xff; |
1750 | TX_Data[0] = 0xff; |
1791 | TX_Data[1] = 0; |
1751 | TX_Data[1] = 0; |
1792 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1752 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1793 | } |
1753 | } |
1794 | } |
1754 | } |
1795 | else |
1755 | else |
1796 | { |
1756 | { |
1797 | pb_Read->setDisabled(true); |
1757 | pb_Read->setDisabled(true); |
1798 | pb_Write->setDisabled(true); |
1758 | pb_Write->setDisabled(true); |
1799 | 1759 | ||
1800 | // QMessageBox::warning(this, QA_NAME, |
1760 | // QMessageBox::warning(this, QA_NAME, |
1801 | // "Keine Verbindung zur FlightCtrl. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1761 | // "Keine Verbindung zur FlightCtrl. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1802 | } |
1762 | } |
1803 | - | ||
1804 | Settings->read_Settings_AnalogLabels(HardwareID); |
1763 | |
- | 1764 | Settings->read_Settings_Analog(HardwareID); |
|
- | 1765 | Settings->read_Settings_AnalogLabels(HardwareID); |
|
- | 1766 | ||
- | 1767 | if (Settings->Analog1.Version != Mode.Version) |
|
- | 1768 | { |
|
- | 1769 | slot_ac_GetLabels(); |
|
- | 1770 | } |
|
1805 | Settings->read_Settings_Analog(HardwareID); |
1771 | else |
1806 | for (int a = 0; a < MaxAnalog; a++) |
1772 | for (int a = 0; a < MaxAnalog; a++) |
1807 | { |
1773 | { |
1808 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
1774 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
1809 | } |
1775 | } |
1810 | config_Plot(); |
1776 | config_Plot(); |
1811 | 1777 | ||
1812 | break; |
1778 | break; |
1813 | } |
1779 | } |
1814 | } |
1780 | } |
1815 | 1781 | ||
1816 | // Neue Daten an der Schnittstelle |
1782 | // Neue Daten an der Schnittstelle |
1817 | void MKTool::slot_newDataReceived(const QByteArray &dataReceived) // DONE 0.71g |
1783 | void MKTool::slot_newDataReceived(const QByteArray &dataReceived) // DONE 0.71g |
1818 | { |
1784 | { |
1819 | const char *RXt; |
1785 | const char *RXt; |
1820 | RXt = dataReceived.data(); |
1786 | RXt = dataReceived.data(); |
1821 | int a = 0; |
1787 | int a = 0; |
1822 | 1788 | ||
1823 | while (RXt[a] != '\0') |
1789 | while (RXt[a] != '\0') |
1824 | { |
1790 | { |
1825 | if (RXt[a] == '\r') |
1791 | if (RXt[a] == '\r') |
1826 | { |
1792 | { |
1827 | while ((RxData.String.length() > 1) && (RxData.String.at(1) == '#')) |
1793 | while ((RxData.String.length() > 1) && (RxData.String.at(1) == '#')) |
1828 | { |
1794 | { |
1829 | RxData.String.remove(0,1); |
1795 | RxData.String.remove(0,1); |
1830 | } |
1796 | } |
1831 | 1797 | ||
1832 | if (ToolBox::check_CRC(RxData.String)) |
1798 | if (ToolBox::check_CRC(RxData.String)) |
1833 | { |
1799 | { |
1834 | RxData.Input = RxData.String.toLatin1().data(); |
1800 | RxData.Input = RxData.String.toLatin1().data(); |
1835 | new_RXData(RxData); |
1801 | new_RXData(RxData); |
1836 | 1802 | ||
1837 | if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1803 | if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1838 | { |
1804 | { |
1839 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1805 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1840 | te_RX->insertPlainText(RxData.String + '\r'); |
1806 | te_RX->insertPlainText(RxData.String + '\r'); |
1841 | } |
1807 | } |
1842 | } |
1808 | } |
1843 | else |
1809 | else |
1844 | { |
1810 | { |
1845 | if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1811 | if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1846 | { |
1812 | { |
1847 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1813 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1848 | te_RX->insertPlainText(RxData.String + '\r'); |
1814 | te_RX->insertPlainText(RxData.String + '\r'); |
1849 | } |
1815 | } |
1850 | } |
1816 | } |
1851 | RxData.String = QString(""); |
1817 | RxData.String = QString(""); |
1852 | } |
1818 | } |
1853 | else |
1819 | else |
1854 | { |
1820 | { |
1855 | { |
1821 | { |
1856 | RxData.String = RxData.String + QString(RXt[a]); |
1822 | RxData.String = RxData.String + QString(RXt[a]); |
1857 | } |
1823 | } |
1858 | } |
1824 | } |
1859 | a++; |
1825 | a++; |
1860 | } |
1826 | } |
1861 | } |
1827 | } |
1862 | 1828 | ||
1863 | // Seriellen Port öffnen |
1829 | // Seriellen Port öffnen |
1864 | void MKTool::slot_OpenPort() |
1830 | void MKTool::slot_OpenPort() |
1865 | { |
1831 | { |
1866 | if (serialPort->isOpen()) |
1832 | if (serialPort->isOpen()) |
1867 | { |
1833 | { |
1868 | TX_Data[0] = 0; |
1834 | TX_Data[0] = 0; |
1869 | TX_Data[1] = 0; |
1835 | TX_Data[1] = 0; |
1870 | TX_Data[2] = 0; |
1836 | TX_Data[2] = 0; |
1871 | TX_Data[3] = 0; |
1837 | TX_Data[3] = 0; |
1872 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
1838 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
1873 | 1839 | ||
1874 | serialPort->close(); |
1840 | serialPort->close(); |
1875 | pb_Open->setText("Verbinden"); |
1841 | pb_Open->setText("Verbinden"); |
1876 | ac_ConnectTTY->setText("Verbinden"); |
1842 | ac_ConnectTTY->setText("Verbinden"); |
1877 | pb_Open->setIcon(Icons[9]); |
1843 | pb_Open->setIcon(Icons[9]); |
1878 | ac_ConnectTTY->setIcon(Icons[9]); |
1844 | ac_ConnectTTY->setIcon(Icons[9]); |
1879 | } |
1845 | } |
1880 | else |
1846 | else |
1881 | { |
1847 | { |
1882 | serialPort->setPort(le_Port->text()); //Port |
1848 | serialPort->setPort(le_Port->text()); //Port |
1883 | 1849 | ||
1884 | serialPort->setBaudRate(BAUD57600); //BaudRate |
1850 | serialPort->setBaudRate(BAUD57600); //BaudRate |
1885 | serialPort->setDataBits(DATA_8); //DataBits |
1851 | serialPort->setDataBits(DATA_8); //DataBits |
1886 | serialPort->setParity(PAR_NONE); //Parity |
1852 | serialPort->setParity(PAR_NONE); //Parity |
1887 | serialPort->setStopBits(STOP_1); //StopBits |
1853 | serialPort->setStopBits(STOP_1); //StopBits |
1888 | serialPort->setFlowControl(FLOW_OFF); //FlowControl |
1854 | serialPort->setFlowControl(FLOW_OFF); //FlowControl |
1889 | 1855 | ||
1890 | serialPort->setTimeout(0, 10); |
1856 | serialPort->setTimeout(0, 10); |
1891 | serialPort->enableSending(); |
1857 | serialPort->enableSending(); |
1892 | serialPort->enableReceiving(); |
1858 | serialPort->enableReceiving(); |
1893 | 1859 | ||
1894 | serialPort->open(); |
1860 | serialPort->open(); |
1895 | if (serialPort->isOpen()) |
1861 | if (serialPort->isOpen()) |
1896 | { |
1862 | { |
1897 | serialPort->receiveData(); |
1863 | serialPort->receiveData(); |
1898 | 1864 | ||
1899 | send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
1865 | send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
1900 | 1866 | ||
1901 | pb_Open->setText("Trennen"); |
1867 | pb_Open->setText("Trennen"); |
1902 | ac_ConnectTTY->setText("Trennen"); |
1868 | ac_ConnectTTY->setText("Trennen"); |
1903 | pb_Open->setIcon(Icons[8]); |
1869 | pb_Open->setIcon(Icons[8]); |
1904 | ac_ConnectTTY->setIcon(Icons[8]); |
1870 | ac_ConnectTTY->setIcon(Icons[8]); |
1905 | } |
1871 | } |
1906 | } |
1872 | } |
1907 | } |
1873 | } |
1908 | 1874 | ||
1909 | // Daten senden |
1875 | // Daten senden |
1910 | void MKTool::send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend) // DONE 0.71g |
1876 | void MKTool::send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend) // DONE 0.71g |
1911 | { |
1877 | { |
1912 | if (serialPort->isOpen() && AllowSend) |
1878 | if (serialPort->isOpen() && AllowSend) |
1913 | { |
1879 | { |
1914 | QString TX_Data = ToolBox::Encode64(Data, Length); |
1880 | QString TX_Data = ToolBox::Encode64(Data, Length); |
1915 | 1881 | ||
1916 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
1882 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
1917 | 1883 | ||
1918 | // qDebug(TX_Data.toLatin1().data()); |
1884 | // qDebug(TX_Data.toLatin1().data()); |
1919 | 1885 | ||
1920 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
1886 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
1921 | 1887 | ||
1922 | // qDebug(TX_Data.toLatin1().data()); |
1888 | // qDebug(TX_Data.toLatin1().data()); |
1923 | 1889 | ||
1924 | if (Resend) |
1890 | if (Resend) |
1925 | { |
1891 | { |
1926 | LastSend = TX_Data; |
1892 | LastSend = TX_Data; |
1927 | TickerEvent[0] = true; |
1893 | TickerEvent[0] = true; |
1928 | } |
1894 | } |
1929 | 1895 | ||
1930 | QByteArray Temp(TX_Data.toUtf8()); |
1896 | QByteArray Temp(TX_Data.toUtf8()); |
1931 | serialPort->sendData(Temp); |
1897 | serialPort->sendData(Temp); |
1932 | } |
1898 | } |
1933 | } |
1899 | } |
1934 | 1900 | ||
1935 | 1901 | ||
1936 | // Programm beenden |
1902 | // Programm beenden |
1937 | /////////////////// |
1903 | /////////////////// |
1938 | 1904 | ||
1939 | MKTool::~MKTool() |
1905 | MKTool::~MKTool() |
1940 | { |
1906 | { |
1941 | qDebug(" Programm Ende ..!! "); |
1907 | qDebug(" Programm Ende ..!! "); |
1942 | if (serialPort->isOpen()) |
1908 | if (serialPort->isOpen()) |
1943 | { |
1909 | { |
1944 | serialPort->close(); |
1910 | serialPort->close(); |
1945 | } |
1911 | } |
1946 | 1912 | ||
1947 | write_Settings(); |
1913 | write_Settings(); |
1948 | Settings->write_Settings(); |
1914 | Settings->write_Settings(); |
1949 | 1915 | ||
1950 | if (CSVFile->isOpen()) |
1916 | if (CSVFile->isOpen()) |
1951 | { |
1917 | { |
1952 | CSVFile->close(); |
1918 | CSVFile->close(); |
1953 | } |
1919 | } |
1954 | - | ||
1955 | // close(); |
- | |
1956 | } |
1920 | } |
1957 | - | ||
1958 | 1921 |