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 | { |
||
481 | 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_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
||
349 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
||
481 | KeyOz | 350 | |
351 | ParameterSet[Set][P_SERVO_ROLL_CONT] = Setting.value("ServoRollControl", 100).toInt(); |
||
352 | ParameterSet[Set][P_SERVO_ROLL_COMP] = Setting.value("ServoRollCompensation", 40).toInt(); |
||
353 | ParameterSet[Set][P_SERVO_ROLL_MIN] = Setting.value("ServoRollMin", 50).toInt(); |
||
354 | ParameterSet[Set][P_SERVO_ROLL_MAX] = Setting.value("ServoRollMax", 150).toInt(); |
||
355 | |||
356 | ParameterSet[Set][P_SERVO_COMPI] = Setting.value("ServoInvert", 0).toInt(); |
||
357 | |||
358 | ParameterSet[Set][P_SERVO_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
||
167 | KeyOz | 359 | Setting.endGroup(); |
360 | |||
361 | Setting.beginGroup("Others"); |
||
362 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
||
363 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
||
364 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
||
365 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
||
366 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
||
367 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
||
368 | Setting.endGroup(); |
||
369 | |||
370 | Setting.beginGroup("Coupling"); |
||
234 | KeyOz | 371 | ParameterSet[Set][P_ACHS_KOPPLUNG1] = Setting.value("YawPosFeedback", 90).toInt(); |
372 | ParameterSet[Set][P_ACHS_KOPPLUNG2] = Setting.value("NickRollFeedback", 90).toInt(); |
||
373 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawCorrection", 5).toInt(); |
||
167 | KeyOz | 374 | Setting.endGroup(); |
375 | |||
376 | Setting.beginGroup("Loop"); |
||
377 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
||
378 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
||
379 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
||
380 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
||
381 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
||
382 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
||
383 | Setting.endGroup(); |
||
384 | |||
385 | Setting.beginGroup("User"); |
||
386 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
||
387 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
||
388 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
||
389 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
||
390 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
||
391 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
||
392 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
||
393 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
||
394 | Setting.endGroup(); |
||
395 | |||
396 | Setting.beginGroup("Output"); |
||
397 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
||
398 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
||
399 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
||
400 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
||
401 | Setting.endGroup(); |
||
402 | |||
403 | Setting.beginGroup("NaviCtrl"); |
||
199 | KeyOz | 404 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
405 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
||
406 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
||
407 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
||
408 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
||
234 | KeyOz | 409 | ParameterSet[Set][P_NAV_GPS_P_LIMIT] = Setting.value("GPS_P_Limit", 75).toInt(); |
410 | ParameterSet[Set][P_NAV_GPS_I_LIMIT] = Setting.value("GPS_I_Limit", 75).toInt(); |
||
411 | ParameterSet[Set][P_NAV_GPS_D_LIMIT] = Setting.value("GPS_D_Limit", 75).toInt(); |
||
199 | KeyOz | 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(); |
||
234 | KeyOz | 419 | ParameterSet[Set][P_NAV_PH_LOGINTIME] = Setting.value("GPS_PH_Login_Time", 4).toInt(); |
167 | KeyOz | 420 | Setting.endGroup(); |
421 | |||
199 | KeyOz | 422 | show_FCSettings(Set, ParameterSet[Set]); |
167 | KeyOz | 423 | } |
424 | } |
||
425 | |||
426 | int wdg_Settings::get_Value(QComboBox *Combo) |
||
427 | { |
||
428 | if (Combo->currentText() == QString("Poti 1")) |
||
429 | return 251; |
||
430 | if (Combo->currentText() == QString("Poti 2")) |
||
431 | return 252; |
||
432 | if (Combo->currentText() == QString("Poti 3")) |
||
433 | return 253; |
||
434 | if (Combo->currentText() == QString("Poti 4")) |
||
435 | return 254; |
||
436 | return Combo->currentText().toInt(); |
||
437 | } |
||
438 | |||
439 | void wdg_Settings::store_ParameterSet(int Set) // DONE 0.71h |
||
440 | { |
||
441 | char *Name = le_SetName->text().toLatin1().data(); |
||
442 | |||
443 | int a; |
||
444 | |||
445 | for (a = 0; a < le_SetName->text().length(); a++) |
||
446 | { |
||
447 | ParameterSet[Set][P_NAME+a] = Name[a]; |
||
448 | } |
||
449 | |||
450 | while(a < 12) |
||
451 | { |
||
452 | ParameterSet[Set][P_NAME+a] = 0; |
||
453 | a++; |
||
454 | } |
||
455 | |||
456 | // Seite 1 |
||
457 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
||
458 | |||
459 | if (cb_1_1->isChecked()) |
||
460 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
||
461 | if (cb_1_2->isChecked()) |
||
462 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
||
463 | if (cb_1_3->isChecked()) |
||
464 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
||
465 | if (cb_1_4->isChecked()) |
||
466 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
||
467 | if (cb_1_5->isChecked()) |
||
468 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
||
469 | if (cb_1_6->isChecked()) |
||
470 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
||
471 | if (cb_1_7->isChecked()) |
||
472 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
||
473 | if (cb_1_8->isChecked()) |
||
474 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
||
475 | |||
476 | // Seite 2 |
||
477 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
||
478 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
||
479 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
||
480 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
||
481 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
||
482 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
||
483 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
||
484 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
||
485 | |||
486 | // Seite 3 |
||
487 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
||
488 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
||
489 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
||
490 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
||
491 | |||
492 | // Seite 4 |
||
493 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
||
494 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
||
495 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
||
496 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
||
497 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
||
498 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
||
499 | |||
500 | // Seite 5 |
||
501 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
||
502 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
||
234 | KeyOz | 503 | ParameterSet[Set][P_GYRO_D] = get_Value(cb_5_8); |
167 | KeyOz | 504 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
505 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
||
506 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
||
507 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
||
508 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
||
509 | |||
510 | // Seite 6 |
||
511 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
||
512 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
||
513 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
||
514 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
||
481 | KeyOz | 515 | // ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
167 | KeyOz | 516 | |
481 | KeyOz | 517 | ParameterSet[Set][P_SERVO_ROLL_CONT] = get_Value(cb_6_7); |
518 | ParameterSet[Set][P_SERVO_ROLL_COMP] = sb_6_8->value(); |
||
519 | ParameterSet[Set][P_SERVO_ROLL_MIN] = sb_6_10->value(); |
||
520 | ParameterSet[Set][P_SERVO_ROLL_MAX] = sb_6_11->value(); |
||
521 | |||
522 | ParameterSet[Set][P_SERVO_REFR] = sb_6_5->value(); |
||
523 | |||
524 | if (cb_6_6->isChecked()) |
||
525 | ParameterSet[Set][P_SERVO_COMPI] = ParameterSet[Set][P_SERVO_COMPI] | 0x01; |
||
526 | if (cb_6_9->isChecked()) |
||
527 | ParameterSet[Set][P_SERVO_COMPI] = ParameterSet[Set][P_SERVO_COMPI] | 0x02; |
||
528 | |||
167 | KeyOz | 529 | // Seite 7 |
530 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
||
531 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
||
532 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
||
533 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
||
534 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
||
535 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
||
536 | |||
537 | // Seite 8 |
||
234 | KeyOz | 538 | ParameterSet[Set][P_ACHS_KOPPLUNG1] = get_Value(cb_8_1); |
539 | ParameterSet[Set][P_ACHS_KOPPLUNG2] = get_Value(cb_8_2); |
||
540 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_3); |
||
167 | KeyOz | 541 | |
542 | // Seite 9 |
||
543 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
||
544 | if (tb_9_6->text() == QString("1")) |
||
545 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
||
546 | if (tb_9_7->text() == QString("1")) |
||
547 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
||
548 | if (tb_9_8->text() == QString("1")) |
||
549 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
||
550 | if (tb_9_9->text() == QString("1")) |
||
551 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
||
552 | |||
481 | KeyOz | 553 | |
167 | KeyOz | 554 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
555 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
||
556 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
||
557 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
||
558 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
||
559 | |||
560 | // Seite 10 |
||
561 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
||
562 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
||
563 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
||
564 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
||
565 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
||
566 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
||
567 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
||
568 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
||
569 | |||
570 | // Seite 11 |
||
571 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
||
572 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
||
573 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
||
574 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
||
575 | |||
576 | // Seite 12 |
||
577 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
||
578 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
||
579 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
||
580 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
||
581 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
||
582 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
||
583 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
||
584 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
||
234 | KeyOz | 585 | ParameterSet[Set][P_NAV_GPS_P_LIMIT] = get_Value(cb_12_9); |
586 | ParameterSet[Set][P_NAV_GPS_I_LIMIT] = get_Value(cb_12_10); |
||
587 | ParameterSet[Set][P_NAV_GPS_D_LIMIT] = get_Value(cb_12_11); |
||
167 | KeyOz | 588 | |
589 | //Seite 13 |
||
234 | KeyOz | 590 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
591 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
||
592 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
||
593 | ParameterSet[Set][P_NAV_ANGLE_LIMIT] = get_Value(cb_13_4); |
||
594 | ParameterSet[Set][P_NAV_PH_LOGINTIME] = sb_13_5->value(); |
||
167 | KeyOz | 595 | } |
596 | |||
597 | void wdg_Settings::slot_SaveParameter() // DONE 0.71g |
||
598 | { |
||
599 | int Set = sb_Set->value() + 5; |
||
600 | |||
481 | KeyOz | 601 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Config->DIR.Parameter + "/" + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
167 | KeyOz | 602 | |
603 | if (!Filename.isEmpty()) |
||
604 | { |
||
605 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
||
606 | { |
||
607 | Filename = Filename + QString(".mkp"); |
||
608 | } |
||
609 | store_ParameterSet(Set); |
||
610 | |||
611 | QSettings Setting(Filename, QSettings::IniFormat); |
||
612 | |||
613 | Setting.beginGroup("Setup"); |
||
614 | Setting.setValue("Name", le_SetName->text()); |
||
615 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
||
616 | Setting.endGroup(); |
||
617 | |||
618 | Setting.beginGroup("Channels"); |
||
619 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
||
620 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
||
621 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
||
622 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
||
623 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
||
624 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
||
625 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
||
626 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
||
627 | Setting.endGroup(); |
||
628 | |||
629 | Setting.beginGroup("Stick"); |
||
630 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
||
631 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
||
632 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
||
633 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
||
634 | Setting.endGroup(); |
||
635 | |||
636 | Setting.beginGroup("Altitude"); |
||
637 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
||
638 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
||
639 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
||
640 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
||
641 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
||
642 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
||
643 | Setting.endGroup(); |
||
644 | |||
645 | Setting.beginGroup("Gyro"); |
||
646 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
||
647 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
||
648 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
||
649 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
||
650 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
||
651 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
||
652 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
||
653 | Setting.endGroup(); |
||
654 | |||
655 | Setting.beginGroup("Camera"); |
||
656 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
||
657 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
||
658 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
||
659 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
||
481 | KeyOz | 660 | |
661 | Setting.setValue("ServoRollControl", ParameterSet[Set][P_SERVO_ROLL_CONT]); |
||
662 | Setting.setValue("ServoRollCompensation", ParameterSet[Set][P_SERVO_ROLL_COMP]); |
||
663 | Setting.setValue("ServoRollMin", ParameterSet[Set][P_SERVO_ROLL_MIN]); |
||
664 | Setting.setValue("ServoRollMax", ParameterSet[Set][P_SERVO_ROLL_MAX]); |
||
665 | |||
666 | Setting.setValue("ServoInvert", ParameterSet[Set][P_SERVO_COMPI]); |
||
667 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_REFR]); |
||
167 | KeyOz | 668 | Setting.endGroup(); |
669 | |||
670 | Setting.beginGroup("Others"); |
||
671 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
||
672 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
||
673 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
||
674 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
||
675 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
||
676 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
||
677 | Setting.endGroup(); |
||
678 | |||
679 | Setting.beginGroup("Coupling"); |
||
234 | KeyOz | 680 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG1]); |
167 | KeyOz | 681 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
682 | Setting.endGroup(); |
||
683 | |||
684 | Setting.beginGroup("Loop"); |
||
685 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
||
686 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
||
687 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
||
688 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
||
689 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
||
690 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
||
691 | Setting.endGroup(); |
||
692 | |||
693 | Setting.beginGroup("User"); |
||
694 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
||
695 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
||
696 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
||
697 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
||
698 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
||
699 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
||
700 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
||
701 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
||
702 | Setting.endGroup(); |
||
703 | |||
704 | Setting.beginGroup("Output"); |
||
705 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
||
706 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
||
707 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
||
708 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
||
709 | Setting.endGroup(); |
||
710 | |||
711 | Setting.beginGroup("NaviCtrl"); |
||
712 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
||
713 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
||
714 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
||
715 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
||
716 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
||
717 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
||
718 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
||
719 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
||
720 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
||
721 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
||
722 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
||
199 | KeyOz | 723 | Setting.setValue("GPS_AngleLimit", ParameterSet[Set][P_NAV_ANGLE_LIMIT]); |
167 | KeyOz | 724 | Setting.endGroup(); |
725 | } |
||
726 | } |
||
727 | |||
199 | KeyOz | 728 | char *wdg_Settings::GetFCSettings() // DONE 0.71g |
167 | KeyOz | 729 | { |
730 | store_ParameterSet(sb_Set->value()); |
||
731 | |||
732 | char *TX_Data = new char[150]; |
||
733 | |||
734 | TX_Data[0] = sb_Set->value(); |
||
735 | TX_Data[1] = VERSION_SETTINGS; |
||
736 | |||
737 | for (int a = 0; a < MaxParameter; a++) |
||
738 | { |
||
739 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
||
740 | } |
||
741 | |||
742 | return TX_Data; |
||
743 | |||
744 | // store_ParameterSet(sb_Set->value()); |
||
745 | |||
746 | // send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
||
747 | } |
||
748 | |||
749 | QComboBox *wdg_Settings::setCombo(QComboBox *Combo, int Set, int Wert) |
||
750 | { |
||
751 | Set = Set; |
||
752 | |||
199 | KeyOz | 753 | if (Wert <= 250) |
167 | KeyOz | 754 | { |
199 | KeyOz | 755 | Combo->setItemText(4, QString("%1").arg(Wert)); |
167 | KeyOz | 756 | Combo->setCurrentIndex(4); |
757 | } |
||
758 | else |
||
759 | { |
||
199 | KeyOz | 760 | Combo->setCurrentIndex(Wert - 251); |
167 | KeyOz | 761 | } |
762 | return Combo; |
||
763 | } |
||
764 | |||
199 | KeyOz | 765 | void wdg_Settings::show_FCSettings(int Set, int FCSettings[MaxParameter]) // DONE 0.71h |
167 | KeyOz | 766 | { |
199 | KeyOz | 767 | memcpy(Settings, FCSettings, sizeof(FCSettings)); |
167 | KeyOz | 768 | |
199 | KeyOz | 769 | memcpy(ParameterSet[Set], FCSettings, sizeof(FCSettings)); |
167 | KeyOz | 770 | |
771 | sb_Set->setValue(Set); |
||
772 | |||
773 | char Name[12]; |
||
774 | for (int a = 0; a < 12; a++) |
||
775 | { |
||
199 | KeyOz | 776 | Name[a] = FCSettings[P_NAME+a]; |
167 | KeyOz | 777 | } |
778 | le_SetName->setText(QString(Name)); |
||
779 | |||
227 | KeyOz | 780 | |
167 | KeyOz | 781 | // Seite 1 |
782 | { |
||
199 | KeyOz | 783 | cb_1_1->setChecked(FCSettings[P_GLOBAL_CONF] & 0x01); |
784 | cb_1_2->setChecked(FCSettings[P_GLOBAL_CONF] & 0x02); |
||
785 | cb_1_3->setChecked(FCSettings[P_GLOBAL_CONF] & 0x04); |
||
786 | cb_1_4->setChecked(FCSettings[P_GLOBAL_CONF] & 0x08); |
||
787 | cb_1_5->setChecked(FCSettings[P_GLOBAL_CONF] & 0x10); |
||
788 | cb_1_6->setChecked(FCSettings[P_GLOBAL_CONF] & 0x20); |
||
789 | cb_1_7->setChecked(FCSettings[P_GLOBAL_CONF] & 0x40); |
||
790 | cb_1_8->setChecked(FCSettings[P_GLOBAL_CONF] & 0x80); |
||
167 | KeyOz | 791 | } |
792 | // Seite 2 |
||
793 | { |
||
199 | KeyOz | 794 | sb_2_1->setValue(FCSettings[P_KANAL_NICK]); |
795 | sb_2_2->setValue(FCSettings[P_KANAL_ROLL]); |
||
796 | sb_2_3->setValue(FCSettings[P_KANAL_GAS]); |
||
797 | sb_2_4->setValue(FCSettings[P_KANAL_GIER]); |
||
798 | sb_2_5->setValue(FCSettings[P_KANAL_POTI1]); |
||
799 | sb_2_6->setValue(FCSettings[P_KANAL_POTI2]); |
||
800 | sb_2_7->setValue(FCSettings[P_KANAL_POTI3]); |
||
801 | sb_2_8->setValue(FCSettings[P_KANAL_POTI4]); |
||
167 | KeyOz | 802 | } |
803 | // Seite 3 |
||
804 | { |
||
199 | KeyOz | 805 | sb_3_1->setValue(FCSettings[P_STICK_P]); |
806 | sb_3_2->setValue(FCSettings[P_STICK_D]); |
||
807 | cb_3_3 = setCombo(cb_3_3, Set, FCSettings[P_GIER_P]); |
||
808 | cb_3_4 = setCombo(cb_3_4, Set, FCSettings[P_EXTERNAL]); |
||
167 | KeyOz | 809 | } |
810 | // Seite 4 |
||
811 | { |
||
199 | KeyOz | 812 | cb_4_1 = setCombo(cb_4_1, Set, FCSettings[P_MAXHOEHE]); |
813 | sb_4_2->setValue(FCSettings[P_MIN_GAS]); |
||
814 | cb_4_3 = setCombo(cb_4_3, Set, FCSettings[P_HOEHE_P]); |
||
815 | cb_4_4 = setCombo(cb_4_4, Set, FCSettings[P_DRUCK_D]); |
||
816 | cb_4_5 = setCombo(cb_4_5, Set, FCSettings[P_HOEHE_ACC]); |
||
817 | sb_4_6->setValue(FCSettings[P_HOEHE_GAIN]); |
||
337 | KeyOz | 818 | // cb_4_7->setChecked(FCSettings[P_LOOP_CONFIG] & 0x10); |
167 | KeyOz | 819 | } |
820 | // Seite 5 |
||
821 | { |
||
199 | KeyOz | 822 | cb_5_1 = setCombo(cb_5_1, Set, FCSettings[P_GYRO_P]); |
823 | cb_5_2 = setCombo(cb_5_2, Set, FCSettings[P_GYRO_I]); |
||
234 | KeyOz | 824 | cb_5_8 = setCombo(cb_5_8, Set, FCSettings[P_GYRO_D]); |
199 | KeyOz | 825 | cb_5_3 = setCombo(cb_5_3, Set, FCSettings[P_DYNAMIC_STAB]); |
826 | sb_5_4->setValue(FCSettings[P_GYRO_ACC_FAKTOR]); |
||
827 | sb_5_5->setValue(FCSettings[P_GYRO_ACC_ABGL]); |
||
828 | cb_5_6 = setCombo(cb_5_6, Set, FCSettings[P_FAKTOR_I]); |
||
829 | sb_5_7->setValue(FCSettings[P_DRIFT_KOMP]); |
||
167 | KeyOz | 830 | } |
831 | // Seite 6 |
||
832 | { |
||
199 | KeyOz | 833 | cb_6_1 = setCombo(cb_6_1, Set, FCSettings[P_SERVO_NICK_CONT]); |
834 | sb_6_2->setValue(FCSettings[P_SERVO_NICK_COMP]); |
||
835 | sb_6_3->setValue(FCSettings[P_SERVO_NICK_MIN]); |
||
836 | sb_6_4->setValue(FCSettings[P_SERVO_NICK_MAX]); |
||
481 | KeyOz | 837 | |
838 | cb_6_7 = setCombo(cb_6_7, Set, FCSettings[P_SERVO_ROLL_CONT]); |
||
839 | sb_6_8->setValue(FCSettings[P_SERVO_ROLL_COMP]); |
||
840 | sb_6_10->setValue(FCSettings[P_SERVO_ROLL_MIN]); |
||
841 | sb_6_11->setValue(FCSettings[P_SERVO_ROLL_MAX]); |
||
842 | |||
843 | cb_6_6->setChecked(FCSettings[P_SERVO_COMPI] & 0x01); |
||
844 | cb_6_9->setChecked(FCSettings[P_SERVO_COMPI] & 0x02); |
||
845 | |||
846 | sb_6_5->setValue(FCSettings[P_SERVO_REFR]); |
||
167 | KeyOz | 847 | } |
848 | // Seite 7 |
||
849 | { |
||
199 | KeyOz | 850 | sb_7_1->setValue(FCSettings[P_GAS_MIN]); |
851 | sb_7_2->setValue(FCSettings[P_GAS_MAX]); |
||
852 | cb_7_3 = setCombo(cb_7_3, Set, FCSettings[P_KOMPASS_WIRKUNG]); |
||
853 | sb_7_4->setValue(FCSettings[P_UNTERSPANNUNG]); |
||
854 | sb_7_5->setValue(FCSettings[P_NOTGASZEIT]); |
||
855 | sb_7_6->setValue(FCSettings[P_NOTGAS]); |
||
167 | KeyOz | 856 | } |
857 | // Seite 8 |
||
858 | { |
||
234 | KeyOz | 859 | cb_8_1 = setCombo(cb_8_1, Set, FCSettings[P_ACHS_KOPPLUNG1]); |
860 | cb_8_2 = setCombo(cb_8_2, Set, FCSettings[P_ACHS_KOPPLUNG2]); |
||
861 | cb_8_3 = setCombo(cb_8_3, Set, FCSettings[P_ACHS_GKOPPLUNG]); |
||
167 | KeyOz | 862 | } |
863 | // Seite 9 |
||
864 | { |
||
199 | KeyOz | 865 | if (FCSettings[P_LOOP_CONFIG] & 0x01) |
167 | KeyOz | 866 | { |
867 | tb_9_6->setText("1"); |
||
227 | KeyOz | 868 | tb_9_6->setChecked(true); |
167 | KeyOz | 869 | } |
870 | else |
||
871 | { |
||
872 | tb_9_6->setText("0"); |
||
227 | KeyOz | 873 | tb_9_6->setChecked(false); |
167 | KeyOz | 874 | } |
875 | |||
199 | KeyOz | 876 | if (FCSettings[P_LOOP_CONFIG] & 0x02) |
167 | KeyOz | 877 | { |
878 | tb_9_7->setText("1"); |
||
879 | } |
||
880 | else |
||
881 | { |
||
882 | tb_9_7->setText("0"); |
||
883 | } |
||
884 | |||
199 | KeyOz | 885 | if (FCSettings[P_LOOP_CONFIG] & 0x04) |
167 | KeyOz | 886 | { |
887 | tb_9_8->setText("1"); |
||
888 | } |
||
889 | else |
||
890 | { |
||
891 | tb_9_8->setText("0"); |
||
892 | } |
||
893 | |||
199 | KeyOz | 894 | if (FCSettings[P_LOOP_CONFIG] & 0x08) |
167 | KeyOz | 895 | { |
896 | tb_9_9->setText("1"); |
||
897 | } |
||
898 | else |
||
899 | { |
||
900 | tb_9_9->setText("0"); |
||
901 | } |
||
902 | |||
199 | KeyOz | 903 | cb_9_1 = setCombo(cb_9_1, Set, FCSettings[P_LOOP_GAS_LIMIT]); |
904 | sb_9_2->setValue(FCSettings[P_LOOP_THRESHOLD]); |
||
905 | sb_9_3->setValue(FCSettings[P_WINKEL_NICK]); |
||
906 | sb_9_4->setValue(FCSettings[P_LOOP_HYSTERESE]); |
||
907 | sb_9_5->setValue(FCSettings[P_WINKEL_ROLL]); |
||
167 | KeyOz | 908 | } |
909 | // Seite 10 |
||
910 | { |
||
199 | KeyOz | 911 | cb_10_1 = setCombo(cb_10_1, Set, FCSettings[P_USER_1]); |
912 | cb_10_2 = setCombo(cb_10_2, Set, FCSettings[P_USER_2]); |
||
913 | cb_10_3 = setCombo(cb_10_3, Set, FCSettings[P_USER_3]); |
||
914 | cb_10_4 = setCombo(cb_10_4, Set, FCSettings[P_USER_4]); |
||
915 | cb_10_5 = setCombo(cb_10_5, Set, FCSettings[P_USER_5]); |
||
916 | cb_10_6 = setCombo(cb_10_6, Set, FCSettings[P_USER_6]); |
||
917 | cb_10_7 = setCombo(cb_10_7, Set, FCSettings[P_USER_7]); |
||
918 | cb_10_8 = setCombo(cb_10_8, Set, FCSettings[P_USER_8]); |
||
167 | KeyOz | 919 | } |
920 | // Seite 11 |
||
921 | { |
||
199 | KeyOz | 922 | sb_11_1->setValue(FCSettings[P_J16_BITMASK]); |
923 | cb_11_2 = setCombo(cb_11_2, Set, FCSettings[P_J16_TIMING]); |
||
924 | sb_11_3->setValue(FCSettings[P_J17_BITMASK]); |
||
925 | cb_11_4 = setCombo(cb_11_4, Set, FCSettings[P_J17_TIMING]); |
||
167 | KeyOz | 926 | } |
927 | // Seite 12 |
||
928 | { |
||
199 | KeyOz | 929 | cb_12_1 = setCombo(cb_12_1, Set, FCSettings[P_NAV_GPS_MODE]); |
930 | cb_12_2 = setCombo(cb_12_2, Set, FCSettings[P_NAV_GPS_GAIN]); |
||
931 | sb_12_3->setValue(FCSettings[P_NAV_STICK_THRE]); |
||
932 | sb_12_4->setValue(FCSettings[P_NAV_GPS_MIN]); |
||
933 | cb_12_5 = setCombo(cb_12_5, Set, FCSettings[P_NAV_GPS_P]); |
||
934 | cb_12_6 = setCombo(cb_12_6, Set, FCSettings[P_NAV_GPS_I]); |
||
935 | cb_12_7 = setCombo(cb_12_7, Set, FCSettings[P_NAV_GPS_D]); |
||
936 | cb_12_8 = setCombo(cb_12_8, Set, FCSettings[P_NAV_GPS_ACC]); |
||
234 | KeyOz | 937 | cb_12_9 = setCombo(cb_12_9, Set, FCSettings[P_NAV_GPS_P_LIMIT]); |
938 | cb_12_10 = setCombo(cb_12_10, Set, FCSettings[P_NAV_GPS_I_LIMIT]); |
||
939 | cb_12_11 = setCombo(cb_12_11, Set, FCSettings[P_NAV_GPS_D_LIMIT]); |
||
167 | KeyOz | 940 | } |
941 | // Seite 13 |
||
942 | { |
||
199 | KeyOz | 943 | cb_13_1 = setCombo(cb_13_1, Set, FCSettings[P_NAV_WIND_CORR]); |
944 | cb_13_2 = setCombo(cb_13_2, Set, FCSettings[P_NAV_SPEED_COMP]); |
||
945 | cb_13_3 = setCombo(cb_13_3, Set, FCSettings[P_NAV_RADIUS]); |
||
946 | cb_13_4 = setCombo(cb_13_4, Set, FCSettings[P_NAV_ANGLE_LIMIT]); |
||
234 | KeyOz | 947 | sb_13_5->setValue(FCSettings[P_NAV_PH_LOGINTIME]); |
167 | KeyOz | 948 | } |
949 | } |
||
950 | |||
951 | wdg_Settings::~wdg_Settings() |
||
952 | { |
||
953 | } |
||
954 |