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