Rev 440 | Rev 449 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 440 | Rev 442 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | 69 | ||
70 | // Connection-Object übergeben. |
70 | // Connection-Object übergeben. |
71 | void dlg_MotorMixer::set_Objects(Handler *handler, cSettings *t_Settings) |
71 | void dlg_MotorMixer::set_Objects(Handler *handler, cSettings *t_Settings) |
72 | { |
72 | { |
- | 73 | this->handler = handler; |
|
73 | this->handler = handler; |
74 | this->data = handler->data; |
74 | o_Settings = t_Settings; |
75 | o_Settings = t_Settings; |
Line 75... | Line 76... | ||
75 | } |
76 | } |
76 | 77 | ||
Line 99... | Line 100... | ||
99 | } |
100 | } |
Line 100... | Line 101... | ||
100 | 101 | ||
101 | // Motordaten aus GUI übernehmen |
102 | // Motordaten aus GUI übernehmen |
102 | void dlg_MotorMixer::get_MotorData() |
103 | void dlg_MotorMixer::get_MotorData() |
103 | { |
104 | { |
- | 105 | sMotorData motorData; |
|
104 | //FIXME: add Function in handler to send data |
106 | |
- | 107 | char * mixerName = le_NAME->text().toAscii().data(); |
|
Line 105... | Line -... | ||
105 | char * mixerName = le_NAME->text().toAscii().data(); |
- | |
106 | 108 | motorData.mixer_name = string(mixerName); |
|
107 | //TODO: use an array in Form |
109 | |
108 | int motor[16][4] = { |
110 | int gas[MAX_MOTORS] = { |
109 | sb_GAS_1->value(), sb_NICK_1->value(), sb_ROLL_1->value(), sb_GIER_1->value(), |
111 | sb_GAS_1->value(), sb_GAS_2->value(), sb_GAS_3->value(), sb_GAS_4->value(), |
- | 112 | sb_GAS_5->value(), sb_GAS_6->value(), sb_GAS_7->value(), sb_GAS_8->value(), |
|
- | 113 | sb_GAS_9->value(), sb_GAS_10->value(), sb_GAS_11->value(), sb_GAS_12->value() |
|
110 | sb_GAS_2->value(), sb_NICK_2->value(), sb_ROLL_2->value(), sb_GIER_2->value(), |
114 | }; |
111 | sb_GAS_3->value(), sb_NICK_3->value(), sb_ROLL_3->value(), sb_GIER_3->value(), |
115 | int nick[MAX_MOTORS] = { |
112 | sb_GAS_4->value(), sb_NICK_4->value(), sb_ROLL_4->value(), sb_GIER_4->value(), |
116 | sb_NICK_1->value(), sb_NICK_2->value(), sb_NICK_3->value(), sb_NICK_4->value(), |
- | 117 | sb_NICK_5->value(), sb_NICK_6->value(), sb_NICK_7->value(), sb_NICK_8->value(), |
|
- | 118 | sb_NICK_9->value(), sb_NICK_10->value(), sb_NICK_11->value(), sb_NICK_12->value() |
|
113 | sb_GAS_5->value(), sb_NICK_5->value(), sb_ROLL_5->value(), sb_GIER_5->value(), |
119 | }; |
114 | sb_GAS_6->value(), sb_NICK_6->value(), sb_ROLL_6->value(), sb_GIER_6->value(), |
120 | int roll[MAX_MOTORS] = { |
115 | sb_GAS_7->value(), sb_NICK_7->value(), sb_ROLL_7->value(), sb_GIER_7->value(), |
121 | sb_ROLL_1->value(), sb_ROLL_2->value(), sb_ROLL_3->value(), sb_ROLL_4->value(), |
- | 122 | sb_ROLL_5->value(), sb_ROLL_6->value(), sb_ROLL_7->value(), sb_ROLL_8->value(), |
|
- | 123 | sb_ROLL_9->value(), sb_ROLL_10->value(), sb_ROLL_11->value(), sb_ROLL_12->value() |
|
116 | sb_GAS_8->value(), sb_NICK_8->value(), sb_ROLL_8->value(), sb_GIER_8->value(), |
124 | }; |
117 | sb_GAS_9->value(), sb_NICK_9->value(), sb_ROLL_9->value(), sb_GIER_9->value(), |
125 | int yaw[MAX_MOTORS] = { |
118 | sb_GAS_10->value(), sb_NICK_10->value(), sb_ROLL_10->value(), sb_GIER_10->value(), |
126 | sb_GIER_1->value(), sb_GIER_2->value(), sb_GIER_3->value(), sb_GIER_4->value(), |
119 | sb_GAS_11->value(), sb_NICK_11->value(), sb_ROLL_11->value(), sb_GIER_11->value(), |
127 | sb_GIER_5->value(), sb_GIER_6->value(), sb_GIER_7->value(), sb_GIER_8->value(), |
- | 128 | sb_GIER_9->value(), sb_GIER_10->value(), sb_GIER_11->value(), sb_GIER_12->value() |
|
- | 129 | }; |
|
- | 130 | for (int i = 0; i < MAX_MOTORS; i++) { |
|
- | 131 | motorData.mixer_gas[i] = gas[i]; |
|
- | 132 | motorData.mixer_nick[i] = nick[i]; |
|
- | 133 | motorData.mixer_roll[i] = roll[i]; |
|
- | 134 | motorData.mixer_yaw[i] = yaw[i]; |
|
120 | sb_GAS_12->value(), sb_NICK_12->value(), sb_ROLL_12->value(), sb_GIER_12->value() |
135 | } |
Line 121... | Line 136... | ||
121 | }; |
136 | //FIXME: add Function in handler to send data |
122 | } |
137 | } |
123 | 138 | ||
124 | // Motordaten anzeigen |
139 | // Motordaten anzeigen |
125 | void dlg_MotorMixer::set_MotorData() |
- | |
126 | { |
140 | void dlg_MotorMixer::set_MotorData() |
Line 127... | Line 141... | ||
127 | //FIXME: create special struct for mixer - KopterData |
141 | { |
128 | /* |
142 | sMotorData motorData = handler->data->motor; |
129 | le_NAME->setText(MixerName); |
143 | le_NAME->setText(motorData.mixer_name.c_str()); |
130 | 144 | ||
131 | sb_GAS_1->setValue(Motor[0][0]); |
145 | sb_GAS_1->setValue(motorData.mixer_gas[0]); |
132 | sb_GAS_2->setValue(Motor[1][0]); |
146 | sb_GAS_2->setValue(motorData.mixer_gas[1]); |
133 | sb_GAS_3->setValue(Motor[2][0]); |
147 | sb_GAS_3->setValue(motorData.mixer_gas[2]); |
134 | sb_GAS_4->setValue(Motor[3][0]); |
148 | sb_GAS_4->setValue(motorData.mixer_gas[3]); |
135 | sb_GAS_5->setValue(Motor[4][0]); |
149 | sb_GAS_5->setValue(motorData.mixer_gas[4]); |
136 | sb_GAS_6->setValue(Motor[5][0]); |
150 | sb_GAS_6->setValue(motorData.mixer_gas[5]); |
137 | sb_GAS_7->setValue(Motor[6][0]); |
151 | sb_GAS_7->setValue(motorData.mixer_gas[6]); |
138 | sb_GAS_8->setValue(Motor[7][0]); |
152 | sb_GAS_8->setValue(motorData.mixer_gas[7]); |
139 | sb_GAS_9->setValue(Motor[8][0]); |
153 | sb_GAS_9->setValue(motorData.mixer_gas[8]); |
140 | sb_GAS_10->setValue(Motor[9][0]); |
154 | sb_GAS_10->setValue(motorData.mixer_gas[9]); |
141 | sb_GAS_11->setValue(Motor[10][0]); |
155 | sb_GAS_11->setValue(motorData.mixer_gas[10]); |
142 | sb_GAS_12->setValue(Motor[11][0]); |
156 | sb_GAS_12->setValue(motorData.mixer_gas[11]); |
143 | 157 | ||
144 | sb_NICK_1->setValue(Motor[0][1]); |
158 | sb_NICK_1->setValue(motorData.mixer_nick[0]); |
145 | sb_NICK_2->setValue(Motor[1][1]); |
159 | sb_NICK_2->setValue(motorData.mixer_nick[1]); |
146 | sb_NICK_3->setValue(Motor[2][1]); |
160 | sb_NICK_3->setValue(motorData.mixer_nick[2]); |
147 | sb_NICK_4->setValue(Motor[3][1]); |
161 | sb_NICK_4->setValue(motorData.mixer_nick[3]); |
148 | sb_NICK_5->setValue(Motor[4][1]); |
162 | sb_NICK_5->setValue(motorData.mixer_nick[4]); |
149 | sb_NICK_6->setValue(Motor[5][1]); |
163 | sb_NICK_6->setValue(motorData.mixer_nick[5]); |
150 | sb_NICK_7->setValue(Motor[6][1]); |
164 | sb_NICK_7->setValue(motorData.mixer_nick[6]); |
151 | sb_NICK_8->setValue(Motor[7][1]); |
165 | sb_NICK_8->setValue(motorData.mixer_nick[7]); |
152 | sb_NICK_9->setValue(Motor[8][1]); |
166 | sb_NICK_9->setValue(motorData.mixer_nick[8]); |
153 | sb_NICK_10->setValue(Motor[9][1]); |
167 | sb_NICK_10->setValue(motorData.mixer_nick[9]); |
154 | sb_NICK_11->setValue(Motor[10][1]); |
168 | sb_NICK_11->setValue(motorData.mixer_nick[10]); |
155 | sb_NICK_12->setValue(Motor[11][1]); |
169 | sb_NICK_12->setValue(motorData.mixer_nick[11]); |
156 | 170 | ||
157 | sb_ROLL_1->setValue(Motor[0][2]); |
171 | sb_ROLL_1->setValue(motorData.mixer_roll[0]); |
158 | sb_ROLL_2->setValue(Motor[1][2]); |
172 | sb_ROLL_2->setValue(motorData.mixer_roll[1]); |
159 | sb_ROLL_3->setValue(Motor[2][2]); |
173 | sb_ROLL_3->setValue(motorData.mixer_roll[2]); |
160 | sb_ROLL_4->setValue(Motor[3][2]); |
174 | sb_ROLL_4->setValue(motorData.mixer_roll[3]); |
161 | sb_ROLL_5->setValue(Motor[4][2]); |
175 | sb_ROLL_5->setValue(motorData.mixer_roll[4]); |
162 | sb_ROLL_6->setValue(Motor[5][2]); |
176 | sb_ROLL_6->setValue(motorData.mixer_roll[5]); |
163 | sb_ROLL_7->setValue(Motor[6][2]); |
177 | sb_ROLL_7->setValue(motorData.mixer_roll[6]); |
164 | sb_ROLL_8->setValue(Motor[7][2]); |
178 | sb_ROLL_8->setValue(motorData.mixer_roll[7]); |
165 | sb_ROLL_9->setValue(Motor[8][2]); |
179 | sb_ROLL_9->setValue(motorData.mixer_roll[8]); |
166 | sb_ROLL_10->setValue(Motor[9][2]); |
180 | sb_ROLL_10->setValue(motorData.mixer_roll[9]); |
167 | sb_ROLL_11->setValue(Motor[10][2]); |
181 | sb_ROLL_11->setValue(motorData.mixer_roll[10]); |
168 | sb_ROLL_12->setValue(Motor[11][2]); |
182 | sb_ROLL_12->setValue(motorData.mixer_roll[11]); |
169 | 183 | ||
170 | sb_GIER_1->setValue(Motor[0][3]); |
184 | sb_GIER_1->setValue(motorData.mixer_yaw[0]); |
171 | sb_GIER_2->setValue(Motor[1][3]); |
185 | sb_GIER_2->setValue(motorData.mixer_yaw[1]); |
172 | sb_GIER_3->setValue(Motor[2][3]); |
186 | sb_GIER_3->setValue(motorData.mixer_yaw[2]); |
173 | sb_GIER_4->setValue(Motor[3][3]); |
187 | sb_GIER_4->setValue(motorData.mixer_yaw[3]); |
174 | sb_GIER_5->setValue(Motor[4][3]); |
188 | sb_GIER_5->setValue(motorData.mixer_yaw[4]); |
175 | sb_GIER_6->setValue(Motor[5][3]); |
189 | sb_GIER_6->setValue(motorData.mixer_yaw[5]); |
176 | sb_GIER_7->setValue(Motor[6][3]); |
190 | sb_GIER_7->setValue(motorData.mixer_yaw[6]); |
177 | sb_GIER_8->setValue(Motor[7][3]); |
191 | sb_GIER_8->setValue(motorData.mixer_yaw[7]); |
178 | sb_GIER_9->setValue(Motor[8][3]); |
- | |
179 | sb_GIER_10->setValue(Motor[9][3]); |
192 | sb_GIER_9->setValue(motorData.mixer_yaw[8]); |
Line 180... | Line 193... | ||
180 | sb_GIER_11->setValue(Motor[10][3]); |
193 | sb_GIER_10->setValue(motorData.mixer_yaw[9]); |
181 | sb_GIER_12->setValue(Motor[11][3]); |
194 | sb_GIER_11->setValue(motorData.mixer_yaw[10]); |
182 | */ |
195 | sb_GIER_12->setValue(motorData.mixer_yaw[11]); |
183 | } |
196 | } |
Line 184... | Line 197... | ||
184 | 197 | ||
- | 198 | // Prüfen auf vollstaändigkeit |
|
- | 199 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
|
185 | // Prüfen auf vollstaändigkeit |
200 | { |
186 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
201 | Wert = Wert; |
187 | { |
202 | |
- | 203 | int NICK = sb_NICK_1->value() + sb_NICK_2->value() + sb_NICK_3->value() + |
|
- | 204 | sb_NICK_4->value() + sb_NICK_5->value() + sb_NICK_6->value() + |
|
188 | Wert = Wert; |
205 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + |
189 | 206 | sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
|
190 | int NICK = sb_NICK_1->value() + sb_NICK_2->value() + sb_NICK_3->value() + sb_NICK_4->value() + sb_NICK_5->value() + sb_NICK_6->value() + |
207 | |
- | 208 | int ROLL = sb_ROLL_1->value() + sb_ROLL_2->value() + sb_ROLL_3->value() + |
|
- | 209 | sb_ROLL_4->value() + sb_ROLL_5->value() + sb_ROLL_6->value() + |
|
191 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
210 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + |
Line 192... | Line 211... | ||
192 | 211 | sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
|
193 | int ROLL = sb_ROLL_1->value() + sb_ROLL_2->value() + sb_ROLL_3->value() + sb_ROLL_4->value() + sb_ROLL_5->value() + sb_ROLL_6->value() + |
212 | |
194 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
213 | int GIER = sb_GIER_1->value() + sb_GIER_2->value() + sb_GIER_3->value() + |
195 | 214 | sb_GIER_4->value() + sb_GIER_5->value() + sb_GIER_6->value() + |
|
Line 285... | Line 304... | ||
285 | if (!Filename.isEmpty()) |
304 | if (!Filename.isEmpty()) |
286 | { |
305 | { |
287 | QSettings Setting(Filename, QSettings::IniFormat); |
306 | QSettings Setting(Filename, QSettings::IniFormat); |
Line 288... | Line 307... | ||
288 | 307 | ||
289 | Setting.beginGroup("Info"); |
- | |
290 | //FIXME: Add mixer-struct in kopter.h for kopterdata |
308 | Setting.beginGroup("Info"); |
291 | // MixerName = Setting.value("Name", QString("--noname--")).toString(); |
309 | data->motor.mixer_name = Setting.value("Name", QString("--noname--")).toString().toAscii().data(); |
292 | // MixerVersion = Setting.value("Version", 0).toInt(); |
310 | data->motor.mixer_version = Setting.value("Version", 0).toInt(); |
Line 293... | Line -... | ||
293 | Setting.endGroup(); |
- | |
294 | - | ||
295 | //FIXME: Add mixer-struct in kopter.h for kopterdata |
311 | Setting.endGroup(); |
296 | /* |
312 | |
297 | Setting.beginGroup("Gas"); |
313 | Setting.beginGroup("Gas"); |
298 | for (int z = 0; z < MAXMOTOR; z++) |
314 | for (int z = 0; z < MAXMOTOR; z++) |
299 | { |
315 | { |
300 | Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
316 | data->motor.mixer_gas[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
Line 301... | Line 317... | ||
301 | } |
317 | } |
302 | Setting.endGroup(); |
318 | Setting.endGroup(); |
303 | 319 | ||
304 | Setting.beginGroup("Nick"); |
320 | Setting.beginGroup("Nick"); |
305 | for (int z = 0; z < MAXMOTOR; z++) |
321 | for (int z = 0; z < MAXMOTOR; z++) |
306 | { |
322 | { |
Line 307... | Line 323... | ||
307 | Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
323 | data->motor.mixer_nick[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
308 | } |
324 | } |
309 | Setting.endGroup(); |
325 | Setting.endGroup(); |
310 | 326 | ||
311 | Setting.beginGroup("Roll"); |
327 | Setting.beginGroup("Roll"); |
312 | for (int z = 0; z < MAXMOTOR; z++) |
328 | for (int z = 0; z < MAXMOTOR; z++) |
Line 313... | Line 329... | ||
313 | { |
329 | { |
314 | Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
330 | data->motor.mixer_roll[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
315 | } |
331 | } |
316 | Setting.endGroup(); |
332 | Setting.endGroup(); |
317 | 333 | ||
318 | Setting.beginGroup("Yaw"); |
334 | Setting.beginGroup("Yaw"); |
- | 335 | for (int z = 0; z < MAXMOTOR; z++) |
|
319 | for (int z = 0; z < MAXMOTOR; z++) |
336 | { |
320 | { |
337 | data->motor.mixer_yaw[z] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
321 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
338 | } |
322 | } |
339 | Setting.endGroup(); |
323 | Setting.endGroup(); |
- | |
324 | if (MixerVersion == VERSION_MIXER) |
340 | |
325 | { |
341 | if (data->motor.mixer_version == VERSION_MIXER) |
Line 326... | Line 342... | ||
326 | set_MotorData(); |
342 | { |
327 | } |
343 | set_MotorData(); |
Line 343... | Line 359... | ||
343 | get_MotorData(); |
359 | get_MotorData(); |
Line 344... | Line 360... | ||
344 | 360 | ||
Line 345... | Line 361... | ||
345 | QSettings Setting(Filename, QSettings::IniFormat); |
361 | QSettings Setting(Filename, QSettings::IniFormat); |
346 | - | ||
347 | Setting.beginGroup("Info"); |
- | |
348 | //FIXME: Add mixer-struct in kopter.h for kopterdata - doppelter Code!!! |
362 | |
349 | /* |
363 | Setting.beginGroup("Info"); |
350 | Setting.setValue("Name", MixerName); |
364 | Setting.setValue("Name", data->motor.mixer_name.c_str()); |
Line 351... | Line 365... | ||
351 | Setting.setValue("Version", VERSION_MIXER); |
365 | Setting.setValue("Version", data->motor.mixer_version); |
352 | Setting.endGroup(); |
366 | Setting.endGroup(); |
353 | 367 | ||
354 | Setting.beginGroup("Gas"); |
368 | Setting.beginGroup("Gas"); |
355 | for (int z = 0; z < MAXMOTOR; z++) |
369 | for (int z = 0; z < MAXMOTOR; z++) |
356 | { |
370 | { |
Line 357... | Line 371... | ||
357 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]); |
371 | Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_gas[z]); |
358 | } |
372 | } |
359 | Setting.endGroup(); |
373 | Setting.endGroup(); |
360 | 374 | ||
361 | Setting.beginGroup("Nick"); |
375 | Setting.beginGroup("Nick"); |
362 | for (int z = 0; z < MAXMOTOR; z++) |
376 | for (int z = 0; z < MAXMOTOR; z++) |
Line 363... | Line 377... | ||
363 | { |
377 | { |
364 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]); |
378 | Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_nick[z]); |
365 | } |
379 | } |
366 | Setting.endGroup(); |
380 | Setting.endGroup(); |
367 | 381 | ||
368 | Setting.beginGroup("Roll"); |
382 | Setting.beginGroup("Roll"); |
Line 369... | Line 383... | ||
369 | for (int z = 0; z < MAXMOTOR; z++) |
383 | for (int z = 0; z < MAXMOTOR; z++) |
370 | { |
384 | { |
371 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]); |
385 | Setting.setValue(QString("Motor%1").arg(z+1), data->motor.mixer_roll[z]); |
372 | } |
386 | } |
373 | Setting.endGroup(); |
387 | Setting.endGroup(); |
374 | 388 | ||
375 | Setting.beginGroup("Yaw"); |
- | |
376 | for (int z = 0; z < MAXMOTOR; z++) |
389 | Setting.beginGroup("Yaw"); |
377 | { |
390 | for (int z = 0; z < MAXMOTOR; z++) |