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