Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
167 | KeyOz | 1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Manuel Schrape * |
||
3 | * manuel.schrape@gmx.de * |
||
4 | * * |
||
5 | * This program is free software; you can redistribute it and/or modify * |
||
6 | * it under the terms of the GNU General Public License as published by * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | ***************************************************************************/ |
||
19 | #include <QFileDialog> |
||
20 | #include <QSettings> |
||
21 | |||
22 | #include "wdg_Settings.h" |
||
23 | |||
24 | wdg_Settings::wdg_Settings(QWidget *parent) : QWidget(parent) |
||
25 | { |
||
26 | setupUi(this); |
||
27 | |||
28 | init_Icons(); |
||
29 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
||
30 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
||
31 | |||
32 | // Settings - Looping-Pfeile |
||
33 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
||
34 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
||
35 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
||
36 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
||
37 | |||
38 | // Settings - LED's J16 |
||
39 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
40 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
41 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
42 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
43 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
44 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
45 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
46 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
47 | |||
48 | // Settings - LED's J17 |
||
49 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
50 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
51 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
52 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
53 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
54 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
55 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
56 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
57 | |||
58 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
||
59 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
||
60 | } |
||
61 | |||
62 | void wdg_Settings::init_Icons() |
||
63 | { |
||
64 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
||
65 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
||
66 | Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
||
67 | Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
||
68 | |||
69 | Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
||
70 | Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
||
71 | Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
||
72 | Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
||
73 | Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
||
74 | Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
||
75 | |||
76 | Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
||
77 | Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
||
78 | Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
||
79 | Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
||
80 | Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
||
81 | Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
||
82 | Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
||
83 | Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
||
84 | } |
||
85 | |||
86 | void wdg_Settings::set_LED(QToolButton *ToolButton, bool On) |
||
87 | { |
||
88 | if (ToolButton->text() == QString("0") && On) |
||
89 | { |
||
90 | ToolButton->setIcon(Icons[0]); |
||
91 | ToolButton->setText("1"); |
||
92 | } |
||
93 | else if (ToolButton->text() == QString("1") && !On) |
||
94 | { |
||
95 | ToolButton->setIcon(Icons[4]); |
||
96 | ToolButton->setText("0"); |
||
97 | } |
||
98 | else if (ToolButton->text() == QString("00") && On) |
||
99 | { |
||
100 | ToolButton->setIcon(Icons[0]); |
||
101 | ToolButton->setText("11"); |
||
102 | } |
||
103 | else if (ToolButton->text() == QString("11") && !On) |
||
104 | { |
||
105 | ToolButton->setIcon(Icons[4]); |
||
106 | ToolButton->setText("00"); |
||
107 | } |
||
108 | } |
||
109 | |||
110 | void wdg_Settings::slot_LEDtoValue() |
||
111 | { |
||
112 | QToolButton *ToolButton = (QToolButton*)sender(); |
||
113 | if (ToolButton->text() == QString("0")) |
||
114 | { |
||
115 | set_LED(ToolButton, true); |
||
116 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
||
117 | } |
||
118 | else if (ToolButton->text() == QString("1")) |
||
119 | { |
||
120 | set_LED(ToolButton); |
||
121 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
||
122 | } |
||
123 | else if (ToolButton->text() == QString("00")) |
||
124 | { |
||
125 | set_LED(ToolButton, true); |
||
126 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
||
127 | } |
||
128 | else if (ToolButton->text() == QString("11")) |
||
129 | { |
||
130 | set_LED(ToolButton); |
||
131 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
||
132 | } |
||
133 | } |
||
134 | |||
135 | void wdg_Settings::slot_ValuetoLED16(int Wert) |
||
136 | { |
||
137 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
||
138 | |||
139 | // int Wert = SpinBox->value(); |
||
140 | |||
141 | set_LED(J16_0); |
||
142 | set_LED(J16_1); |
||
143 | set_LED(J16_2); |
||
144 | set_LED(J16_3); |
||
145 | set_LED(J16_4); |
||
146 | set_LED(J16_5); |
||
147 | set_LED(J16_6); |
||
148 | set_LED(J16_7); |
||
149 | |||
150 | for (int a = 0; a < 8; a++) |
||
151 | { |
||
152 | if (Wert > 127) |
||
153 | { |
||
154 | set_LED(J16_0, true); |
||
155 | Wert = Wert - 128; |
||
156 | } |
||
157 | if (Wert > 63) |
||
158 | { |
||
159 | set_LED(J16_1, true); |
||
160 | Wert = Wert - 64; |
||
161 | } |
||
162 | if (Wert > 31) |
||
163 | { |
||
164 | set_LED(J16_2, true); |
||
165 | Wert = Wert - 32; |
||
166 | } |
||
167 | if (Wert > 15) |
||
168 | { |
||
169 | set_LED(J16_3, true); |
||
170 | Wert = Wert - 16; |
||
171 | } |
||
172 | if (Wert > 7) |
||
173 | { |
||
174 | set_LED(J16_4, true); |
||
175 | Wert = Wert - 8; |
||
176 | } |
||
177 | if (Wert > 3) |
||
178 | { |
||
179 | set_LED(J16_5, true); |
||
180 | Wert = Wert - 4; |
||
181 | } |
||
182 | if (Wert > 1) |
||
183 | { |
||
184 | set_LED(J16_6, true); |
||
185 | Wert = Wert - 2; |
||
186 | } |
||
187 | if (Wert > 0) |
||
188 | { |
||
189 | set_LED(J16_7, true); |
||
190 | Wert = Wert - 1; |
||
191 | } |
||
192 | } |
||
193 | } |
||
194 | |||
195 | void wdg_Settings::slot_ValuetoLED17(int Wert) |
||
196 | { |
||
197 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
||
198 | |||
199 | // int Wert = SpinBox->value(); |
||
200 | |||
201 | set_LED(J17_0); |
||
202 | set_LED(J17_1); |
||
203 | set_LED(J17_2); |
||
204 | set_LED(J17_3); |
||
205 | set_LED(J17_4); |
||
206 | set_LED(J17_5); |
||
207 | set_LED(J17_6); |
||
208 | set_LED(J17_7); |
||
209 | |||
210 | for (int a = 0; a < 8; a++) |
||
211 | { |
||
212 | if (Wert > 127) |
||
213 | { |
||
214 | set_LED(J17_0, true); |
||
215 | Wert = Wert - 128; |
||
216 | } |
||
217 | if (Wert > 63) |
||
218 | { |
||
219 | set_LED(J17_1, true); |
||
220 | Wert = Wert - 64; |
||
221 | } |
||
222 | if (Wert > 31) |
||
223 | { |
||
224 | set_LED(J17_2, true); |
||
225 | Wert = Wert - 32; |
||
226 | } |
||
227 | if (Wert > 15) |
||
228 | { |
||
229 | set_LED(J17_3, true); |
||
230 | Wert = Wert - 16; |
||
231 | } |
||
232 | if (Wert > 7) |
||
233 | { |
||
234 | set_LED(J17_4, true); |
||
235 | Wert = Wert - 8; |
||
236 | } |
||
237 | if (Wert > 3) |
||
238 | { |
||
239 | set_LED(J17_5, true); |
||
240 | Wert = Wert - 4; |
||
241 | } |
||
242 | if (Wert > 1) |
||
243 | { |
||
244 | set_LED(J17_6, true); |
||
245 | Wert = Wert - 2; |
||
246 | } |
||
247 | if (Wert > 0) |
||
248 | { |
||
249 | set_LED(J17_7, true); |
||
250 | Wert = Wert - 1; |
||
251 | } |
||
252 | } |
||
253 | } |
||
254 | |||
255 | void wdg_Settings::slot_tbUp() |
||
256 | { |
||
257 | if (tb_9_6->text() == QString("0")) |
||
258 | { |
||
259 | tb_9_6->setIcon(Icons[20]); |
||
260 | tb_9_6->setText("1"); |
||
261 | } |
||
262 | else |
||
263 | { |
||
264 | tb_9_6->setIcon(Icons[21]); |
||
265 | tb_9_6->setText("0"); |
||
266 | } |
||
267 | } |
||
268 | |||
269 | void wdg_Settings::slot_tbDown() |
||
270 | { |
||
271 | if (tb_9_7->text() == QString("0")) |
||
272 | { |
||
273 | tb_9_7->setIcon(Icons[22]); |
||
274 | tb_9_7->setText("1"); |
||
275 | } |
||
276 | else |
||
277 | { |
||
278 | tb_9_7->setIcon(Icons[23]); |
||
279 | tb_9_7->setText("0"); |
||
280 | } |
||
281 | } |
||
282 | |||
283 | void wdg_Settings::slot_tbLeft() |
||
284 | { |
||
285 | if (tb_9_8->text() == QString("0")) |
||
286 | { |
||
287 | tb_9_8->setIcon(Icons[24]); |
||
288 | tb_9_8->setText("1"); |
||
289 | } |
||
290 | else |
||
291 | { |
||
292 | tb_9_8->setIcon(Icons[25]); |
||
293 | tb_9_8->setText("0"); |
||
294 | } |
||
295 | } |
||
296 | |||
297 | void wdg_Settings::slot_tbRight() |
||
298 | { |
||
299 | if (tb_9_9->text() == QString("0")) |
||
300 | { |
||
301 | tb_9_9->setIcon(Icons[26]); |
||
302 | tb_9_9->setText("1"); |
||
303 | } |
||
304 | else |
||
305 | { |
||
306 | tb_9_9->setIcon(Icons[27]); |
||
307 | tb_9_9->setText("0"); |
||
308 | } |
||
309 | } |
||
310 | |||
311 | void wdg_Settings::slot_LoadParameter() // DONE 0.71g |
||
312 | { |
||
313 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", /*Settings->DIR.Parameter*/ "", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
||
314 | |||
315 | if (!Filename.isEmpty()) |
||
316 | { |
||
317 | int Set = sb_Set->value(); |
||
318 | QSettings Setting(Filename, QSettings::IniFormat); |
||
319 | |||
320 | Setting.beginGroup("Setup"); |
||
321 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
||
322 | char *CName = Name.toLatin1().data(); |
||
323 | int a; |
||
324 | |||
325 | for (a=0; a < Name.length(); a++) |
||
326 | { |
||
327 | ParameterSet[Set][P_NAME+a] = CName[a]; |
||
328 | } |
||
329 | while (a < 12) |
||
330 | { |
||
331 | ParameterSet[Set][P_NAME+a] = 0; |
||
332 | a++; |
||
333 | } |
||
334 | |||
335 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
||
336 | Setting.endGroup(); |
||
337 | |||
338 | Setting.beginGroup("Channels"); |
||
339 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
||
340 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
||
341 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
||
342 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
||
343 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
||
344 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
||
345 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
||
346 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
||
347 | Setting.endGroup(); |
||
348 | |||
349 | Setting.beginGroup("Stick"); |
||
350 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
||
351 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
||
352 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
||
353 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
||
354 | Setting.endGroup(); |
||
355 | |||
356 | Setting.beginGroup("Altitude"); |
||
357 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
||
358 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
||
359 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
||
360 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
||
361 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
||
362 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
||
363 | Setting.endGroup(); |
||
364 | |||
365 | Setting.beginGroup("Gyro"); |
||
366 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
||
367 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
||
368 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
||
369 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
||
370 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
||
371 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
||
372 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
||
373 | Setting.endGroup(); |
||
374 | |||
375 | Setting.beginGroup("Camera"); |
||
376 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
||
377 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
||
378 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
||
379 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
||
380 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
||
381 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
||
382 | Setting.endGroup(); |
||
383 | |||
384 | Setting.beginGroup("Others"); |
||
385 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
||
386 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
||
387 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
||
388 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
||
389 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
||
390 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
||
391 | Setting.endGroup(); |
||
392 | |||
393 | Setting.beginGroup("Coupling"); |
||
394 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
||
395 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
||
396 | Setting.endGroup(); |
||
397 | |||
398 | Setting.beginGroup("Loop"); |
||
399 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
||
400 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
||
401 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
||
402 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
||
403 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
||
404 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
||
405 | Setting.endGroup(); |
||
406 | |||
407 | Setting.beginGroup("User"); |
||
408 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
||
409 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
||
410 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
||
411 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
||
412 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
||
413 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
||
414 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
||
415 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
||
416 | Setting.endGroup(); |
||
417 | |||
418 | Setting.beginGroup("Output"); |
||
419 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
||
420 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
||
421 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
||
422 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
||
423 | Setting.endGroup(); |
||
424 | |||
425 | Setting.beginGroup("NaviCtrl"); |
||
426 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
||
427 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
||
428 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
||
429 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
||
430 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
||
431 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
||
432 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
||
433 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
||
434 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
||
435 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
||
436 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
||
437 | Setting.endGroup(); |
||
438 | |||
439 | show_ParameterSet(Set, ParameterSet); |
||
440 | } |
||
441 | } |
||
442 | |||
443 | int wdg_Settings::get_Value(QComboBox *Combo) |
||
444 | { |
||
445 | if (Combo->currentText() == QString("Poti 1")) |
||
446 | return 251; |
||
447 | if (Combo->currentText() == QString("Poti 2")) |
||
448 | return 252; |
||
449 | if (Combo->currentText() == QString("Poti 3")) |
||
450 | return 253; |
||
451 | if (Combo->currentText() == QString("Poti 4")) |
||
452 | return 254; |
||
453 | return Combo->currentText().toInt(); |
||
454 | } |
||
455 | |||
456 | void wdg_Settings::store_ParameterSet(int Set) // DONE 0.71h |
||
457 | { |
||
458 | char *Name = le_SetName->text().toLatin1().data(); |
||
459 | |||
460 | int a; |
||
461 | |||
462 | for (a = 0; a < le_SetName->text().length(); a++) |
||
463 | { |
||
464 | ParameterSet[Set][P_NAME+a] = Name[a]; |
||
465 | } |
||
466 | |||
467 | while(a < 12) |
||
468 | { |
||
469 | ParameterSet[Set][P_NAME+a] = 0; |
||
470 | a++; |
||
471 | } |
||
472 | |||
473 | // Seite 1 |
||
474 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
||
475 | |||
476 | if (cb_1_1->isChecked()) |
||
477 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
||
478 | if (cb_1_2->isChecked()) |
||
479 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
||
480 | if (cb_1_3->isChecked()) |
||
481 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
||
482 | if (cb_1_4->isChecked()) |
||
483 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
||
484 | if (cb_1_5->isChecked()) |
||
485 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
||
486 | if (cb_1_6->isChecked()) |
||
487 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
||
488 | if (cb_1_7->isChecked()) |
||
489 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
||
490 | if (cb_1_8->isChecked()) |
||
491 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
||
492 | |||
493 | // Seite 2 |
||
494 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
||
495 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
||
496 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
||
497 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
||
498 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
||
499 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
||
500 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
||
501 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
||
502 | |||
503 | // Seite 3 |
||
504 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
||
505 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
||
506 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
||
507 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
||
508 | |||
509 | // Seite 4 |
||
510 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
||
511 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
||
512 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
||
513 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
||
514 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
||
515 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
||
516 | |||
517 | // Seite 5 |
||
518 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
||
519 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
||
520 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
||
521 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
||
522 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
||
523 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
||
524 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
||
525 | |||
526 | // Seite 6 |
||
527 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
||
528 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
||
529 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
||
530 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
||
531 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
||
532 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
||
533 | |||
534 | // Seite 7 |
||
535 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
||
536 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
||
537 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
||
538 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
||
539 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
||
540 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
||
541 | |||
542 | // Seite 8 |
||
543 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
||
544 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
||
545 | |||
546 | // Seite 9 |
||
547 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
||
548 | if (tb_9_6->text() == QString("1")) |
||
549 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
||
550 | if (tb_9_7->text() == QString("1")) |
||
551 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
||
552 | if (tb_9_8->text() == QString("1")) |
||
553 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
||
554 | if (tb_9_9->text() == QString("1")) |
||
555 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
||
556 | if (cb_4_7->isChecked()) |
||
557 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
||
558 | |||
559 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
||
560 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
||
561 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
||
562 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
||
563 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
||
564 | |||
565 | // Seite 10 |
||
566 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
||
567 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
||
568 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
||
569 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
||
570 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
||
571 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
||
572 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
||
573 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
||
574 | |||
575 | // Seite 11 |
||
576 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
||
577 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
||
578 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
||
579 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
||
580 | |||
581 | // Seite 12 |
||
582 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
||
583 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
||
584 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
||
585 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
||
586 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
||
587 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
||
588 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
||
589 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
||
590 | |||
591 | //Seite 13 |
||
592 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
||
593 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
||
594 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
||
595 | ParameterSet[Set][P_NAV_ANGLE_LIMIT] = get_Value(cb_13_4); |
||
596 | } |
||
597 | |||
598 | |||
599 | void wdg_Settings::slot_SaveParameter() // DONE 0.71g |
||
600 | { |
||
601 | int Set = sb_Set->value() + 5; |
||
602 | |||
603 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", /*Settings->DIR.Parameter*/ "" + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
||
604 | |||
605 | if (!Filename.isEmpty()) |
||
606 | { |
||
607 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
||
608 | { |
||
609 | Filename = Filename + QString(".mkp"); |
||
610 | } |
||
611 | store_ParameterSet(Set); |
||
612 | |||
613 | QSettings Setting(Filename, QSettings::IniFormat); |
||
614 | |||
615 | Setting.beginGroup("Setup"); |
||
616 | Setting.setValue("Name", le_SetName->text()); |
||
617 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
||
618 | Setting.endGroup(); |
||
619 | |||
620 | Setting.beginGroup("Channels"); |
||
621 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
||
622 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
||
623 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
||
624 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
||
625 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
||
626 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
||
627 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
||
628 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
||
629 | Setting.endGroup(); |
||
630 | |||
631 | Setting.beginGroup("Stick"); |
||
632 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
||
633 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
||
634 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
||
635 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
||
636 | Setting.endGroup(); |
||
637 | |||
638 | Setting.beginGroup("Altitude"); |
||
639 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
||
640 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
||
641 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
||
642 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
||
643 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
||
644 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
||
645 | Setting.endGroup(); |
||
646 | |||
647 | Setting.beginGroup("Gyro"); |
||
648 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
||
649 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
||
650 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
||
651 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
||
652 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
||
653 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
||
654 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
||
655 | Setting.endGroup(); |
||
656 | |||
657 | Setting.beginGroup("Camera"); |
||
658 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
||
659 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
||
660 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
||
661 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
||
662 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
||
663 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
||
664 | Setting.endGroup(); |
||
665 | |||
666 | Setting.beginGroup("Others"); |
||
667 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
||
668 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
||
669 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
||
670 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
||
671 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
||
672 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
||
673 | Setting.endGroup(); |
||
674 | |||
675 | Setting.beginGroup("Coupling"); |
||
676 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
||
677 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
||
678 | Setting.endGroup(); |
||
679 | |||
680 | Setting.beginGroup("Loop"); |
||
681 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
||
682 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
||
683 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
||
684 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
||
685 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
||
686 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
||
687 | Setting.endGroup(); |
||
688 | |||
689 | Setting.beginGroup("User"); |
||
690 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
||
691 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
||
692 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
||
693 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
||
694 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
||
695 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
||
696 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
||
697 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
||
698 | Setting.endGroup(); |
||
699 | |||
700 | Setting.beginGroup("Output"); |
||
701 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
||
702 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
||
703 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
||
704 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
||
705 | Setting.endGroup(); |
||
706 | |||
707 | Setting.beginGroup("NaviCtrl"); |
||
708 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
||
709 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
||
710 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
||
711 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
||
712 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
||
713 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
||
714 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
||
715 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
||
716 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
||
717 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
||
718 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
||
719 | Setting.endGroup(); |
||
720 | } |
||
721 | } |
||
722 | |||
723 | char *wdg_Settings::SetParameter() // DONE 0.71g |
||
724 | { |
||
725 | store_ParameterSet(sb_Set->value()); |
||
726 | |||
727 | char *TX_Data = new char[150]; |
||
728 | |||
729 | TX_Data[0] = sb_Set->value(); |
||
730 | TX_Data[1] = VERSION_SETTINGS; |
||
731 | |||
732 | for (int a = 0; a < MaxParameter; a++) |
||
733 | { |
||
734 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
||
735 | } |
||
736 | |||
737 | return TX_Data; |
||
738 | |||
739 | // store_ParameterSet(sb_Set->value()); |
||
740 | |||
741 | // send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
||
742 | } |
||
743 | |||
744 | QComboBox *wdg_Settings::setCombo(QComboBox *Combo, int Set, int Wert) |
||
745 | { |
||
746 | Set = Set; |
||
747 | |||
748 | if (Settings[Wert] <= 250) |
||
749 | { |
||
750 | Combo->setItemText(4, QString("%1").arg(Settings[Wert])); |
||
751 | Combo->setCurrentIndex(4); |
||
752 | } |
||
753 | else |
||
754 | { |
||
755 | Combo->setCurrentIndex(Settings[Wert] - 251); |
||
756 | } |
||
757 | return Combo; |
||
758 | } |
||
759 | |||
760 | void wdg_Settings::show_ParameterSet(int Set, int ParamSet[11][MaxParameter]) // DONE 0.71h |
||
761 | { |
||
762 | memcpy(Settings, ParamSet[Set], sizeof(ParamSet[Set])); |
||
763 | memcpy(ParameterSet, ParamSet, sizeof(ParamSet)); |
||
764 | |||
765 | memcpy(ParameterSet[Set], ParamSet[Set], sizeof(ParamSet[Set])); |
||
766 | |||
767 | sb_Set->setValue(Set); |
||
768 | |||
769 | char Name[12]; |
||
770 | for (int a = 0; a < 12; a++) |
||
771 | { |
||
772 | Name[a] = ParameterSet[Set][P_NAME+a]; |
||
773 | } |
||
774 | le_SetName->setText(QString(Name)); |
||
775 | |||
776 | // Seite 1 |
||
777 | { |
||
778 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
||
779 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
||
780 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
||
781 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
||
782 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
||
783 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
||
784 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
||
785 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
||
786 | } |
||
787 | // Seite 2 |
||
788 | { |
||
789 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
||
790 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
||
791 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
||
792 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
||
793 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
||
794 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
||
795 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
||
796 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
||
797 | } |
||
798 | // Seite 3 |
||
799 | { |
||
800 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
||
801 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
||
802 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
||
803 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
||
804 | } |
||
805 | // Seite 4 |
||
806 | { |
||
807 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
||
808 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
||
809 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
||
810 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
||
811 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
||
812 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
||
813 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
||
814 | } |
||
815 | // Seite 5 |
||
816 | { |
||
817 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
||
818 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
||
819 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
||
820 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
||
821 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
||
822 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
||
823 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
||
824 | } |
||
825 | // Seite 6 |
||
826 | { |
||
827 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
||
828 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
||
829 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
||
830 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
||
831 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
||
832 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
||
833 | } |
||
834 | // Seite 7 |
||
835 | { |
||
836 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
||
837 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
||
838 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
||
839 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
||
840 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
||
841 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
||
842 | } |
||
843 | // Seite 8 |
||
844 | { |
||
845 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
||
846 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
||
847 | } |
||
848 | // Seite 9 |
||
849 | { |
||
850 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
||
851 | { |
||
852 | tb_9_6->setIcon(Icons[20]); |
||
853 | tb_9_6->setText("1"); |
||
854 | } |
||
855 | else |
||
856 | { |
||
857 | tb_9_6->setIcon(Icons[21]); |
||
858 | tb_9_6->setText("0"); |
||
859 | } |
||
860 | |||
861 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
||
862 | { |
||
863 | tb_9_7->setIcon(Icons[22]); |
||
864 | tb_9_7->setText("1"); |
||
865 | } |
||
866 | else |
||
867 | { |
||
868 | tb_9_7->setIcon(Icons[23]); |
||
869 | tb_9_7->setText("0"); |
||
870 | } |
||
871 | |||
872 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
||
873 | { |
||
874 | tb_9_8->setIcon(Icons[24]); |
||
875 | tb_9_8->setText("1"); |
||
876 | } |
||
877 | else |
||
878 | { |
||
879 | tb_9_8->setIcon(Icons[25]); |
||
880 | tb_9_8->setText("0"); |
||
881 | } |
||
882 | |||
883 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
||
884 | { |
||
885 | tb_9_9->setIcon(Icons[26]); |
||
886 | tb_9_9->setText("1"); |
||
887 | } |
||
888 | else |
||
889 | { |
||
890 | tb_9_9->setIcon(Icons[27]); |
||
891 | tb_9_9->setText("0"); |
||
892 | } |
||
893 | |||
894 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
||
895 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
||
896 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
||
897 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
||
898 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
||
899 | } |
||
900 | // Seite 10 |
||
901 | { |
||
902 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
||
903 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
||
904 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
||
905 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
||
906 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
||
907 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
||
908 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
||
909 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
||
910 | } |
||
911 | // Seite 11 |
||
912 | { |
||
913 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
||
914 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
||
915 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
||
916 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
||
917 | } |
||
918 | // Seite 12 |
||
919 | { |
||
920 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
||
921 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
||
922 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
||
923 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
||
924 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
||
925 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
||
926 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
||
927 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
||
928 | } |
||
929 | // Seite 13 |
||
930 | { |
||
931 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
||
932 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
||
933 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
||
934 | cb_13_4 = setCombo(cb_13_4, Set, P_NAV_ANGLE_LIMIT); |
||
935 | } |
||
936 | } |
||
937 | |||
938 | wdg_Settings::~wdg_Settings() |
||
939 | { |
||
940 | } |
||
941 |