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