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