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