Rev 674 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 750 | ||
---|---|---|---|
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(Input *t_Input, cSettings *t_Settings, s_Directorys t_Dir) |
71 | void dlg_MotorMixer::set_Objects(cSettings *t_Settings, s_Directorys t_Dir) |
72 | { |
72 | { |
73 | o_Input = t_Input; |
- | |
74 | o_Settings = t_Settings; |
73 | o_Settings = t_Settings; |
75 | s_Dir = t_Dir; |
74 | s_Dir = t_Dir; |
76 | } |
75 | } |
77 | 76 | ||
78 | // Motordaten übernehmen. |
77 | // Motordaten übernehmen. |
79 | void dlg_MotorMixer::set_MotorConfig(s_MK_Mixer t_Mixer) |
78 | void dlg_MotorMixer::set_MotorConfig(s_MK_Mixer t_Mixer) |
80 | { |
79 | { |
81 | MK_Mixer = t_Mixer; |
80 | MK_Mixer = t_Mixer; |
82 | 81 | ||
83 | set_MotorData(); |
82 | set_MotorData(); |
84 | } |
83 | } |
85 | 84 | ||
86 | // Motordaten aus GUI übernehmen |
85 | // Motordaten aus GUI übernehmen |
87 | void dlg_MotorMixer::get_MotorData() |
86 | void dlg_MotorMixer::get_MotorData() |
88 | { |
87 | { |
89 | memcpy(MK_Mixer.Name, le_NAME->text().toLatin1().data(), 12); |
88 | memcpy(MK_Mixer.Name, le_NAME->text().toLatin1().data(), 12); |
90 | 89 | ||
91 | MK_Mixer.Motor[0][0] = sb_GAS_1->value(); |
90 | MK_Mixer.Motor[0][0] = sb_GAS_1->value(); |
92 | MK_Mixer.Motor[1][0] = sb_GAS_2->value(); |
91 | MK_Mixer.Motor[1][0] = sb_GAS_2->value(); |
93 | MK_Mixer.Motor[2][0] = sb_GAS_3->value(); |
92 | MK_Mixer.Motor[2][0] = sb_GAS_3->value(); |
94 | MK_Mixer.Motor[3][0] = sb_GAS_4->value(); |
93 | MK_Mixer.Motor[3][0] = sb_GAS_4->value(); |
95 | MK_Mixer.Motor[4][0] = sb_GAS_5->value(); |
94 | MK_Mixer.Motor[4][0] = sb_GAS_5->value(); |
96 | MK_Mixer.Motor[5][0] = sb_GAS_6->value(); |
95 | MK_Mixer.Motor[5][0] = sb_GAS_6->value(); |
97 | MK_Mixer.Motor[6][0] = sb_GAS_7->value(); |
96 | MK_Mixer.Motor[6][0] = sb_GAS_7->value(); |
98 | MK_Mixer.Motor[7][0] = sb_GAS_8->value(); |
97 | MK_Mixer.Motor[7][0] = sb_GAS_8->value(); |
99 | MK_Mixer.Motor[8][0] = sb_GAS_9->value(); |
98 | MK_Mixer.Motor[8][0] = sb_GAS_9->value(); |
100 | MK_Mixer.Motor[9][0] = sb_GAS_10->value(); |
99 | MK_Mixer.Motor[9][0] = sb_GAS_10->value(); |
101 | MK_Mixer.Motor[10][0] = sb_GAS_11->value(); |
100 | MK_Mixer.Motor[10][0] = sb_GAS_11->value(); |
102 | MK_Mixer.Motor[11][0] = sb_GAS_12->value(); |
101 | MK_Mixer.Motor[11][0] = sb_GAS_12->value(); |
103 | 102 | ||
104 | MK_Mixer.Motor[0][1] = sb_NICK_1->value(); |
103 | MK_Mixer.Motor[0][1] = sb_NICK_1->value(); |
105 | MK_Mixer.Motor[1][1] = sb_NICK_2->value(); |
104 | MK_Mixer.Motor[1][1] = sb_NICK_2->value(); |
106 | MK_Mixer.Motor[2][1] = sb_NICK_3->value(); |
105 | MK_Mixer.Motor[2][1] = sb_NICK_3->value(); |
107 | MK_Mixer.Motor[3][1] = sb_NICK_4->value(); |
106 | MK_Mixer.Motor[3][1] = sb_NICK_4->value(); |
108 | MK_Mixer.Motor[4][1] = sb_NICK_5->value(); |
107 | MK_Mixer.Motor[4][1] = sb_NICK_5->value(); |
109 | MK_Mixer.Motor[5][1] = sb_NICK_6->value(); |
108 | MK_Mixer.Motor[5][1] = sb_NICK_6->value(); |
110 | MK_Mixer.Motor[6][1] = sb_NICK_7->value(); |
109 | MK_Mixer.Motor[6][1] = sb_NICK_7->value(); |
111 | MK_Mixer.Motor[7][1] = sb_NICK_8->value(); |
110 | MK_Mixer.Motor[7][1] = sb_NICK_8->value(); |
112 | MK_Mixer.Motor[8][1] = sb_NICK_9->value(); |
111 | MK_Mixer.Motor[8][1] = sb_NICK_9->value(); |
113 | MK_Mixer.Motor[9][1] = sb_NICK_10->value(); |
112 | MK_Mixer.Motor[9][1] = sb_NICK_10->value(); |
114 | MK_Mixer.Motor[10][1] = sb_NICK_11->value(); |
113 | MK_Mixer.Motor[10][1] = sb_NICK_11->value(); |
115 | MK_Mixer.Motor[11][1] = sb_NICK_12->value(); |
114 | MK_Mixer.Motor[11][1] = sb_NICK_12->value(); |
116 | 115 | ||
117 | MK_Mixer.Motor[0][2] = sb_ROLL_1->value(); |
116 | MK_Mixer.Motor[0][2] = sb_ROLL_1->value(); |
118 | MK_Mixer.Motor[1][2] = sb_ROLL_2->value(); |
117 | MK_Mixer.Motor[1][2] = sb_ROLL_2->value(); |
119 | MK_Mixer.Motor[2][2] = sb_ROLL_3->value(); |
118 | MK_Mixer.Motor[2][2] = sb_ROLL_3->value(); |
120 | MK_Mixer.Motor[3][2] = sb_ROLL_4->value(); |
119 | MK_Mixer.Motor[3][2] = sb_ROLL_4->value(); |
121 | MK_Mixer.Motor[4][2] = sb_ROLL_5->value(); |
120 | MK_Mixer.Motor[4][2] = sb_ROLL_5->value(); |
122 | MK_Mixer.Motor[5][2] = sb_ROLL_6->value(); |
121 | MK_Mixer.Motor[5][2] = sb_ROLL_6->value(); |
123 | MK_Mixer.Motor[6][2] = sb_ROLL_7->value(); |
122 | MK_Mixer.Motor[6][2] = sb_ROLL_7->value(); |
124 | MK_Mixer.Motor[7][2] = sb_ROLL_8->value(); |
123 | MK_Mixer.Motor[7][2] = sb_ROLL_8->value(); |
125 | MK_Mixer.Motor[8][2] = sb_ROLL_9->value(); |
124 | MK_Mixer.Motor[8][2] = sb_ROLL_9->value(); |
126 | MK_Mixer.Motor[9][2] = sb_ROLL_10->value(); |
125 | MK_Mixer.Motor[9][2] = sb_ROLL_10->value(); |
127 | MK_Mixer.Motor[10][2] = sb_ROLL_11->value(); |
126 | MK_Mixer.Motor[10][2] = sb_ROLL_11->value(); |
128 | MK_Mixer.Motor[11][2] = sb_ROLL_12->value(); |
127 | MK_Mixer.Motor[11][2] = sb_ROLL_12->value(); |
129 | 128 | ||
130 | MK_Mixer.Motor[0][3] = sb_GIER_1->value(); |
129 | MK_Mixer.Motor[0][3] = sb_GIER_1->value(); |
131 | MK_Mixer.Motor[1][3] = sb_GIER_2->value(); |
130 | MK_Mixer.Motor[1][3] = sb_GIER_2->value(); |
132 | MK_Mixer.Motor[2][3] = sb_GIER_3->value(); |
131 | MK_Mixer.Motor[2][3] = sb_GIER_3->value(); |
133 | MK_Mixer.Motor[3][3] = sb_GIER_4->value(); |
132 | MK_Mixer.Motor[3][3] = sb_GIER_4->value(); |
134 | MK_Mixer.Motor[4][3] = sb_GIER_5->value(); |
133 | MK_Mixer.Motor[4][3] = sb_GIER_5->value(); |
135 | MK_Mixer.Motor[5][3] = sb_GIER_6->value(); |
134 | MK_Mixer.Motor[5][3] = sb_GIER_6->value(); |
136 | MK_Mixer.Motor[6][3] = sb_GIER_7->value(); |
135 | MK_Mixer.Motor[6][3] = sb_GIER_7->value(); |
137 | MK_Mixer.Motor[7][3] = sb_GIER_8->value(); |
136 | MK_Mixer.Motor[7][3] = sb_GIER_8->value(); |
138 | MK_Mixer.Motor[8][3] = sb_GIER_9->value(); |
137 | MK_Mixer.Motor[8][3] = sb_GIER_9->value(); |
139 | MK_Mixer.Motor[9][3] = sb_GIER_10->value(); |
138 | MK_Mixer.Motor[9][3] = sb_GIER_10->value(); |
140 | MK_Mixer.Motor[10][3] = sb_GIER_11->value(); |
139 | MK_Mixer.Motor[10][3] = sb_GIER_11->value(); |
141 | MK_Mixer.Motor[11][3] = sb_GIER_12->value(); |
140 | MK_Mixer.Motor[11][3] = sb_GIER_12->value(); |
142 | } |
141 | } |
143 | 142 | ||
144 | // Motordaten anzeigen |
143 | // Motordaten anzeigen |
145 | void dlg_MotorMixer::set_MotorData() |
144 | void dlg_MotorMixer::set_MotorData() |
146 | { |
145 | { |
147 | le_NAME->setText(QString(MK_Mixer.Name)); |
146 | le_NAME->setText(QString(MK_Mixer.Name)); |
148 | 147 | ||
149 | sb_GAS_1->setValue(MK_Mixer.Motor[0][0]); |
148 | sb_GAS_1->setValue(MK_Mixer.Motor[0][0]); |
150 | sb_GAS_2->setValue(MK_Mixer.Motor[1][0]); |
149 | sb_GAS_2->setValue(MK_Mixer.Motor[1][0]); |
151 | sb_GAS_3->setValue(MK_Mixer.Motor[2][0]); |
150 | sb_GAS_3->setValue(MK_Mixer.Motor[2][0]); |
152 | sb_GAS_4->setValue(MK_Mixer.Motor[3][0]); |
151 | sb_GAS_4->setValue(MK_Mixer.Motor[3][0]); |
153 | sb_GAS_5->setValue(MK_Mixer.Motor[4][0]); |
152 | sb_GAS_5->setValue(MK_Mixer.Motor[4][0]); |
154 | sb_GAS_6->setValue(MK_Mixer.Motor[5][0]); |
153 | sb_GAS_6->setValue(MK_Mixer.Motor[5][0]); |
155 | sb_GAS_7->setValue(MK_Mixer.Motor[6][0]); |
154 | sb_GAS_7->setValue(MK_Mixer.Motor[6][0]); |
156 | sb_GAS_8->setValue(MK_Mixer.Motor[7][0]); |
155 | sb_GAS_8->setValue(MK_Mixer.Motor[7][0]); |
157 | sb_GAS_9->setValue(MK_Mixer.Motor[8][0]); |
156 | sb_GAS_9->setValue(MK_Mixer.Motor[8][0]); |
158 | sb_GAS_10->setValue(MK_Mixer.Motor[9][0]); |
157 | sb_GAS_10->setValue(MK_Mixer.Motor[9][0]); |
159 | sb_GAS_11->setValue(MK_Mixer.Motor[10][0]); |
158 | sb_GAS_11->setValue(MK_Mixer.Motor[10][0]); |
160 | sb_GAS_12->setValue(MK_Mixer.Motor[11][0]); |
159 | sb_GAS_12->setValue(MK_Mixer.Motor[11][0]); |
161 | 160 | ||
162 | sb_NICK_1->setValue(MK_Mixer.Motor[0][1]); |
161 | sb_NICK_1->setValue(MK_Mixer.Motor[0][1]); |
163 | sb_NICK_2->setValue(MK_Mixer.Motor[1][1]); |
162 | sb_NICK_2->setValue(MK_Mixer.Motor[1][1]); |
164 | sb_NICK_3->setValue(MK_Mixer.Motor[2][1]); |
163 | sb_NICK_3->setValue(MK_Mixer.Motor[2][1]); |
165 | sb_NICK_4->setValue(MK_Mixer.Motor[3][1]); |
164 | sb_NICK_4->setValue(MK_Mixer.Motor[3][1]); |
166 | sb_NICK_5->setValue(MK_Mixer.Motor[4][1]); |
165 | sb_NICK_5->setValue(MK_Mixer.Motor[4][1]); |
167 | sb_NICK_6->setValue(MK_Mixer.Motor[5][1]); |
166 | sb_NICK_6->setValue(MK_Mixer.Motor[5][1]); |
168 | sb_NICK_7->setValue(MK_Mixer.Motor[6][1]); |
167 | sb_NICK_7->setValue(MK_Mixer.Motor[6][1]); |
169 | sb_NICK_8->setValue(MK_Mixer.Motor[7][1]); |
168 | sb_NICK_8->setValue(MK_Mixer.Motor[7][1]); |
170 | sb_NICK_9->setValue(MK_Mixer.Motor[8][1]); |
169 | sb_NICK_9->setValue(MK_Mixer.Motor[8][1]); |
171 | sb_NICK_10->setValue(MK_Mixer.Motor[9][1]); |
170 | sb_NICK_10->setValue(MK_Mixer.Motor[9][1]); |
172 | sb_NICK_11->setValue(MK_Mixer.Motor[10][1]); |
171 | sb_NICK_11->setValue(MK_Mixer.Motor[10][1]); |
173 | sb_NICK_12->setValue(MK_Mixer.Motor[11][1]); |
172 | sb_NICK_12->setValue(MK_Mixer.Motor[11][1]); |
174 | 173 | ||
175 | sb_ROLL_1->setValue(MK_Mixer.Motor[0][2]); |
174 | sb_ROLL_1->setValue(MK_Mixer.Motor[0][2]); |
176 | sb_ROLL_2->setValue(MK_Mixer.Motor[1][2]); |
175 | sb_ROLL_2->setValue(MK_Mixer.Motor[1][2]); |
177 | sb_ROLL_3->setValue(MK_Mixer.Motor[2][2]); |
176 | sb_ROLL_3->setValue(MK_Mixer.Motor[2][2]); |
178 | sb_ROLL_4->setValue(MK_Mixer.Motor[3][2]); |
177 | sb_ROLL_4->setValue(MK_Mixer.Motor[3][2]); |
179 | sb_ROLL_5->setValue(MK_Mixer.Motor[4][2]); |
178 | sb_ROLL_5->setValue(MK_Mixer.Motor[4][2]); |
180 | sb_ROLL_6->setValue(MK_Mixer.Motor[5][2]); |
179 | sb_ROLL_6->setValue(MK_Mixer.Motor[5][2]); |
181 | sb_ROLL_7->setValue(MK_Mixer.Motor[6][2]); |
180 | sb_ROLL_7->setValue(MK_Mixer.Motor[6][2]); |
182 | sb_ROLL_8->setValue(MK_Mixer.Motor[7][2]); |
181 | sb_ROLL_8->setValue(MK_Mixer.Motor[7][2]); |
183 | sb_ROLL_9->setValue(MK_Mixer.Motor[8][2]); |
182 | sb_ROLL_9->setValue(MK_Mixer.Motor[8][2]); |
184 | sb_ROLL_10->setValue(MK_Mixer.Motor[9][2]); |
183 | sb_ROLL_10->setValue(MK_Mixer.Motor[9][2]); |
185 | sb_ROLL_11->setValue(MK_Mixer.Motor[10][2]); |
184 | sb_ROLL_11->setValue(MK_Mixer.Motor[10][2]); |
186 | sb_ROLL_12->setValue(MK_Mixer.Motor[11][2]); |
185 | sb_ROLL_12->setValue(MK_Mixer.Motor[11][2]); |
187 | 186 | ||
188 | sb_GIER_1->setValue(MK_Mixer.Motor[0][3]); |
187 | sb_GIER_1->setValue(MK_Mixer.Motor[0][3]); |
189 | sb_GIER_2->setValue(MK_Mixer.Motor[1][3]); |
188 | sb_GIER_2->setValue(MK_Mixer.Motor[1][3]); |
190 | sb_GIER_3->setValue(MK_Mixer.Motor[2][3]); |
189 | sb_GIER_3->setValue(MK_Mixer.Motor[2][3]); |
191 | sb_GIER_4->setValue(MK_Mixer.Motor[3][3]); |
190 | sb_GIER_4->setValue(MK_Mixer.Motor[3][3]); |
192 | sb_GIER_5->setValue(MK_Mixer.Motor[4][3]); |
191 | sb_GIER_5->setValue(MK_Mixer.Motor[4][3]); |
193 | sb_GIER_6->setValue(MK_Mixer.Motor[5][3]); |
192 | sb_GIER_6->setValue(MK_Mixer.Motor[5][3]); |
194 | sb_GIER_7->setValue(MK_Mixer.Motor[6][3]); |
193 | sb_GIER_7->setValue(MK_Mixer.Motor[6][3]); |
195 | sb_GIER_8->setValue(MK_Mixer.Motor[7][3]); |
194 | sb_GIER_8->setValue(MK_Mixer.Motor[7][3]); |
196 | sb_GIER_9->setValue(MK_Mixer.Motor[8][3]); |
195 | sb_GIER_9->setValue(MK_Mixer.Motor[8][3]); |
197 | sb_GIER_10->setValue(MK_Mixer.Motor[9][3]); |
196 | sb_GIER_10->setValue(MK_Mixer.Motor[9][3]); |
198 | sb_GIER_11->setValue(MK_Mixer.Motor[10][3]); |
197 | sb_GIER_11->setValue(MK_Mixer.Motor[10][3]); |
199 | sb_GIER_12->setValue(MK_Mixer.Motor[11][3]); |
198 | sb_GIER_12->setValue(MK_Mixer.Motor[11][3]); |
200 | } |
199 | } |
201 | 200 | ||
202 | // Prüfen auf vollstaändigkeit |
201 | // Prüfen auf vollstaändigkeit |
203 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
202 | void dlg_MotorMixer::slot_CheckValue(int Wert) |
204 | { |
203 | { |
205 | Wert = Wert; |
204 | Wert = Wert; |
206 | 205 | ||
207 | 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() + |
206 | 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() + |
208 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
207 | sb_NICK_7->value() + sb_NICK_8->value() + sb_NICK_9->value() + sb_NICK_10->value() + sb_NICK_11->value() + sb_NICK_12->value(); |
209 | 208 | ||
210 | 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() + |
209 | 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() + |
211 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
210 | sb_ROLL_7->value() + sb_ROLL_8->value() + sb_ROLL_9->value() + sb_ROLL_10->value() + sb_ROLL_11->value() + sb_ROLL_12->value(); |
212 | 211 | ||
213 | 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() + |
212 | 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() + |
214 | sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() + sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value(); |
213 | sb_GIER_7->value() + sb_GIER_8->value() + sb_GIER_9->value() + sb_GIER_10->value() + sb_GIER_11->value() + sb_GIER_12->value(); |
215 | 214 | ||
216 | if (NICK == 0) |
215 | if (NICK == 0) |
217 | { |
216 | { |
218 | lb_NICK->setEnabled(true); |
217 | lb_NICK->setEnabled(true); |
219 | } |
218 | } |
220 | else |
219 | else |
221 | { |
220 | { |
222 | lb_NICK->setEnabled(false); |
221 | lb_NICK->setEnabled(false); |
223 | } |
222 | } |
224 | 223 | ||
225 | if (ROLL == 0) |
224 | if (ROLL == 0) |
226 | { |
225 | { |
227 | lb_ROLL->setEnabled(true); |
226 | lb_ROLL->setEnabled(true); |
228 | } |
227 | } |
229 | else |
228 | else |
230 | { |
229 | { |
231 | lb_ROLL->setEnabled(false); |
230 | lb_ROLL->setEnabled(false); |
232 | } |
231 | } |
233 | 232 | ||
234 | if (GIER == 0) |
233 | if (GIER == 0) |
235 | { |
234 | { |
236 | lb_GIER->setEnabled(true); |
235 | lb_GIER->setEnabled(true); |
237 | } |
236 | } |
238 | else |
237 | else |
239 | { |
238 | { |
240 | lb_GIER->setEnabled(false); |
239 | lb_GIER->setEnabled(false); |
241 | } |
240 | } |
242 | } |
241 | } |
243 | 242 | ||
244 | // Mixer von der FC Lesen. |
243 | // Mixer von der FC Lesen. |
245 | void dlg_MotorMixer::read_Mixer() |
244 | void dlg_MotorMixer::read_Mixer() |
246 | { |
245 | { |
247 | c_Data[0] = 0; |
246 | c_Data[0] = 0; |
248 | o_Input->send_Data(HandlerMK::make_Frame('n', ADDRESS_FC, c_Data, 0).toLatin1().data(), DATA_READ_MIXER); |
247 | // o_Input->send_Data(HandlerMK::make_Frame('n', ADDRESS_FC, c_Data, 0).toLatin1().data(), DATA_READ_MIXER); |
- | 248 | emit sig_SendData(HandlerMK::make_Frame('n', ADDRESS_FC, c_Data, 0).toLatin1().data(), DATA_READ_MIXER); |
|
249 | } |
249 | } |
250 | 250 | ||
251 | // Button-Slots |
251 | // Button-Slots |
252 | void dlg_MotorMixer::slot_pb_READ() |
252 | void dlg_MotorMixer::slot_pb_READ() |
253 | { |
253 | { |
254 | read_Mixer(); |
254 | read_Mixer(); |
255 | } |
255 | } |
256 | 256 | ||
257 | void dlg_MotorMixer::slot_pb_WRITE() |
257 | void dlg_MotorMixer::slot_pb_WRITE() |
258 | { |
258 | { |
259 | get_MotorData(); |
259 | get_MotorData(); |
260 | 260 | ||
261 | memcpy((unsigned char *)&c_Data, (unsigned char *)&MK_Mixer, sizeof(MK_Mixer)); |
261 | memcpy((unsigned char *)&c_Data, (unsigned char *)&MK_Mixer, sizeof(MK_Mixer)); |
262 | 262 | ||
- | 263 | // o_Input->send_Data(HandlerMK::make_Frame('m', ADDRESS_FC, c_Data, sizeof(MK_Mixer)).toLatin1().data(), DATA_WRITE_MIXER); |
|
263 | o_Input->send_Data(HandlerMK::make_Frame('m', ADDRESS_FC, c_Data, sizeof(MK_Mixer)).toLatin1().data(), DATA_WRITE_MIXER); |
264 | emit sig_SendData(HandlerMK::make_Frame('m', ADDRESS_FC, c_Data, sizeof(MK_Mixer)).toLatin1().data(), DATA_WRITE_MIXER); |
264 | } |
265 | } |
265 | 266 | ||
266 | void dlg_MotorMixer::slot_pb_LOAD() |
267 | void dlg_MotorMixer::slot_pb_LOAD() |
267 | { |
268 | { |
268 | QString Dir = QDir::homePath(); |
269 | QString Dir = QDir::homePath(); |
269 | 270 | ||
270 | QString Filename = QFileDialog::getOpenFileName(this, tr("Mikrokopter MotorMixer laden"), s_Dir.Settings + "", tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
271 | QString Filename = QFileDialog::getOpenFileName(this, tr("Mikrokopter MotorMixer laden"), s_Dir.Settings + "", tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
271 | 272 | ||
272 | if (!Filename.isEmpty()) |
273 | if (!Filename.isEmpty()) |
273 | { |
274 | { |
274 | QSettings Setting(Filename, QSettings::IniFormat); |
275 | QSettings Setting(Filename, QSettings::IniFormat); |
275 | 276 | ||
276 | Setting.beginGroup("Info"); |
277 | Setting.beginGroup("Info"); |
277 | memcpy(MK_Mixer.Name, Setting.value("Name", QString("--noname--")).toString().toLatin1().data(), 12); |
278 | memcpy(MK_Mixer.Name, Setting.value("Name", QString("--noname--")).toString().toLatin1().data(), 12); |
278 | MK_Mixer.Revision = Setting.value("Version", 0).toInt(); |
279 | MK_Mixer.Revision = Setting.value("Version", 0).toInt(); |
279 | Setting.endGroup(); |
280 | Setting.endGroup(); |
280 | 281 | ||
281 | Setting.beginGroup("Gas"); |
282 | Setting.beginGroup("Gas"); |
282 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
283 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
283 | { |
284 | { |
284 | MK_Mixer.Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
285 | MK_Mixer.Motor[z][0] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
285 | } |
286 | } |
286 | Setting.endGroup(); |
287 | Setting.endGroup(); |
287 | 288 | ||
288 | Setting.beginGroup("Nick"); |
289 | Setting.beginGroup("Nick"); |
289 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
290 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
290 | { |
291 | { |
291 | MK_Mixer.Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
292 | MK_Mixer.Motor[z][1] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
292 | } |
293 | } |
293 | Setting.endGroup(); |
294 | Setting.endGroup(); |
294 | 295 | ||
295 | Setting.beginGroup("Roll"); |
296 | Setting.beginGroup("Roll"); |
296 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
297 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
297 | { |
298 | { |
298 | MK_Mixer.Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
299 | MK_Mixer.Motor[z][2] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
299 | } |
300 | } |
300 | Setting.endGroup(); |
301 | Setting.endGroup(); |
301 | 302 | ||
302 | Setting.beginGroup("Yaw"); |
303 | Setting.beginGroup("Yaw"); |
303 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
304 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
304 | { |
305 | { |
305 | MK_Mixer.Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
306 | MK_Mixer.Motor[z][3] = Setting.value(QString("Motor%1").arg(z+1), 0).toInt(); |
306 | } |
307 | } |
307 | Setting.endGroup(); |
308 | Setting.endGroup(); |
308 | 309 | ||
309 | if (MK_Mixer.Revision == MK_VERSION_MIXER) |
310 | if (MK_Mixer.Revision == MK_VERSION_MIXER) |
310 | { |
311 | { |
311 | set_MotorData(); |
312 | set_MotorData(); |
312 | } |
313 | } |
313 | } |
314 | } |
314 | } |
315 | } |
315 | 316 | ||
316 | void dlg_MotorMixer::slot_pb_SAVE() |
317 | void dlg_MotorMixer::slot_pb_SAVE() |
317 | { |
318 | { |
318 | QString Dir = QDir::homePath(); |
319 | QString Dir = QDir::homePath(); |
319 | 320 | ||
320 | QString Filename = QFileDialog::getSaveFileName(this, tr("Mikrokopter MotorMixer speichern"), s_Dir.Settings + "/" + le_NAME->text(), tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
321 | QString Filename = QFileDialog::getSaveFileName(this, tr("Mikrokopter MotorMixer speichern"), s_Dir.Settings + "/" + le_NAME->text(), tr("MK MotorMixer(*.mkm);;Alle Dateien (*)")); |
321 | 322 | ||
322 | if (!Filename.isEmpty()) |
323 | if (!Filename.isEmpty()) |
323 | { |
324 | { |
324 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
325 | if (!(Filename.endsWith(".mkm", Qt::CaseInsensitive))) |
325 | { |
326 | { |
326 | Filename = Filename + QString(".mkm"); |
327 | Filename = Filename + QString(".mkm"); |
327 | } |
328 | } |
328 | 329 | ||
329 | get_MotorData(); |
330 | get_MotorData(); |
330 | 331 | ||
331 | QSettings Setting(Filename, QSettings::IniFormat); |
332 | QSettings Setting(Filename, QSettings::IniFormat); |
332 | 333 | ||
333 | Setting.beginGroup("Info"); |
334 | Setting.beginGroup("Info"); |
334 | Setting.setValue("Name", QString(MK_Mixer.Name)); |
335 | Setting.setValue("Name", QString(MK_Mixer.Name)); |
335 | Setting.setValue("Version", MK_VERSION_MIXER); |
336 | Setting.setValue("Version", MK_VERSION_MIXER); |
336 | Setting.endGroup(); |
337 | Setting.endGroup(); |
337 | 338 | ||
338 | Setting.beginGroup("Gas"); |
339 | Setting.beginGroup("Gas"); |
339 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
340 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
340 | { |
341 | { |
341 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][0]); |
342 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][0]); |
342 | } |
343 | } |
343 | Setting.endGroup(); |
344 | Setting.endGroup(); |
344 | 345 | ||
345 | Setting.beginGroup("Nick"); |
346 | Setting.beginGroup("Nick"); |
346 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
347 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
347 | { |
348 | { |
348 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][1]); |
349 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][1]); |
349 | } |
350 | } |
350 | Setting.endGroup(); |
351 | Setting.endGroup(); |
351 | 352 | ||
352 | Setting.beginGroup("Roll"); |
353 | Setting.beginGroup("Roll"); |
353 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
354 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
354 | { |
355 | { |
355 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][2]); |
356 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][2]); |
356 | } |
357 | } |
357 | Setting.endGroup(); |
358 | Setting.endGroup(); |
358 | 359 | ||
359 | Setting.beginGroup("Yaw"); |
360 | Setting.beginGroup("Yaw"); |
360 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
361 | for (int z = 0; z < MK_MAX_MOTOR; z++) |
361 | { |
362 | { |
362 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][3]); |
363 | Setting.setValue(QString("Motor%1").arg(z+1), MK_Mixer.Motor[z][3]); |
363 | } |
364 | } |
364 | Setting.endGroup(); |
365 | Setting.endGroup(); |
365 | } |
366 | } |
366 | } |
367 | } |
367 | 368 | ||
368 | 369 |