Rev 399 | Rev 442 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 399 | Rev 440 | ||
---|---|---|---|
Line 75... | Line 75... | ||
75 | } |
75 | } |
Line 76... | Line 76... | ||
76 | 76 | ||
77 | // Motordaten übernehmen. |
77 | // Motordaten übernehmen. |
78 | void dlg_MotorMixer::set_MotorConfig(sRxData RX) |
78 | void dlg_MotorMixer::set_MotorConfig(sRxData RX) |
- | 79 | { |
|
- | 80 | //FIXME: put this in libMK/Handler.cpp and fill motor values in KopterData |
|
79 | { |
81 | /* |
Line 80... | Line 82... | ||
80 | int Pos = 0; |
82 | int Pos = 0; |
Line 81... | Line 83... | ||
81 | 83 | ||
Line 91... | Line 93... | ||
91 | Pos++; |
93 | Pos++; |
92 | } |
94 | } |
93 | } |
95 | } |
Line 94... | Line 96... | ||
94 | 96 | ||
- | 97 | set_MotorData(); |
|
95 | set_MotorData(); |
98 | */ |
Line 96... | Line 99... | ||
96 | } |
99 | } |
97 | 100 | ||
98 | // Motordaten aus GUI übernehmen |
101 | // Motordaten aus GUI übernehmen |
- | 102 | void dlg_MotorMixer::get_MotorData() |
|
99 | void dlg_MotorMixer::get_MotorData() |
103 | { |
Line 100... | Line -... | ||
100 | { |
- | |
101 | MixerName = le_NAME->text(); |
- | |
102 | - | ||
103 | Motor[0][0] = sb_GAS_1->value(); |
- | |
104 | Motor[1][0] = sb_GAS_2->value(); |
- | |
105 | Motor[2][0] = sb_GAS_3->value(); |
- | |
106 | Motor[3][0] = sb_GAS_4->value(); |
- | |
107 | Motor[4][0] = sb_GAS_5->value(); |
104 | //FIXME: add Function in handler to send data |
108 | Motor[5][0] = sb_GAS_6->value(); |
- | |
109 | Motor[6][0] = sb_GAS_7->value(); |
- | |
110 | Motor[7][0] = sb_GAS_8->value(); |
- | |
111 | Motor[8][0] = sb_GAS_9->value(); |
105 | char * mixerName = le_NAME->text().toAscii().data(); |
112 | Motor[9][0] = sb_GAS_10->value(); |
- | |
113 | Motor[10][0] = sb_GAS_11->value(); |
- | |
114 | Motor[11][0] = sb_GAS_12->value(); |
- | |
115 | - | ||
116 | Motor[0][1] = sb_NICK_1->value(); |
- | |
117 | Motor[1][1] = sb_NICK_2->value(); |
- | |
118 | Motor[2][1] = sb_NICK_3->value(); |
- | |
119 | Motor[3][1] = sb_NICK_4->value(); |
- | |
120 | Motor[4][1] = sb_NICK_5->value(); |
- | |
121 | Motor[5][1] = sb_NICK_6->value(); |
- | |
122 | Motor[6][1] = sb_NICK_7->value(); |
- | |
123 | Motor[7][1] = sb_NICK_8->value(); |
106 | |
124 | Motor[8][1] = sb_NICK_9->value(); |
- | |
125 | Motor[9][1] = sb_NICK_10->value(); |
- | |
126 | Motor[10][1] = sb_NICK_11->value(); |
- | |
127 | Motor[11][1] = sb_NICK_12->value(); |
107 | //TODO: use an array in Form |
128 | 108 | int motor[16][4] = { |
|
129 | Motor[0][2] = sb_ROLL_1->value(); |
109 | sb_GAS_1->value(), sb_NICK_1->value(), sb_ROLL_1->value(), sb_GIER_1->value(), |
130 | Motor[1][2] = sb_ROLL_2->value(); |
110 | sb_GAS_2->value(), sb_NICK_2->value(), sb_ROLL_2->value(), sb_GIER_2->value(), |
131 | Motor[2][2] = sb_ROLL_3->value(); |
111 | sb_GAS_3->value(), sb_NICK_3->value(), sb_ROLL_3->value(), sb_GIER_3->value(), |
132 | Motor[3][2] = sb_ROLL_4->value(); |
112 | sb_GAS_4->value(), sb_NICK_4->value(), sb_ROLL_4->value(), sb_GIER_4->value(), |
133 | Motor[4][2] = sb_ROLL_5->value(); |
113 | sb_GAS_5->value(), sb_NICK_5->value(), sb_ROLL_5->value(), sb_GIER_5->value(), |
134 | Motor[5][2] = sb_ROLL_6->value(); |
114 | sb_GAS_6->value(), sb_NICK_6->value(), sb_ROLL_6->value(), sb_GIER_6->value(), |
135 | Motor[6][2] = sb_ROLL_7->value(); |
115 | sb_GAS_7->value(), sb_NICK_7->value(), sb_ROLL_7->value(), sb_GIER_7->value(), |
136 | Motor[7][2] = sb_ROLL_8->value(); |
116 | sb_GAS_8->value(), sb_NICK_8->value(), sb_ROLL_8->value(), sb_GIER_8->value(), |
137 | Motor[8][2] = sb_ROLL_9->value(); |
117 | sb_GAS_9->value(), sb_NICK_9->value(), sb_ROLL_9->value(), sb_GIER_9->value(), |
138 | Motor[9][2] = sb_ROLL_10->value(); |
118 | sb_GAS_10->value(), sb_NICK_10->value(), sb_ROLL_10->value(), sb_GIER_10->value(), |
139 | Motor[10][2] = sb_ROLL_11->value(); |
- | |
140 | Motor[11][2] = sb_ROLL_12->value(); |
- | |
141 | - | ||
142 | Motor[0][3] = sb_GIER_1->value(); |
- | |
143 | Motor[1][3] = sb_GIER_2->value(); |
- | |
144 | Motor[2][3] = sb_GIER_3->value(); |
- | |
145 | Motor[3][3] = sb_GIER_4->value(); |
- | |
146 | Motor[4][3] = sb_GIER_5->value(); |
- | |
147 | Motor[5][3] = sb_GIER_6->value(); |
- | |
148 | Motor[6][3] = sb_GIER_7->value(); |
- | |
149 | Motor[7][3] = sb_GIER_8->value(); |
- | |
150 | Motor[8][3] = sb_GIER_9->value(); |
- | |
151 | Motor[9][3] = sb_GIER_10->value(); |
119 | sb_GAS_11->value(), sb_NICK_11->value(), sb_ROLL_11->value(), sb_GIER_11->value(), |
Line 152... | Line 120... | ||
152 | Motor[10][3] = sb_GIER_11->value(); |
120 | sb_GAS_12->value(), sb_NICK_12->value(), sb_ROLL_12->value(), sb_GIER_12->value() |
153 | Motor[11][3] = sb_GIER_12->value(); |
121 | }; |
154 | } |
122 | } |
- | 123 | ||
- | 124 | // Motordaten anzeigen |
|
155 | 125 | void dlg_MotorMixer::set_MotorData() |
|
Line 156... | Line 126... | ||
156 | // Motordaten anzeigen |
126 | { |
157 | void dlg_MotorMixer::set_MotorData() |
127 | //FIXME: create special struct for mixer - KopterData |
158 | { |
128 | /* |
Line 207... | Line 177... | ||
207 | sb_GIER_8->setValue(Motor[7][3]); |
177 | sb_GIER_8->setValue(Motor[7][3]); |
208 | sb_GIER_9->setValue(Motor[8][3]); |
178 | sb_GIER_9->setValue(Motor[8][3]); |
209 | sb_GIER_10->setValue(Motor[9][3]); |
179 | sb_GIER_10->setValue(Motor[9][3]); |
210 | sb_GIER_11->setValue(Motor[10][3]); |
180 | sb_GIER_11->setValue(Motor[10][3]); |
211 | sb_GIER_12->setValue(Motor[11][3]); |
181 | sb_GIER_12->setValue(Motor[11][3]); |
- | 182 | */ |
|
212 | } |
183 | } |
Line 213... | Line 184... | ||
213 | 184 | ||
214 | // Prüfen auf vollstaändigkeit |
185 | // Prüfen auf vollstaändigkeit |
215 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
186 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
Line 251... | Line 222... | ||
251 | { |
222 | { |
252 | lb_GIER->setEnabled(false); |
223 | lb_GIER->setEnabled(false); |
253 | } |
224 | } |
254 | } |
225 | } |
Line 255... | Line 226... | ||
255 | 226 | ||
256 | //FIXME: put this in com/Handler.cpp |
227 | //FIXME: put this in libMK/Handler.cpp |
257 | /* |
228 | /* |
258 | int dlg_MotorMixer::get_MotorConfig() |
229 | int dlg_MotorMixer::get_MotorConfig() |
259 | { |
230 | { |
Line 287... | Line 258... | ||
287 | } |
258 | } |
288 | } |
259 | } |
Line 289... | Line 260... | ||
289 | 260 | ||
290 | return Pos - 1; |
261 | return Pos - 1; |
291 | } |
- | |
292 | - | ||
293 | void dlg_MotorMixer::read_Mixer() |
- | |
294 | { |
- | |
295 | //See Handler::read_mixer in com/Handler.cpp |
262 | } |
Line 296... | Line 263... | ||
296 | }*/ |
263 | */ |
297 | 264 | ||
298 | // read motor values |
265 | // read motor values |
299 | void dlg_MotorMixer::slot_pb_READ() |
266 | void dlg_MotorMixer::slot_pb_READ() |
300 | { |
267 | { |
301 | //send command to get mixer values |
268 | //send command to get mixer values |
Line 302... | Line 269... | ||
302 | handler->read_mixer(); |
269 | handler->read_motor_mixer(); |
303 | } |
270 | } |
304 | - | ||
305 | //write motor values |
271 | |
306 | //FIXME: put this in com/Handler.cpp |
272 | //write motor values |
- | 273 | //FIXME: put this in libMK/Handler.cpp |
|
307 | 274 | void dlg_MotorMixer::slot_pb_WRITE() |
|
308 | void dlg_MotorMixer::slot_pb_WRITE() |
275 | { |
309 | { |
276 | char tx_data[150]; |
Line 310... | Line 277... | ||
310 | /* int Length = handler->get_motor_config(); |
277 | int length = handler->get_motor_config(tx_data); |
311 | handler->write_mixer(TX_Data, Length);*/ |
278 | handler->write_motor_mixer(tx_data, length); |
312 | } |
279 | } |
Line 318... | Line 285... | ||
318 | if (!Filename.isEmpty()) |
285 | if (!Filename.isEmpty()) |
319 | { |
286 | { |
320 | QSettings Setting(Filename, QSettings::IniFormat); |
287 | QSettings Setting(Filename, QSettings::IniFormat); |
Line 321... | Line 288... | ||
321 | 288 | ||
- | 289 | Setting.beginGroup("Info"); |
|
322 | Setting.beginGroup("Info"); |
290 | //FIXME: Add mixer-struct in kopter.h for kopterdata |
323 | MixerName = Setting.value("Name", QString("--noname--")).toString(); |
291 | // MixerName = Setting.value("Name", QString("--noname--")).toString(); |
324 | MixerVersion = Setting.value("Version", 0).toInt(); |
292 | // MixerVersion = Setting.value("Version", 0).toInt(); |
Line -... | Line 293... | ||
- | 293 | Setting.endGroup(); |
|
- | 294 | ||
325 | Setting.endGroup(); |
295 | //FIXME: Add mixer-struct in kopter.h for kopterdata |
326 | 296 | /* |
|
327 | Setting.beginGroup("Gas"); |
297 | Setting.beginGroup("Gas"); |
328 | for (int z = 0; z < MAXMOTOR; z++) |
298 | for (int z = 0; z < MAXMOTOR; z++) |
329 | { |
299 | { |
Line 349... | Line 319... | ||
349 | for (int z = 0; z < MAXMOTOR; z++) |
319 | for (int z = 0; z < MAXMOTOR; z++) |
350 | { |
320 | { |
351 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
321 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
352 | } |
322 | } |
353 | Setting.endGroup(); |
323 | Setting.endGroup(); |
354 | - | ||
355 | if (MixerVersion == VERSION_MIXER) |
324 | if (MixerVersion == VERSION_MIXER) |
356 | { |
325 | { |
357 | set_MotorData(); |
326 | set_MotorData(); |
358 | } |
327 | } |
- | 328 | */ |
|
359 | } |
329 | } |
360 | } |
330 | } |
Line 361... | Line 331... | ||
361 | 331 | ||
362 | void dlg_MotorMixer::slot_pb_SAVE() |
332 | void dlg_MotorMixer::slot_pb_SAVE() |
Line 373... | Line 343... | ||
373 | get_MotorData(); |
343 | get_MotorData(); |
Line 374... | Line 344... | ||
374 | 344 | ||
Line 375... | Line 345... | ||
375 | QSettings Setting(Filename, QSettings::IniFormat); |
345 | QSettings Setting(Filename, QSettings::IniFormat); |
- | 346 | ||
- | 347 | Setting.beginGroup("Info"); |
|
376 | 348 | //FIXME: Add mixer-struct in kopter.h for kopterdata - doppelter Code!!! |
|
377 | Setting.beginGroup("Info"); |
349 | /* |
378 | Setting.setValue("Name", MixerName); |
350 | Setting.setValue("Name", MixerName); |
Line 379... | Line 351... | ||
379 | Setting.setValue("Version", VERSION_MIXER); |
351 | Setting.setValue("Version", VERSION_MIXER); |
Line 404... | Line 376... | ||
404 | for (int z = 0; z < MAXMOTOR; z++) |
376 | for (int z = 0; z < MAXMOTOR; z++) |
405 | { |
377 | { |
406 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
378 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
407 | } |
379 | } |
408 | Setting.endGroup(); |
380 | Setting.endGroup(); |
- | 381 | */ |
|
409 | } |
382 | } |
410 | } |
383 | } |