Rev 396 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 396 | Rev 399 | ||
---|---|---|---|
1 | /*************************************************************************** |
1 | /*************************************************************************** |
2 | * Copyright (C) 2009 by Manuel Schrape * |
2 | * Copyright (C) 2009 by Manuel Schrape * |
3 | * manuel.schrape@gmx.de * |
3 | * manuel.schrape@gmx.de * |
4 | * * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
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 * |
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. * |
7 | * the Free Software Foundation; either version 2 of the License. * |
8 | * * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
12 | * GNU General Public License for more details. * |
13 | * * |
13 | * * |
14 | * You should have received a copy of the GNU General Public License * |
14 | * You should have received a copy of the GNU General Public License * |
15 | * along with this program; if not, write to the * |
15 | * along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
16 | * Free Software Foundation, Inc., * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | ***************************************************************************/ |
18 | ***************************************************************************/ |
19 | #include "dlg_MotorMixer.h" |
19 | #include "dlg_MotorMixer.h" |
20 | 20 | ||
21 | dlg_MotorMixer::dlg_MotorMixer(QWidget *parent) : QDialog(parent) |
21 | dlg_MotorMixer::dlg_MotorMixer(QWidget *parent) : QDialog(parent) |
22 | { |
22 | { |
23 | setupUi(this); |
23 | setupUi(this); |
24 | connect(pb_READ, SIGNAL(clicked()), this, SLOT(slot_pb_READ())); |
24 | connect(pb_READ, SIGNAL(clicked()), this, SLOT(slot_pb_READ())); |
25 | connect(pb_LOAD, SIGNAL(clicked()), this, SLOT(slot_pb_LOAD())); |
25 | connect(pb_LOAD, SIGNAL(clicked()), this, SLOT(slot_pb_LOAD())); |
26 | connect(pb_SAVE, SIGNAL(clicked()), this, SLOT(slot_pb_SAVE())); |
26 | connect(pb_SAVE, SIGNAL(clicked()), this, SLOT(slot_pb_SAVE())); |
27 | connect(pb_WRITE, SIGNAL(clicked()), this, SLOT(slot_pb_WRITE())); |
27 | connect(pb_WRITE, SIGNAL(clicked()), this, SLOT(slot_pb_WRITE())); |
28 | 28 | ||
29 | connect(sb_NICK_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
29 | connect(sb_NICK_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
30 | connect(sb_NICK_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
30 | connect(sb_NICK_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
31 | connect(sb_NICK_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
31 | connect(sb_NICK_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
32 | connect(sb_NICK_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
32 | connect(sb_NICK_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
33 | connect(sb_NICK_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
33 | connect(sb_NICK_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
34 | connect(sb_NICK_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
34 | connect(sb_NICK_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
35 | connect(sb_NICK_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
35 | connect(sb_NICK_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
36 | connect(sb_NICK_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
36 | connect(sb_NICK_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
37 | connect(sb_NICK_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
37 | connect(sb_NICK_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
38 | connect(sb_NICK_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
38 | connect(sb_NICK_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
39 | connect(sb_NICK_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
39 | connect(sb_NICK_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
40 | connect(sb_NICK_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
40 | connect(sb_NICK_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
41 | 41 | ||
42 | connect(sb_ROLL_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
42 | connect(sb_ROLL_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
43 | connect(sb_ROLL_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
43 | connect(sb_ROLL_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
44 | connect(sb_ROLL_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
44 | connect(sb_ROLL_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
45 | connect(sb_ROLL_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
45 | connect(sb_ROLL_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
46 | connect(sb_ROLL_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
46 | connect(sb_ROLL_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
47 | connect(sb_ROLL_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
47 | connect(sb_ROLL_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
48 | connect(sb_ROLL_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
48 | connect(sb_ROLL_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
49 | connect(sb_ROLL_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
49 | connect(sb_ROLL_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
50 | connect(sb_ROLL_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
50 | connect(sb_ROLL_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
51 | connect(sb_ROLL_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
51 | connect(sb_ROLL_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
52 | connect(sb_ROLL_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
52 | connect(sb_ROLL_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
53 | connect(sb_ROLL_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
53 | connect(sb_ROLL_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
54 | 54 | ||
55 | connect(sb_GIER_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
55 | connect(sb_GIER_1, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
56 | connect(sb_GIER_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
56 | connect(sb_GIER_2, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
57 | connect(sb_GIER_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
57 | connect(sb_GIER_3, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
58 | connect(sb_GIER_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
58 | connect(sb_GIER_4, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
59 | connect(sb_GIER_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
59 | connect(sb_GIER_5, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
60 | connect(sb_GIER_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
60 | connect(sb_GIER_6, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
61 | connect(sb_GIER_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
61 | connect(sb_GIER_7, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
62 | connect(sb_GIER_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
62 | connect(sb_GIER_8, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
63 | connect(sb_GIER_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
63 | connect(sb_GIER_9, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
64 | connect(sb_GIER_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
64 | connect(sb_GIER_10, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
65 | connect(sb_GIER_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
65 | connect(sb_GIER_11, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
66 | connect(sb_GIER_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
66 | connect(sb_GIER_12, SIGNAL(valueChanged(int)), this, SLOT(slot_CheckValue(int))); |
67 | 67 | ||
68 | } |
68 | } |
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 | o_Settings = t_Settings; |
74 | o_Settings = t_Settings; |
75 | } |
75 | } |
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 | { |
79 | { |
80 | int Pos = 0; |
80 | int Pos = 0; |
81 | 81 | ||
82 | MixerName = ToolBox::dataToQString(RX.decode, 1, 12); |
82 | MixerName = ToolBox::dataToQString(RX.decode, 1, 12); |
83 | 83 | ||
84 | Pos = 13; |
84 | Pos = 13; |
85 | 85 | ||
86 | for (int z = 0; z < 16; z++) |
86 | for (int z = 0; z < 16; z++) |
87 | { |
87 | { |
88 | for (int y = 0; y < 4; y++) |
88 | for (int y = 0; y < 4; y++) |
89 | { |
89 | { |
90 | Motor[z][y] = Parser::dataToChar(RX.decode,Pos); |
90 | Motor[z][y] = Parser::dataToChar(RX.decode,Pos); |
91 | Pos++; |
91 | Pos++; |
92 | } |
92 | } |
93 | } |
93 | } |
94 | 94 | ||
95 | set_MotorData(); |
95 | set_MotorData(); |
96 | } |
96 | } |
97 | 97 | ||
98 | // Motordaten aus GUI übernehmen |
98 | // Motordaten aus GUI übernehmen |
99 | void dlg_MotorMixer::get_MotorData() |
99 | void dlg_MotorMixer::get_MotorData() |
100 | { |
100 | { |
101 | MixerName = le_NAME->text(); |
101 | MixerName = le_NAME->text(); |
102 | 102 | ||
103 | Motor[0][0] = sb_GAS_1->value(); |
103 | Motor[0][0] = sb_GAS_1->value(); |
104 | Motor[1][0] = sb_GAS_2->value(); |
104 | Motor[1][0] = sb_GAS_2->value(); |
105 | Motor[2][0] = sb_GAS_3->value(); |
105 | Motor[2][0] = sb_GAS_3->value(); |
106 | Motor[3][0] = sb_GAS_4->value(); |
106 | Motor[3][0] = sb_GAS_4->value(); |
107 | Motor[4][0] = sb_GAS_5->value(); |
107 | Motor[4][0] = sb_GAS_5->value(); |
108 | Motor[5][0] = sb_GAS_6->value(); |
108 | Motor[5][0] = sb_GAS_6->value(); |
109 | Motor[6][0] = sb_GAS_7->value(); |
109 | Motor[6][0] = sb_GAS_7->value(); |
110 | Motor[7][0] = sb_GAS_8->value(); |
110 | Motor[7][0] = sb_GAS_8->value(); |
111 | Motor[8][0] = sb_GAS_9->value(); |
111 | Motor[8][0] = sb_GAS_9->value(); |
112 | Motor[9][0] = sb_GAS_10->value(); |
112 | Motor[9][0] = sb_GAS_10->value(); |
113 | Motor[10][0] = sb_GAS_11->value(); |
113 | Motor[10][0] = sb_GAS_11->value(); |
114 | Motor[11][0] = sb_GAS_12->value(); |
114 | Motor[11][0] = sb_GAS_12->value(); |
115 | 115 | ||
116 | Motor[0][1] = sb_NICK_1->value(); |
116 | Motor[0][1] = sb_NICK_1->value(); |
117 | Motor[1][1] = sb_NICK_2->value(); |
117 | Motor[1][1] = sb_NICK_2->value(); |
118 | Motor[2][1] = sb_NICK_3->value(); |
118 | Motor[2][1] = sb_NICK_3->value(); |
119 | Motor[3][1] = sb_NICK_4->value(); |
119 | Motor[3][1] = sb_NICK_4->value(); |
120 | Motor[4][1] = sb_NICK_5->value(); |
120 | Motor[4][1] = sb_NICK_5->value(); |
121 | Motor[5][1] = sb_NICK_6->value(); |
121 | Motor[5][1] = sb_NICK_6->value(); |
122 | Motor[6][1] = sb_NICK_7->value(); |
122 | Motor[6][1] = sb_NICK_7->value(); |
123 | Motor[7][1] = sb_NICK_8->value(); |
123 | Motor[7][1] = sb_NICK_8->value(); |
124 | Motor[8][1] = sb_NICK_9->value(); |
124 | Motor[8][1] = sb_NICK_9->value(); |
125 | Motor[9][1] = sb_NICK_10->value(); |
125 | Motor[9][1] = sb_NICK_10->value(); |
126 | Motor[10][1] = sb_NICK_11->value(); |
126 | Motor[10][1] = sb_NICK_11->value(); |
127 | Motor[11][1] = sb_NICK_12->value(); |
127 | Motor[11][1] = sb_NICK_12->value(); |
128 | 128 | ||
129 | Motor[0][2] = sb_ROLL_1->value(); |
129 | Motor[0][2] = sb_ROLL_1->value(); |
130 | Motor[1][2] = sb_ROLL_2->value(); |
130 | Motor[1][2] = sb_ROLL_2->value(); |
131 | Motor[2][2] = sb_ROLL_3->value(); |
131 | Motor[2][2] = sb_ROLL_3->value(); |
132 | Motor[3][2] = sb_ROLL_4->value(); |
132 | Motor[3][2] = sb_ROLL_4->value(); |
133 | Motor[4][2] = sb_ROLL_5->value(); |
133 | Motor[4][2] = sb_ROLL_5->value(); |
134 | Motor[5][2] = sb_ROLL_6->value(); |
134 | Motor[5][2] = sb_ROLL_6->value(); |
135 | Motor[6][2] = sb_ROLL_7->value(); |
135 | Motor[6][2] = sb_ROLL_7->value(); |
136 | Motor[7][2] = sb_ROLL_8->value(); |
136 | Motor[7][2] = sb_ROLL_8->value(); |
137 | Motor[8][2] = sb_ROLL_9->value(); |
137 | Motor[8][2] = sb_ROLL_9->value(); |
138 | Motor[9][2] = sb_ROLL_10->value(); |
138 | Motor[9][2] = sb_ROLL_10->value(); |
139 | Motor[10][2] = sb_ROLL_11->value(); |
139 | Motor[10][2] = sb_ROLL_11->value(); |
140 | Motor[11][2] = sb_ROLL_12->value(); |
140 | Motor[11][2] = sb_ROLL_12->value(); |
141 | 141 | ||
142 | Motor[0][3] = sb_GIER_1->value(); |
142 | Motor[0][3] = sb_GIER_1->value(); |
143 | Motor[1][3] = sb_GIER_2->value(); |
143 | Motor[1][3] = sb_GIER_2->value(); |
144 | Motor[2][3] = sb_GIER_3->value(); |
144 | Motor[2][3] = sb_GIER_3->value(); |
145 | Motor[3][3] = sb_GIER_4->value(); |
145 | Motor[3][3] = sb_GIER_4->value(); |
146 | Motor[4][3] = sb_GIER_5->value(); |
146 | Motor[4][3] = sb_GIER_5->value(); |
147 | Motor[5][3] = sb_GIER_6->value(); |
147 | Motor[5][3] = sb_GIER_6->value(); |
148 | Motor[6][3] = sb_GIER_7->value(); |
148 | Motor[6][3] = sb_GIER_7->value(); |
149 | Motor[7][3] = sb_GIER_8->value(); |
149 | Motor[7][3] = sb_GIER_8->value(); |
150 | Motor[8][3] = sb_GIER_9->value(); |
150 | Motor[8][3] = sb_GIER_9->value(); |
151 | Motor[9][3] = sb_GIER_10->value(); |
151 | Motor[9][3] = sb_GIER_10->value(); |
152 | Motor[10][3] = sb_GIER_11->value(); |
152 | Motor[10][3] = sb_GIER_11->value(); |
153 | Motor[11][3] = sb_GIER_12->value(); |
153 | Motor[11][3] = sb_GIER_12->value(); |
154 | } |
154 | } |
155 | 155 | ||
156 | // Motordaten anzeigen |
156 | // Motordaten anzeigen |
157 | void dlg_MotorMixer::set_MotorData() |
157 | void dlg_MotorMixer::set_MotorData() |
158 | { |
158 | { |
159 | le_NAME->setText(MixerName); |
159 | le_NAME->setText(MixerName); |
160 | 160 | ||
161 | sb_GAS_1->setValue(Motor[0][0]); |
161 | sb_GAS_1->setValue(Motor[0][0]); |
162 | sb_GAS_2->setValue(Motor[1][0]); |
162 | sb_GAS_2->setValue(Motor[1][0]); |
163 | sb_GAS_3->setValue(Motor[2][0]); |
163 | sb_GAS_3->setValue(Motor[2][0]); |
164 | sb_GAS_4->setValue(Motor[3][0]); |
164 | sb_GAS_4->setValue(Motor[3][0]); |
165 | sb_GAS_5->setValue(Motor[4][0]); |
165 | sb_GAS_5->setValue(Motor[4][0]); |
166 | sb_GAS_6->setValue(Motor[5][0]); |
166 | sb_GAS_6->setValue(Motor[5][0]); |
167 | sb_GAS_7->setValue(Motor[6][0]); |
167 | sb_GAS_7->setValue(Motor[6][0]); |
168 | sb_GAS_8->setValue(Motor[7][0]); |
168 | sb_GAS_8->setValue(Motor[7][0]); |
169 | sb_GAS_9->setValue(Motor[8][0]); |
169 | sb_GAS_9->setValue(Motor[8][0]); |
170 | sb_GAS_10->setValue(Motor[9][0]); |
170 | sb_GAS_10->setValue(Motor[9][0]); |
171 | sb_GAS_11->setValue(Motor[10][0]); |
171 | sb_GAS_11->setValue(Motor[10][0]); |
172 | sb_GAS_12->setValue(Motor[11][0]); |
172 | sb_GAS_12->setValue(Motor[11][0]); |
173 | 173 | ||
174 | sb_NICK_1->setValue(Motor[0][1]); |
174 | sb_NICK_1->setValue(Motor[0][1]); |
175 | sb_NICK_2->setValue(Motor[1][1]); |
175 | sb_NICK_2->setValue(Motor[1][1]); |
176 | sb_NICK_3->setValue(Motor[2][1]); |
176 | sb_NICK_3->setValue(Motor[2][1]); |
177 | sb_NICK_4->setValue(Motor[3][1]); |
177 | sb_NICK_4->setValue(Motor[3][1]); |
178 | sb_NICK_5->setValue(Motor[4][1]); |
178 | sb_NICK_5->setValue(Motor[4][1]); |
179 | sb_NICK_6->setValue(Motor[5][1]); |
179 | sb_NICK_6->setValue(Motor[5][1]); |
180 | sb_NICK_7->setValue(Motor[6][1]); |
180 | sb_NICK_7->setValue(Motor[6][1]); |
181 | sb_NICK_8->setValue(Motor[7][1]); |
181 | sb_NICK_8->setValue(Motor[7][1]); |
182 | sb_NICK_9->setValue(Motor[8][1]); |
182 | sb_NICK_9->setValue(Motor[8][1]); |
183 | sb_NICK_10->setValue(Motor[9][1]); |
183 | sb_NICK_10->setValue(Motor[9][1]); |
184 | sb_NICK_11->setValue(Motor[10][1]); |
184 | sb_NICK_11->setValue(Motor[10][1]); |
185 | sb_NICK_12->setValue(Motor[11][1]); |
185 | sb_NICK_12->setValue(Motor[11][1]); |
186 | 186 | ||
187 | sb_ROLL_1->setValue(Motor[0][2]); |
187 | sb_ROLL_1->setValue(Motor[0][2]); |
188 | sb_ROLL_2->setValue(Motor[1][2]); |
188 | sb_ROLL_2->setValue(Motor[1][2]); |
189 | sb_ROLL_3->setValue(Motor[2][2]); |
189 | sb_ROLL_3->setValue(Motor[2][2]); |
190 | sb_ROLL_4->setValue(Motor[3][2]); |
190 | sb_ROLL_4->setValue(Motor[3][2]); |
191 | sb_ROLL_5->setValue(Motor[4][2]); |
191 | sb_ROLL_5->setValue(Motor[4][2]); |
192 | sb_ROLL_6->setValue(Motor[5][2]); |
192 | sb_ROLL_6->setValue(Motor[5][2]); |
193 | sb_ROLL_7->setValue(Motor[6][2]); |
193 | sb_ROLL_7->setValue(Motor[6][2]); |
194 | sb_ROLL_8->setValue(Motor[7][2]); |
194 | sb_ROLL_8->setValue(Motor[7][2]); |
195 | sb_ROLL_9->setValue(Motor[8][2]); |
195 | sb_ROLL_9->setValue(Motor[8][2]); |
196 | sb_ROLL_10->setValue(Motor[9][2]); |
196 | sb_ROLL_10->setValue(Motor[9][2]); |
197 | sb_ROLL_11->setValue(Motor[10][2]); |
197 | sb_ROLL_11->setValue(Motor[10][2]); |
198 | sb_ROLL_12->setValue(Motor[11][2]); |
198 | sb_ROLL_12->setValue(Motor[11][2]); |
199 | 199 | ||
200 | sb_GIER_1->setValue(Motor[0][3]); |
200 | sb_GIER_1->setValue(Motor[0][3]); |
201 | sb_GIER_2->setValue(Motor[1][3]); |
201 | sb_GIER_2->setValue(Motor[1][3]); |
202 | sb_GIER_3->setValue(Motor[2][3]); |
202 | sb_GIER_3->setValue(Motor[2][3]); |
203 | sb_GIER_4->setValue(Motor[3][3]); |
203 | sb_GIER_4->setValue(Motor[3][3]); |
204 | sb_GIER_5->setValue(Motor[4][3]); |
204 | sb_GIER_5->setValue(Motor[4][3]); |
205 | sb_GIER_6->setValue(Motor[5][3]); |
205 | sb_GIER_6->setValue(Motor[5][3]); |
206 | sb_GIER_7->setValue(Motor[6][3]); |
206 | sb_GIER_7->setValue(Motor[6][3]); |
207 | sb_GIER_8->setValue(Motor[7][3]); |
207 | sb_GIER_8->setValue(Motor[7][3]); |
208 | sb_GIER_9->setValue(Motor[8][3]); |
208 | sb_GIER_9->setValue(Motor[8][3]); |
209 | sb_GIER_10->setValue(Motor[9][3]); |
209 | sb_GIER_10->setValue(Motor[9][3]); |
210 | sb_GIER_11->setValue(Motor[10][3]); |
210 | sb_GIER_11->setValue(Motor[10][3]); |
211 | sb_GIER_12->setValue(Motor[11][3]); |
211 | sb_GIER_12->setValue(Motor[11][3]); |
212 | } |
212 | } |
213 | 213 | ||
214 | // Prüfen auf vollstaändigkeit |
214 | // Prüfen auf vollstaändigkeit |
215 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
215 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
216 | { |
216 | { |
217 | Wert = Wert; |
217 | Wert = Wert; |
218 | 218 | ||
219 | 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() + |
219 | 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() + |
220 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
220 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
221 | 221 | ||
222 | 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() + |
222 | 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() + |
223 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
223 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
224 | 224 | ||
225 | int GIER = sb_GIER_1->value() + sb_GIER_2->value() + sb_GIER_3->value() + sb_GIER_4->value() + sb_GIER_5->value() + sb_GIER_6->value() + |
225 | int GIER = sb_GIER_1->value() + sb_GIER_2->value() + sb_GIER_3->value() + sb_GIER_4->value() + sb_GIER_5->value() + sb_GIER_6->value() + |
226 | sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() + sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value(); |
226 | sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() + sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value(); |
227 | 227 | ||
228 | if (NICK == 0) |
228 | if (NICK == 0) |
229 | { |
229 | { |
230 | lb_NICK->setEnabled(true); |
230 | lb_NICK->setEnabled(true); |
231 | } |
231 | } |
232 | else |
232 | else |
233 | { |
233 | { |
234 | lb_NICK->setEnabled(false); |
234 | lb_NICK->setEnabled(false); |
235 | } |
235 | } |
236 | 236 | ||
237 | if (ROLL == 0) |
237 | if (ROLL == 0) |
238 | { |
238 | { |
239 | lb_ROLL->setEnabled(true); |
239 | lb_ROLL->setEnabled(true); |
240 | } |
240 | } |
241 | else |
241 | else |
242 | { |
242 | { |
243 | lb_ROLL->setEnabled(false); |
243 | lb_ROLL->setEnabled(false); |
244 | } |
244 | } |
245 | 245 | ||
246 | if (GIER == 0) |
246 | if (GIER == 0) |
247 | { |
247 | { |
248 | lb_GIER->setEnabled(true); |
248 | lb_GIER->setEnabled(true); |
249 | } |
249 | } |
250 | else |
250 | else |
251 | { |
251 | { |
252 | lb_GIER->setEnabled(false); |
252 | lb_GIER->setEnabled(false); |
253 | } |
253 | } |
254 | } |
254 | } |
255 | 255 | ||
256 | //FIXME: put this in com/Handler.cpp |
256 | //FIXME: put this in com/Handler.cpp |
257 | /* |
257 | /* |
258 | int dlg_MotorMixer::get_MotorConfig() |
258 | int dlg_MotorMixer::get_MotorConfig() |
259 | { |
259 | { |
260 | get_MotorData(); |
260 | get_MotorData(); |
261 | 261 | ||
262 | TX_Data[0] = VERSION_MIXER; |
262 | TX_Data[0] = VERSION_MIXER; |
263 | 263 | ||
264 | char *Name = MixerName.toLatin1().data(); |
264 | char *Name = MixerName.toLatin1().data(); |
265 | 265 | ||
266 | int a; |
266 | int a; |
267 | 267 | ||
268 | for (a = 0; a < MixerName.length(); a++) |
268 | for (a = 0; a < MixerName.length(); a++) |
269 | { |
269 | { |
270 | TX_Data[1+a] = Name[a]; |
270 | TX_Data[1+a] = Name[a]; |
271 | } |
271 | } |
272 | 272 | ||
273 | while(a < 12) |
273 | while(a < 12) |
274 | { |
274 | { |
275 | TX_Data[1+a] = 0; |
275 | TX_Data[1+a] = 0; |
276 | a++; |
276 | a++; |
277 | } |
277 | } |
278 | 278 | ||
279 | int Pos = 13; |
279 | int Pos = 13; |
280 | 280 | ||
281 | for (int z = 0; z < 16; z++) |
281 | for (int z = 0; z < 16; z++) |
282 | { |
282 | { |
283 | for (int y = 0; y < 4; y++) |
283 | for (int y = 0; y < 4; y++) |
284 | { |
284 | { |
285 | TX_Data[Pos] = Parser::charToData(Motor[z][y]); |
285 | TX_Data[Pos] = Parser::charToData(Motor[z][y]); |
286 | Pos++; |
286 | Pos++; |
287 | } |
287 | } |
288 | } |
288 | } |
289 | 289 | ||
290 | return Pos - 1; |
290 | return Pos - 1; |
291 | } |
291 | } |
292 | 292 | ||
293 | void dlg_MotorMixer::read_Mixer() |
293 | void dlg_MotorMixer::read_Mixer() |
294 | { |
294 | { |
295 | TX_Data[0] = 0; |
- | |
296 | o_Connection->send_Cmd('n', ADDRESS_FC, TX_Data, 1, true); |
295 | //See Handler::read_mixer in com/Handler.cpp |
297 | }*/ |
296 | }*/ |
298 | 297 | ||
299 | // read motor values |
298 | // read motor values |
300 | void dlg_MotorMixer::slot_pb_READ() |
299 | void dlg_MotorMixer::slot_pb_READ() |
301 | { |
300 | { |
302 | //send command to get mixer values |
301 | //send command to get mixer values |
303 | handler->read_mixer(); |
302 | handler->read_mixer(); |
304 | } |
303 | } |
305 | 304 | ||
306 | //write motor values |
305 | //write motor values |
307 | //FIXME: put this in com/Handler.cpp |
306 | //FIXME: put this in com/Handler.cpp |
308 | 307 | ||
309 | void dlg_MotorMixer::slot_pb_WRITE() |
308 | void dlg_MotorMixer::slot_pb_WRITE() |
310 | { |
309 | { |
311 | /* int Length = get_MotorConfig(); |
310 | /* int Length = handler->get_motor_config(); |
312 | o_Connection->send_Cmd('m', ADDRESS_FC, TX_Data, Length, true);*/ |
311 | handler->write_mixer(TX_Data, Length);*/ |
313 | } |
312 | } |
314 | 313 | ||
315 | void dlg_MotorMixer::slot_pb_LOAD() |
314 | void dlg_MotorMixer::slot_pb_LOAD() |
316 | { |
315 | { |
317 | QString Filename = QFileDialog::getOpenFileName(this, tr("Mikrokopter MotorMixer laden"), o_Settings->DIR.Parameter + "", tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
316 | QString Filename = QFileDialog::getOpenFileName(this, tr("Mikrokopter MotorMixer laden"), o_Settings->DIR.Parameter + "", tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
318 | 317 | ||
319 | if (!Filename.isEmpty()) |
318 | if (!Filename.isEmpty()) |
320 | { |
319 | { |
321 | QSettings Setting(Filename, QSettings::IniFormat); |
320 | QSettings Setting(Filename, QSettings::IniFormat); |
322 | 321 | ||
323 | Setting.beginGroup("Info"); |
322 | Setting.beginGroup("Info"); |
324 | MixerName = Setting.value("Name", QString("--noname--")).toString(); |
323 | MixerName = Setting.value("Name", QString("--noname--")).toString(); |
325 | MixerVersion = Setting.value("Version", 0).toInt(); |
324 | MixerVersion = Setting.value("Version", 0).toInt(); |
326 | Setting.endGroup(); |
325 | Setting.endGroup(); |
327 | 326 | ||
328 | Setting.beginGroup("Gas"); |
327 | Setting.beginGroup("Gas"); |
329 | for (int z = 0; z < MAXMOTOR; z++) |
328 | for (int z = 0; z < MAXMOTOR; z++) |
330 | { |
329 | { |
331 | Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
330 | Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
332 | } |
331 | } |
333 | Setting.endGroup(); |
332 | Setting.endGroup(); |
334 | 333 | ||
335 | Setting.beginGroup("Nick"); |
334 | Setting.beginGroup("Nick"); |
336 | for (int z = 0; z < MAXMOTOR; z++) |
335 | for (int z = 0; z < MAXMOTOR; z++) |
337 | { |
336 | { |
338 | Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
337 | Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
339 | } |
338 | } |
340 | Setting.endGroup(); |
339 | Setting.endGroup(); |
341 | 340 | ||
342 | Setting.beginGroup("Roll"); |
341 | Setting.beginGroup("Roll"); |
343 | for (int z = 0; z < MAXMOTOR; z++) |
342 | for (int z = 0; z < MAXMOTOR; z++) |
344 | { |
343 | { |
345 | Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
344 | Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
346 | } |
345 | } |
347 | Setting.endGroup(); |
346 | Setting.endGroup(); |
348 | 347 | ||
349 | Setting.beginGroup("Yaw"); |
348 | Setting.beginGroup("Yaw"); |
350 | for (int z = 0; z < MAXMOTOR; z++) |
349 | for (int z = 0; z < MAXMOTOR; z++) |
351 | { |
350 | { |
352 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
351 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
353 | } |
352 | } |
354 | Setting.endGroup(); |
353 | Setting.endGroup(); |
355 | 354 | ||
356 | if (MixerVersion == VERSION_MIXER) |
355 | if (MixerVersion == VERSION_MIXER) |
357 | { |
356 | { |
358 | set_MotorData(); |
357 | set_MotorData(); |
359 | } |
358 | } |
360 | } |
359 | } |
361 | } |
360 | } |
362 | 361 | ||
363 | void dlg_MotorMixer::slot_pb_SAVE() |
362 | void dlg_MotorMixer::slot_pb_SAVE() |
364 | { |
363 | { |
365 | QString Filename = QFileDialog::getSaveFileName(this, tr("Mikrokopter MotorMixer speichern"), o_Settings->DIR.Parameter + "/" + le_NAME->text(), tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
364 | QString Filename = QFileDialog::getSaveFileName(this, tr("Mikrokopter MotorMixer speichern"), o_Settings->DIR.Parameter + "/" + le_NAME->text(), tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
366 | 365 | ||
367 | if (!Filename.isEmpty()) |
366 | if (!Filename.isEmpty()) |
368 | { |
367 | { |
369 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
368 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
370 | { |
369 | { |
371 | Filename = Filename + QString(".mkm"); |
370 | Filename = Filename + QString(".mkm"); |
372 | } |
371 | } |
373 | 372 | ||
374 | get_MotorData(); |
373 | get_MotorData(); |
375 | 374 | ||
376 | QSettings Setting(Filename, QSettings::IniFormat); |
375 | QSettings Setting(Filename, QSettings::IniFormat); |
377 | 376 | ||
378 | Setting.beginGroup("Info"); |
377 | Setting.beginGroup("Info"); |
379 | Setting.setValue("Name", MixerName); |
378 | Setting.setValue("Name", MixerName); |
380 | Setting.setValue("Version", VERSION_MIXER); |
379 | Setting.setValue("Version", VERSION_MIXER); |
381 | Setting.endGroup(); |
380 | Setting.endGroup(); |
382 | 381 | ||
383 | Setting.beginGroup("Gas"); |
382 | Setting.beginGroup("Gas"); |
384 | for (int z = 0; z < MAXMOTOR; z++) |
383 | for (int z = 0; z < MAXMOTOR; z++) |
385 | { |
384 | { |
386 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]); |
385 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]); |
387 | } |
386 | } |
388 | Setting.endGroup(); |
387 | Setting.endGroup(); |
389 | 388 | ||
390 | Setting.beginGroup("Nick"); |
389 | Setting.beginGroup("Nick"); |
391 | for (int z = 0; z < MAXMOTOR; z++) |
390 | for (int z = 0; z < MAXMOTOR; z++) |
392 | { |
391 | { |
393 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]); |
392 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]); |
394 | } |
393 | } |
395 | Setting.endGroup(); |
394 | Setting.endGroup(); |
396 | 395 | ||
397 | Setting.beginGroup("Roll"); |
396 | Setting.beginGroup("Roll"); |
398 | for (int z = 0; z < MAXMOTOR; z++) |
397 | for (int z = 0; z < MAXMOTOR; z++) |
399 | { |
398 | { |
400 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]); |
399 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]); |
401 | } |
400 | } |
402 | Setting.endGroup(); |
401 | Setting.endGroup(); |
403 | 402 | ||
404 | Setting.beginGroup("Yaw"); |
403 | Setting.beginGroup("Yaw"); |
405 | for (int z = 0; z < MAXMOTOR; z++) |
404 | for (int z = 0; z < MAXMOTOR; z++) |
406 | { |
405 | { |
407 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
406 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
408 | } |
407 | } |
409 | Setting.endGroup(); |
408 | Setting.endGroup(); |
410 | } |
409 | } |
411 | } |
410 | } |
412 | 411 |