Rev 307 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 307 | Rev 313 | ||
---|---|---|---|
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(cConnection *t_Connection, cSettings *t_Settings) |
71 | void dlg_MotorMixer::set_Objects(cConnection *t_Connection, cSettings *t_Settings) |
72 | { |
72 | { |
73 | o_Connection = t_Connection; |
73 | o_Connection = t_Connection; |
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::Data2QString(RX.Decode, 1, 12); |
82 | MixerName = ToolBox::Data2QString(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] = ToolBox::Data2Char(RX.Decode,Pos); |
90 | Motor[z][y] = ToolBox::Data2Char(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 | int dlg_MotorMixer::get_MotorConfig() |
256 | int dlg_MotorMixer::get_MotorConfig() |
257 | { |
257 | { |
258 | get_MotorData(); |
258 | get_MotorData(); |
259 | 259 | ||
260 | TX_Data[0] = VERSION_MIXER; |
260 | TX_Data[0] = VERSION_MIXER; |
261 | 261 | ||
262 | char *Name = MixerName.toLatin1().data(); |
262 | char *Name = MixerName.toLatin1().data(); |
263 | 263 | ||
264 | int a; |
264 | int a; |
265 | 265 | ||
266 | for (a = 0; a < MixerName.length(); a++) |
266 | for (a = 0; a < MixerName.length(); a++) |
267 | { |
267 | { |
268 | TX_Data[1+a] = Name[a]; |
268 | TX_Data[1+a] = Name[a]; |
269 | } |
269 | } |
270 | 270 | ||
271 | while(a < 12) |
271 | while(a < 12) |
272 | { |
272 | { |
273 | TX_Data[1+a] = 0; |
273 | TX_Data[1+a] = 0; |
274 | a++; |
274 | a++; |
275 | } |
275 | } |
276 | 276 | ||
277 | int Pos = 13; |
277 | int Pos = 13; |
278 | 278 | ||
279 | for (int z = 0; z < 16; z++) |
279 | for (int z = 0; z < 16; z++) |
280 | { |
280 | { |
281 | for (int y = 0; y < 4; y++) |
281 | for (int y = 0; y < 4; y++) |
282 | { |
282 | { |
283 | TX_Data[Pos] = ToolBox::Char2Data(Motor[z][y]); |
283 | TX_Data[Pos] = ToolBox::Char2Data(Motor[z][y]); |
284 | Pos++; |
284 | Pos++; |
285 | } |
285 | } |
286 | } |
286 | } |
287 | 287 | ||
288 | return Pos - 1; |
288 | return Pos - 1; |
289 | } |
289 | } |
290 | 290 | ||
291 | void dlg_MotorMixer::read_Mixer() |
291 | void dlg_MotorMixer::read_Mixer() |
292 | { |
292 | { |
293 | TX_Data[0] = 0; |
293 | TX_Data[0] = 0; |
294 | o_Connection->send_Cmd('n', ADDRESS_FC, TX_Data, 1, false); |
294 | o_Connection->send_Cmd('n', ADDRESS_FC, TX_Data, 1, true); |
295 | } |
295 | } |
296 | 296 | ||
297 | // Motordaten auslesen |
297 | // Motordaten auslesen |
298 | void dlg_MotorMixer::slot_pb_READ() |
298 | void dlg_MotorMixer::slot_pb_READ() |
299 | { |
299 | { |
300 | TX_Data[0] = 0; |
300 | TX_Data[0] = 0; |
301 | o_Connection->send_Cmd('n', ADDRESS_FC, TX_Data, 1, false); |
301 | o_Connection->send_Cmd('n', ADDRESS_FC, TX_Data, 1, true); |
302 | } |
302 | } |
303 | 303 | ||
304 | void dlg_MotorMixer::slot_pb_WRITE() |
304 | void dlg_MotorMixer::slot_pb_WRITE() |
305 | { |
305 | { |
306 | int Length = get_MotorConfig(); |
306 | int Length = get_MotorConfig(); |
307 | o_Connection->send_Cmd('m', ADDRESS_FC, TX_Data, Length, false); |
307 | o_Connection->send_Cmd('m', ADDRESS_FC, TX_Data, Length, true); |
308 | } |
308 | } |
309 | 309 | ||
310 | void dlg_MotorMixer::slot_pb_LOAD() |
310 | void dlg_MotorMixer::slot_pb_LOAD() |
311 | { |
311 | { |
312 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter MotorMixer laden", o_Settings->DIR.Parameter + "", "MK MotorMixer(*.mkm);;Alle Dateien (*)"); |
312 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter MotorMixer laden", o_Settings->DIR.Parameter + "", "MK MotorMixer(*.mkm);;Alle Dateien (*)"); |
313 | 313 | ||
314 | if (!Filename.isEmpty()) |
314 | if (!Filename.isEmpty()) |
315 | { |
315 | { |
316 | QSettings Setting(Filename, QSettings::IniFormat); |
316 | QSettings Setting(Filename, QSettings::IniFormat); |
317 | 317 | ||
318 | Setting.beginGroup("Info"); |
318 | Setting.beginGroup("Info"); |
319 | MixerName = Setting.value("Name", QString("--noname--")).toString(); |
319 | MixerName = Setting.value("Name", QString("--noname--")).toString(); |
320 | MixerVersion = Setting.value("Version", 0).toInt(); |
320 | MixerVersion = Setting.value("Version", 0).toInt(); |
321 | Setting.endGroup(); |
321 | Setting.endGroup(); |
322 | 322 | ||
323 | Setting.beginGroup("Gas"); |
323 | Setting.beginGroup("Gas"); |
324 | for (int z = 0; z < MAXMOTOR; z++) |
324 | for (int z = 0; z < MAXMOTOR; z++) |
325 | { |
325 | { |
326 | Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
326 | Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
327 | } |
327 | } |
328 | Setting.endGroup(); |
328 | Setting.endGroup(); |
329 | 329 | ||
330 | Setting.beginGroup("Nick"); |
330 | Setting.beginGroup("Nick"); |
331 | for (int z = 0; z < MAXMOTOR; z++) |
331 | for (int z = 0; z < MAXMOTOR; z++) |
332 | { |
332 | { |
333 | Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
333 | Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
334 | } |
334 | } |
335 | Setting.endGroup(); |
335 | Setting.endGroup(); |
336 | 336 | ||
337 | Setting.beginGroup("Roll"); |
337 | Setting.beginGroup("Roll"); |
338 | for (int z = 0; z < MAXMOTOR; z++) |
338 | for (int z = 0; z < MAXMOTOR; z++) |
339 | { |
339 | { |
340 | Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
340 | Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
341 | } |
341 | } |
342 | Setting.endGroup(); |
342 | Setting.endGroup(); |
343 | 343 | ||
344 | Setting.beginGroup("Yaw"); |
344 | Setting.beginGroup("Yaw"); |
345 | for (int z = 0; z < MAXMOTOR; z++) |
345 | for (int z = 0; z < MAXMOTOR; z++) |
346 | { |
346 | { |
347 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
347 | Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
348 | } |
348 | } |
349 | Setting.endGroup(); |
349 | Setting.endGroup(); |
350 | 350 | ||
351 | if (MixerVersion == VERSION_MIXER) |
351 | if (MixerVersion == VERSION_MIXER) |
352 | { |
352 | { |
353 | set_MotorData(); |
353 | set_MotorData(); |
354 | } |
354 | } |
355 | } |
355 | } |
356 | } |
356 | } |
357 | 357 | ||
358 | void dlg_MotorMixer::slot_pb_SAVE() |
358 | void dlg_MotorMixer::slot_pb_SAVE() |
359 | { |
359 | { |
360 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter MotorMixer speichern", o_Settings->DIR.Parameter + "/" + le_NAME->text(), "MK MotorMixer(*.mkm);;Alle Dateien (*)"); |
360 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter MotorMixer speichern", o_Settings->DIR.Parameter + "/" + le_NAME->text(), "MK MotorMixer(*.mkm);;Alle Dateien (*)"); |
361 | 361 | ||
362 | if (!Filename.isEmpty()) |
362 | if (!Filename.isEmpty()) |
363 | { |
363 | { |
364 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
364 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
365 | { |
365 | { |
366 | Filename = Filename + QString(".mkm"); |
366 | Filename = Filename + QString(".mkm"); |
367 | } |
367 | } |
368 | 368 | ||
369 | get_MotorData(); |
369 | get_MotorData(); |
370 | 370 | ||
371 | QSettings Setting(Filename, QSettings::IniFormat); |
371 | QSettings Setting(Filename, QSettings::IniFormat); |
372 | 372 | ||
373 | Setting.beginGroup("Info"); |
373 | Setting.beginGroup("Info"); |
374 | Setting.setValue("Name", MixerName); |
374 | Setting.setValue("Name", MixerName); |
375 | Setting.setValue("Version", VERSION_MIXER); |
375 | Setting.setValue("Version", VERSION_MIXER); |
376 | Setting.endGroup(); |
376 | Setting.endGroup(); |
377 | 377 | ||
378 | Setting.beginGroup("Gas"); |
378 | Setting.beginGroup("Gas"); |
379 | for (int z = 0; z < MAXMOTOR; z++) |
379 | for (int z = 0; z < MAXMOTOR; z++) |
380 | { |
380 | { |
381 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]); |
381 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][0]); |
382 | } |
382 | } |
383 | Setting.endGroup(); |
383 | Setting.endGroup(); |
384 | 384 | ||
385 | Setting.beginGroup("Nick"); |
385 | Setting.beginGroup("Nick"); |
386 | for (int z = 0; z < MAXMOTOR; z++) |
386 | for (int z = 0; z < MAXMOTOR; z++) |
387 | { |
387 | { |
388 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]); |
388 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][1]); |
389 | } |
389 | } |
390 | Setting.endGroup(); |
390 | Setting.endGroup(); |
391 | 391 | ||
392 | Setting.beginGroup("Roll"); |
392 | Setting.beginGroup("Roll"); |
393 | for (int z = 0; z < MAXMOTOR; z++) |
393 | for (int z = 0; z < MAXMOTOR; z++) |
394 | { |
394 | { |
395 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]); |
395 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][2]); |
396 | } |
396 | } |
397 | Setting.endGroup(); |
397 | Setting.endGroup(); |
398 | 398 | ||
399 | Setting.beginGroup("Yaw"); |
399 | Setting.beginGroup("Yaw"); |
400 | for (int z = 0; z < MAXMOTOR; z++) |
400 | for (int z = 0; z < MAXMOTOR; z++) |
401 | { |
401 | { |
402 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
402 | Setting.setValue(QString("Motor%1").arg(z+1), Motor[z][3]); |
403 | } |
403 | } |
404 | Setting.endGroup(); |
404 | Setting.endGroup(); |
405 | } |
405 | } |
406 | } |
406 | } |
407 | 407 |