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); |
||
306 | KeyOz | 28 | listWidget->setCurrentRow(0); |
167 | KeyOz | 29 | |
234 | KeyOz | 30 | #ifndef _BETA_ |
31 | #endif |
||
32 | |||
167 | KeyOz | 33 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
34 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
||
35 | |||
36 | // Settings - Looping-Pfeile |
||
37 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
||
38 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
||
39 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
||
40 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
||
41 | |||
42 | // Settings - LED's J16 |
||
43 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
44 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
45 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
46 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
47 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
48 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
49 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
50 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
51 | |||
52 | // Settings - LED's J17 |
||
53 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
54 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
55 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
56 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
57 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
58 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
59 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
60 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
61 | |||
62 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
||
63 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
||
64 | } |
||
65 | |||
227 | KeyOz | 66 | void wdg_Settings::set_Config(cSettings *pConfig) |
67 | { |
||
68 | Config = pConfig; |
||
69 | } |
||
70 | |||
167 | KeyOz | 71 | void wdg_Settings::set_LED(QToolButton *ToolButton, bool On) |
72 | { |
||
73 | if (ToolButton->text() == QString("0") && On) |
||
74 | { |
||
199 | KeyOz | 75 | ToolButton->setIcon(ToolBox::Icon(0)); |
167 | KeyOz | 76 | ToolButton->setText("1"); |
77 | } |
||
78 | else if (ToolButton->text() == QString("1") && !On) |
||
79 | { |
||
199 | KeyOz | 80 | ToolButton->setIcon(ToolBox::Icon(4)); |
167 | KeyOz | 81 | ToolButton->setText("0"); |
82 | } |
||
83 | else if (ToolButton->text() == QString("00") && On) |
||
84 | { |
||
199 | KeyOz | 85 | ToolButton->setIcon(ToolBox::Icon(0)); |
167 | KeyOz | 86 | ToolButton->setText("11"); |
87 | } |
||
88 | else if (ToolButton->text() == QString("11") && !On) |
||
89 | { |
||
199 | KeyOz | 90 | ToolButton->setIcon(ToolBox::Icon(4)); |
167 | KeyOz | 91 | ToolButton->setText("00"); |
92 | } |
||
93 | } |
||
94 | |||
95 | void wdg_Settings::slot_LEDtoValue() |
||
96 | { |
||
97 | QToolButton *ToolButton = (QToolButton*)sender(); |
||
98 | if (ToolButton->text() == QString("0")) |
||
99 | { |
||
100 | set_LED(ToolButton, true); |
||
101 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
||
102 | } |
||
103 | else if (ToolButton->text() == QString("1")) |
||
104 | { |
||
105 | set_LED(ToolButton); |
||
106 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
||
107 | } |
||
108 | else if (ToolButton->text() == QString("00")) |
||
109 | { |
||
110 | set_LED(ToolButton, true); |
||
111 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
||
112 | } |
||
113 | else if (ToolButton->text() == QString("11")) |
||
114 | { |
||
115 | set_LED(ToolButton); |
||
116 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
||
117 | } |
||
118 | } |
||
119 | |||
120 | void wdg_Settings::slot_ValuetoLED16(int Wert) |
||
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 | set_LED(J17_0); |
||
179 | set_LED(J17_1); |
||
180 | set_LED(J17_2); |
||
181 | set_LED(J17_3); |
||
182 | set_LED(J17_4); |
||
183 | set_LED(J17_5); |
||
184 | set_LED(J17_6); |
||
185 | set_LED(J17_7); |
||
186 | |||
187 | for (int a = 0; a < 8; a++) |
||
188 | { |
||
189 | if (Wert > 127) |
||
190 | { |
||
191 | set_LED(J17_0, true); |
||
192 | Wert = Wert - 128; |
||
193 | } |
||
194 | if (Wert > 63) |
||
195 | { |
||
196 | set_LED(J17_1, true); |
||
197 | Wert = Wert - 64; |
||
198 | } |
||
199 | if (Wert > 31) |
||
200 | { |
||
201 | set_LED(J17_2, true); |
||
202 | Wert = Wert - 32; |
||
203 | } |
||
204 | if (Wert > 15) |
||
205 | { |
||
206 | set_LED(J17_3, true); |
||
207 | Wert = Wert - 16; |
||
208 | } |
||
209 | if (Wert > 7) |
||
210 | { |
||
211 | set_LED(J17_4, true); |
||
212 | Wert = Wert - 8; |
||
213 | } |
||
214 | if (Wert > 3) |
||
215 | { |
||
216 | set_LED(J17_5, true); |
||
217 | Wert = Wert - 4; |
||
218 | } |
||
219 | if (Wert > 1) |
||
220 | { |
||
221 | set_LED(J17_6, true); |
||
222 | Wert = Wert - 2; |
||
223 | } |
||
224 | if (Wert > 0) |
||
225 | { |
||
226 | set_LED(J17_7, true); |
||
227 | Wert = Wert - 1; |
||
228 | } |
||
229 | } |
||
230 | } |
||
231 | |||
232 | void wdg_Settings::slot_tbUp() |
||
233 | { |
||
234 | if (tb_9_6->text() == QString("0")) |
||
235 | { |
||
236 | tb_9_6->setText("1"); |
||
237 | } |
||
238 | else |
||
239 | { |
||
240 | tb_9_6->setText("0"); |
||
241 | } |
||
242 | } |
||
243 | |||
244 | void wdg_Settings::slot_tbDown() |
||
245 | { |
||
246 | if (tb_9_7->text() == QString("0")) |
||
247 | { |
||
248 | tb_9_7->setText("1"); |
||
249 | } |
||
250 | else |
||
251 | { |
||
252 | tb_9_7->setText("0"); |
||
253 | } |
||
254 | } |
||
255 | |||
256 | void wdg_Settings::slot_tbLeft() |
||
257 | { |
||
258 | if (tb_9_8->text() == QString("0")) |
||
259 | { |
||
260 | tb_9_8->setText("1"); |
||
261 | } |
||
262 | else |
||
263 | { |
||
264 | tb_9_8->setText("0"); |
||
265 | } |
||
266 | } |
||
267 | |||
268 | void wdg_Settings::slot_tbRight() |
||
269 | { |
||
270 | if (tb_9_9->text() == QString("0")) |
||
271 | { |
||
272 | tb_9_9->setText("1"); |
||
273 | } |
||
274 | else |
||
275 | { |
||
276 | tb_9_9->setText("0"); |
||
277 | } |
||
278 | } |
||
279 | |||
280 | void wdg_Settings::slot_LoadParameter() // DONE 0.71g |
||
281 | { |
||
227 | KeyOz | 282 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Config->DIR.Parameter + "", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
167 | KeyOz | 283 | |
284 | if (!Filename.isEmpty()) |
||
285 | { |
||
286 | int Set = sb_Set->value(); |
||
287 | QSettings Setting(Filename, QSettings::IniFormat); |
||
288 | |||
289 | Setting.beginGroup("Setup"); |
||
290 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
||
291 | char *CName = Name.toLatin1().data(); |
||
292 | int a; |
||
293 | |||
294 | for (a=0; a < Name.length(); a++) |
||
295 | { |
||
296 | ParameterSet[Set][P_NAME+a] = CName[a]; |
||
297 | } |
||
298 | while (a < 12) |
||
299 | { |
||
300 | ParameterSet[Set][P_NAME+a] = 0; |
||
301 | a++; |
||
302 | } |
||
303 | |||
304 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
||
305 | Setting.endGroup(); |
||
306 | |||
307 | Setting.beginGroup("Channels"); |
||
308 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
||
309 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
||
310 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
||
311 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
||
312 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
||
313 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
||
314 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
||
315 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
||
316 | Setting.endGroup(); |
||
317 | |||
318 | Setting.beginGroup("Stick"); |
||
319 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
||
320 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
||
321 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
||
322 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
||
323 | Setting.endGroup(); |
||
324 | |||
325 | Setting.beginGroup("Altitude"); |
||
326 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
||
327 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
||
328 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
||
329 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
||
330 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
||
331 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
||
332 | Setting.endGroup(); |
||
333 | |||
334 | Setting.beginGroup("Gyro"); |
||
335 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
||
336 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
||
234 | KeyOz | 337 | ParameterSet[Set][P_GYRO_D] = Setting.value("D", 0).toInt(); |
167 | KeyOz | 338 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
339 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
||
340 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
||
341 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
||
342 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
||
343 | Setting.endGroup(); |
||
344 | |||
345 | Setting.beginGroup("Camera"); |
||
346 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
||
347 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
||
348 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
||
349 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
||
350 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
||
351 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
||
352 | Setting.endGroup(); |
||
353 | |||
354 | Setting.beginGroup("Others"); |
||
355 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
||
356 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
||
357 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
||
358 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
||
359 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
||
360 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
||
361 | Setting.endGroup(); |
||
362 | |||
363 | Setting.beginGroup("Coupling"); |
||
234 | KeyOz | 364 | ParameterSet[Set][P_ACHS_KOPPLUNG1] = Setting.value("YawPosFeedback", 90).toInt(); |
365 | ParameterSet[Set][P_ACHS_KOPPLUNG2] = Setting.value("NickRollFeedback", 90).toInt(); |
||
366 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawCorrection", 5).toInt(); |
||
167 | KeyOz | 367 | Setting.endGroup(); |
368 | |||
369 | Setting.beginGroup("Loop"); |
||
370 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
||
371 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
||
372 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
||
373 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
||
374 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
||
375 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
||
376 | Setting.endGroup(); |
||
377 | |||
378 | Setting.beginGroup("User"); |
||
379 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
||
380 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
||
381 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
||
382 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
||
383 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
||
384 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
||
385 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
||
386 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
||
387 | Setting.endGroup(); |
||
388 | |||
389 | Setting.beginGroup("Output"); |
||
390 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
||
391 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
||
392 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
||
393 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
||
394 | Setting.endGroup(); |
||
395 | |||
396 | Setting.beginGroup("NaviCtrl"); |
||
199 | KeyOz | 397 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
398 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
||
399 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
||
400 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
||
401 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
||
234 | KeyOz | 402 | ParameterSet[Set][P_NAV_GPS_P_LIMIT] = Setting.value("GPS_P_Limit", 75).toInt(); |
403 | ParameterSet[Set][P_NAV_GPS_I_LIMIT] = Setting.value("GPS_I_Limit", 75).toInt(); |
||
404 | ParameterSet[Set][P_NAV_GPS_D_LIMIT] = Setting.value("GPS_D_Limit", 75).toInt(); |
||
199 | KeyOz | 405 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
406 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
||
407 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
||
408 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
||
409 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
||
410 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
||
411 | ParameterSet[Set][P_NAV_ANGLE_LIMIT] = Setting.value("GPS_AngleLimit", 60).toInt(); |
||
234 | KeyOz | 412 | ParameterSet[Set][P_NAV_PH_LOGINTIME] = Setting.value("GPS_PH_Login_Time", 4).toInt(); |
167 | KeyOz | 413 | Setting.endGroup(); |
414 | |||
199 | KeyOz | 415 | show_FCSettings(Set, ParameterSet[Set]); |
167 | KeyOz | 416 | } |
417 | } |
||
418 | |||
419 | int wdg_Settings::get_Value(QComboBox *Combo) |
||
420 | { |
||
421 | if (Combo->currentText() == QString("Poti 1")) |
||
422 | return 251; |
||
423 | if (Combo->currentText() == QString("Poti 2")) |
||
424 | return 252; |
||
425 | if (Combo->currentText() == QString("Poti 3")) |
||
426 | return 253; |
||
427 | if (Combo->currentText() == QString("Poti 4")) |
||
428 | return 254; |
||
429 | return Combo->currentText().toInt(); |
||
430 | } |
||
431 | |||
432 | void wdg_Settings::store_ParameterSet(int Set) // DONE 0.71h |
||
433 | { |
||
434 | char *Name = le_SetName->text().toLatin1().data(); |
||
435 | |||
436 | int a; |
||
437 | |||
438 | for (a = 0; a < le_SetName->text().length(); a++) |
||
439 | { |
||
440 | ParameterSet[Set][P_NAME+a] = Name[a]; |
||
441 | } |
||
442 | |||
443 | while(a < 12) |
||
444 | { |
||
445 | ParameterSet[Set][P_NAME+a] = 0; |
||
446 | a++; |
||
447 | } |
||
448 | |||
449 | // Seite 1 |
||
450 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
||
451 | |||
452 | if (cb_1_1->isChecked()) |
||
453 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
||
454 | if (cb_1_2->isChecked()) |
||
455 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
||
456 | if (cb_1_3->isChecked()) |
||
457 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
||
458 | if (cb_1_4->isChecked()) |
||
459 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
||
460 | if (cb_1_5->isChecked()) |
||
461 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
||
462 | if (cb_1_6->isChecked()) |
||
463 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
||
464 | if (cb_1_7->isChecked()) |
||
465 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
||
466 | if (cb_1_8->isChecked()) |
||
467 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
||
468 | |||
469 | // Seite 2 |
||
470 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
||
471 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
||
472 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
||
473 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
||
474 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
||
475 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
||
476 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
||
477 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
||
478 | |||
479 | // Seite 3 |
||
480 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
||
481 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
||
482 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
||
483 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
||
484 | |||
485 | // Seite 4 |
||
486 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
||
487 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
||
488 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
||
489 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
||
490 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
||
491 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
||
492 | |||
493 | // Seite 5 |
||
494 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
||
495 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
||
234 | KeyOz | 496 | ParameterSet[Set][P_GYRO_D] = get_Value(cb_5_8); |
167 | KeyOz | 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 |
||
234 | KeyOz | 520 | ParameterSet[Set][P_ACHS_KOPPLUNG1] = get_Value(cb_8_1); |
521 | ParameterSet[Set][P_ACHS_KOPPLUNG2] = get_Value(cb_8_2); |
||
522 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_3); |
||
167 | KeyOz | 523 | |
524 | // Seite 9 |
||
525 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
||
526 | if (tb_9_6->text() == QString("1")) |
||
527 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
||
528 | if (tb_9_7->text() == QString("1")) |
||
529 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
||
530 | if (tb_9_8->text() == QString("1")) |
||
531 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
||
532 | if (tb_9_9->text() == QString("1")) |
||
533 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
||
337 | KeyOz | 534 | // if (cb_4_7->isChecked()) |
535 | // ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
||
167 | KeyOz | 536 | |
537 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
||
538 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
||
539 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
||
540 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
||
541 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
||
542 | |||
543 | // Seite 10 |
||
544 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
||
545 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
||
546 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
||
547 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
||
548 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
||
549 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
||
550 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
||
551 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
||
552 | |||
553 | // Seite 11 |
||
554 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
||
555 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
||
556 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
||
557 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
||
558 | |||
559 | // Seite 12 |
||
560 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
||
561 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
||
562 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
||
563 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
||
564 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
||
565 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
||
566 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
||
567 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
||
234 | KeyOz | 568 | ParameterSet[Set][P_NAV_GPS_P_LIMIT] = get_Value(cb_12_9); |
569 | ParameterSet[Set][P_NAV_GPS_I_LIMIT] = get_Value(cb_12_10); |
||
570 | ParameterSet[Set][P_NAV_GPS_D_LIMIT] = get_Value(cb_12_11); |
||
167 | KeyOz | 571 | |
572 | //Seite 13 |
||
234 | KeyOz | 573 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
574 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
||
575 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
||
576 | ParameterSet[Set][P_NAV_ANGLE_LIMIT] = get_Value(cb_13_4); |
||
577 | ParameterSet[Set][P_NAV_PH_LOGINTIME] = sb_13_5->value(); |
||
167 | KeyOz | 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"); |
||
234 | KeyOz | 657 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG1]); |
167 | KeyOz | 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)); |
167 | KeyOz | 745 | |
199 | KeyOz | 746 | memcpy(ParameterSet[Set], FCSettings, sizeof(FCSettings)); |
167 | KeyOz | 747 | |
748 | sb_Set->setValue(Set); |
||
749 | |||
750 | char Name[12]; |
||
751 | for (int a = 0; a < 12; a++) |
||
752 | { |
||
199 | KeyOz | 753 | Name[a] = FCSettings[P_NAME+a]; |
167 | KeyOz | 754 | } |
755 | le_SetName->setText(QString(Name)); |
||
756 | |||
227 | KeyOz | 757 | |
167 | KeyOz | 758 | // Seite 1 |
759 | { |
||
199 | KeyOz | 760 | cb_1_1->setChecked(FCSettings[P_GLOBAL_CONF] & 0x01); |
761 | cb_1_2->setChecked(FCSettings[P_GLOBAL_CONF] & 0x02); |
||
762 | cb_1_3->setChecked(FCSettings[P_GLOBAL_CONF] & 0x04); |
||
763 | cb_1_4->setChecked(FCSettings[P_GLOBAL_CONF] & 0x08); |
||
764 | cb_1_5->setChecked(FCSettings[P_GLOBAL_CONF] & 0x10); |
||
765 | cb_1_6->setChecked(FCSettings[P_GLOBAL_CONF] & 0x20); |
||
766 | cb_1_7->setChecked(FCSettings[P_GLOBAL_CONF] & 0x40); |
||
767 | cb_1_8->setChecked(FCSettings[P_GLOBAL_CONF] & 0x80); |
||
167 | KeyOz | 768 | } |
769 | // Seite 2 |
||
770 | { |
||
199 | KeyOz | 771 | sb_2_1->setValue(FCSettings[P_KANAL_NICK]); |
772 | sb_2_2->setValue(FCSettings[P_KANAL_ROLL]); |
||
773 | sb_2_3->setValue(FCSettings[P_KANAL_GAS]); |
||
774 | sb_2_4->setValue(FCSettings[P_KANAL_GIER]); |
||
775 | sb_2_5->setValue(FCSettings[P_KANAL_POTI1]); |
||
776 | sb_2_6->setValue(FCSettings[P_KANAL_POTI2]); |
||
777 | sb_2_7->setValue(FCSettings[P_KANAL_POTI3]); |
||
778 | sb_2_8->setValue(FCSettings[P_KANAL_POTI4]); |
||
167 | KeyOz | 779 | } |
780 | // Seite 3 |
||
781 | { |
||
199 | KeyOz | 782 | sb_3_1->setValue(FCSettings[P_STICK_P]); |
783 | sb_3_2->setValue(FCSettings[P_STICK_D]); |
||
784 | cb_3_3 = setCombo(cb_3_3, Set, FCSettings[P_GIER_P]); |
||
785 | cb_3_4 = setCombo(cb_3_4, Set, FCSettings[P_EXTERNAL]); |
||
167 | KeyOz | 786 | } |
787 | // Seite 4 |
||
788 | { |
||
199 | KeyOz | 789 | cb_4_1 = setCombo(cb_4_1, Set, FCSettings[P_MAXHOEHE]); |
790 | sb_4_2->setValue(FCSettings[P_MIN_GAS]); |
||
791 | cb_4_3 = setCombo(cb_4_3, Set, FCSettings[P_HOEHE_P]); |
||
792 | cb_4_4 = setCombo(cb_4_4, Set, FCSettings[P_DRUCK_D]); |
||
793 | cb_4_5 = setCombo(cb_4_5, Set, FCSettings[P_HOEHE_ACC]); |
||
794 | sb_4_6->setValue(FCSettings[P_HOEHE_GAIN]); |
||
337 | KeyOz | 795 | // cb_4_7->setChecked(FCSettings[P_LOOP_CONFIG] & 0x10); |
167 | KeyOz | 796 | } |
797 | // Seite 5 |
||
798 | { |
||
199 | KeyOz | 799 | cb_5_1 = setCombo(cb_5_1, Set, FCSettings[P_GYRO_P]); |
800 | cb_5_2 = setCombo(cb_5_2, Set, FCSettings[P_GYRO_I]); |
||
234 | KeyOz | 801 | cb_5_8 = setCombo(cb_5_8, Set, FCSettings[P_GYRO_D]); |
199 | KeyOz | 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 | { |
||
234 | KeyOz | 828 | cb_8_1 = setCombo(cb_8_1, Set, FCSettings[P_ACHS_KOPPLUNG1]); |
829 | cb_8_2 = setCombo(cb_8_2, Set, FCSettings[P_ACHS_KOPPLUNG2]); |
||
830 | cb_8_3 = setCombo(cb_8_3, Set, FCSettings[P_ACHS_GKOPPLUNG]); |
||
167 | KeyOz | 831 | } |
832 | // Seite 9 |
||
833 | { |
||
199 | KeyOz | 834 | if (FCSettings[P_LOOP_CONFIG] & 0x01) |
167 | KeyOz | 835 | { |
836 | tb_9_6->setText("1"); |
||
227 | KeyOz | 837 | tb_9_6->setChecked(true); |
167 | KeyOz | 838 | } |
839 | else |
||
840 | { |
||
841 | tb_9_6->setText("0"); |
||
227 | KeyOz | 842 | tb_9_6->setChecked(false); |
167 | KeyOz | 843 | } |
844 | |||
199 | KeyOz | 845 | if (FCSettings[P_LOOP_CONFIG] & 0x02) |
167 | KeyOz | 846 | { |
847 | tb_9_7->setText("1"); |
||
848 | } |
||
849 | else |
||
850 | { |
||
851 | tb_9_7->setText("0"); |
||
852 | } |
||
853 | |||
199 | KeyOz | 854 | if (FCSettings[P_LOOP_CONFIG] & 0x04) |
167 | KeyOz | 855 | { |
856 | tb_9_8->setText("1"); |
||
857 | } |
||
858 | else |
||
859 | { |
||
860 | tb_9_8->setText("0"); |
||
861 | } |
||
862 | |||
199 | KeyOz | 863 | if (FCSettings[P_LOOP_CONFIG] & 0x08) |
167 | KeyOz | 864 | { |
865 | tb_9_9->setText("1"); |
||
866 | } |
||
867 | else |
||
868 | { |
||
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]); |
||
234 | KeyOz | 906 | cb_12_9 = setCombo(cb_12_9, Set, FCSettings[P_NAV_GPS_P_LIMIT]); |
907 | cb_12_10 = setCombo(cb_12_10, Set, FCSettings[P_NAV_GPS_I_LIMIT]); |
||
908 | cb_12_11 = setCombo(cb_12_11, Set, FCSettings[P_NAV_GPS_D_LIMIT]); |
||
167 | KeyOz | 909 | } |
910 | // Seite 13 |
||
911 | { |
||
199 | KeyOz | 912 | cb_13_1 = setCombo(cb_13_1, Set, FCSettings[P_NAV_WIND_CORR]); |
913 | cb_13_2 = setCombo(cb_13_2, Set, FCSettings[P_NAV_SPEED_COMP]); |
||
914 | cb_13_3 = setCombo(cb_13_3, Set, FCSettings[P_NAV_RADIUS]); |
||
915 | cb_13_4 = setCombo(cb_13_4, Set, FCSettings[P_NAV_ANGLE_LIMIT]); |
||
234 | KeyOz | 916 | sb_13_5->setValue(FCSettings[P_NAV_PH_LOGINTIME]); |
167 | KeyOz | 917 | } |
918 | } |
||
919 | |||
920 | wdg_Settings::~wdg_Settings() |
||
921 | { |
||
922 | } |
||
923 |