Rev 393 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 393 | Rev 396 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | 9 | ||
10 | /** |
10 | /** |
11 | * read mixer values from FlightCtrl |
11 | * read mixer values from FlightCtrl |
12 | */ |
12 | */ |
13 | void Handler::read_mixer() { |
13 | void Handler::read_mixer() { |
- | 14 | char tx_data[1] = {0}; |
|
14 | TX_Data[0] = 0; |
15 | //com->log("read motor mixer"); |
- | 16 | com->sendCmd('n', ADDRESS_FC, tx_data, 1, true); |
|
- | 17 | } |
|
- | 18 | ||
15 | com->send_cmd('n', ADDRESS_FC, TX_Data, 1, true); |
19 | void Handler::get_motor_config() { |
Line 16... | Line 20... | ||
16 | } |
20 | } |
17 | 21 | ||
18 | void Handler::receive_data(sRxData RX) { |
22 | void Handler::receive_data(sRxData RX) { |
Line 29... | Line 33... | ||
29 | { |
33 | { |
30 | com->stopReSend(); |
34 | com->stopReSend(); |
Line 31... | Line 35... | ||
31 | 35 | ||
32 | if (RX.decode[0] == VERSION_MIXER) |
36 | if (RX.decode[0] == VERSION_MIXER) |
33 | { |
37 | { |
34 | f_MotorMixer->set_MotorConfig(RX); |
38 | //f_MotorMixer->set_MotorConfig(RX); |
35 | } |
39 | } |
36 | } |
40 | } |
37 | break; |
41 | break; |
38 | // Motor-Mixer Schreib-Bestätigung |
42 | // Motor-Mixer Schreib-Bestätigung |
Line 41... | Line 45... | ||
41 | { |
45 | { |
42 | com->stopReSend(); |
46 | com->stopReSend(); |
Line 43... | Line 47... | ||
43 | 47 | ||
44 | if (RX.decode[0] == 1) |
48 | if (RX.decode[0] == 1) |
45 | { |
49 | { |
46 | lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben.")); |
50 | //lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben.")); |
47 | } |
51 | } |
48 | } |
52 | } |
Line 49... | Line 53... | ||
49 | break; |
53 | break; |
50 | 54 | ||
51 | // Stick-Belegung der Fernsteuerung |
55 | // Stick-Belegung der Fernsteuerung |
52 | case 'P' : // DONE 0.71g |
56 | case 'P' : // DONE 0.71g |
53 | if (Parser::decode64(RX)) |
57 | if (Parser::decode64(RX)) |
54 | { |
58 | { |
55 | f_Settings->pb_K1->setValue(Parser::dataToInt(RX.decode, 2,true)); |
59 | /*f_Settings->pb_K1->setValue(Parser::dataToInt(RX.decode, 2,true)); |
56 | f_Settings->pb_K2->setValue(Parser::dataToInt(RX.decode, 4,true)); |
60 | f_Settings->pb_K2->setValue(Parser::dataToInt(RX.decode, 4,true)); |
57 | f_Settings->pb_K3->setValue(Parser::dataToInt(RX.decode, 6,true)); |
61 | f_Settings->pb_K3->setValue(Parser::dataToInt(RX.decode, 6,true)); |
58 | f_Settings->pb_K4->setValue(Parser::dataToInt(RX.decode, 8,true)); |
62 | f_Settings->pb_K4->setValue(Parser::dataToInt(RX.decode, 8,true)); |
59 | f_Settings->pb_K5->setValue(Parser::dataToInt(RX.decode, 10 ,true)); |
63 | f_Settings->pb_K5->setValue(Parser::dataToInt(RX.decode, 10 ,true)); |
60 | f_Settings->pb_K6->setValue(Parser::dataToInt(RX.decode, 12,true)); |
64 | f_Settings->pb_K6->setValue(Parser::dataToInt(RX.decode, 12,true)); |
61 | f_Settings->pb_K7->setValue(Parser::dataToInt(RX.decode, 14,true)); |
65 | f_Settings->pb_K7->setValue(Parser::dataToInt(RX.decode, 14,true)); |
62 | f_Settings->pb_K8->setValue(Parser::dataToInt(RX.decode, 16,true)); |
66 | f_Settings->pb_K8->setValue(Parser::dataToInt(RX.decode, 16,true));*/ |
63 | } |
67 | } |
64 | break; |
68 | break; |
65 | // Settings lesen |
69 | // Settings lesen |
66 | case 'Q' : // DONE 0.71g |
70 | case 'Q' : // DONE 0.71g |
67 | if (Parser::decode64(RX)) |
71 | if (Parser::decode64(RX)) |
Line 68... | Line 72... | ||
68 | { |
72 | { |
69 | o_Connection->stop_ReSend(); |
73 | com->stopReSend(); |
70 | 74 | ||
71 | if (RX.decode[1] == VERSION_SETTINGS) |
75 | if (RX.decode[1] == VERSION_SETTINGS) |
72 | { |
76 | { |
73 | int Settings_ID = RX.decode[0]; |
77 | int Settings_ID = RX.decode[0]; |
74 | for (int a = 0; a < MaxParameter; a++) |
78 | /*for (int a = 0; a < MaxParameter; a++) |
75 | { |
79 | { |
76 | FCSettings[a] = RX.decode[a + 2]; |
80 | FCSettings[a] = RX.decode[a + 2]; |
77 | } |
81 | } |
78 | f_Settings->show_FCSettings(Settings_ID, FCSettings); |
82 | f_Settings->show_FCSettings(Settings_ID, FCSettings); |
79 | f_Settings->pb_Read->setEnabled(true); |
83 | f_Settings->pb_Read->setEnabled(true); |
80 | f_Settings->pb_Write->setEnabled(true); |
84 | f_Settings->pb_Write->setEnabled(true);*/ |
81 | } |
85 | } |
82 | else |
86 | else |
Line 83... | Line 87... | ||
83 | { |
87 | { |
84 | f_Settings->pb_Read->setDisabled(true); |
88 | /*f_Settings->pb_Read->setDisabled(true); |
85 | f_Settings->pb_Write->setDisabled(true); |
89 | f_Settings->pb_Write->setDisabled(true); |
86 | 90 | ||
87 | QString name = QString("Versionen inkompatibel.\n") + |
91 | QString name = QString("Versionen inkompatibel.\n") + |
88 | QString("Version von GroundStation benoetigt: ") + |
92 | QString("Version von GroundStation benoetigt: ") + |
89 | QString(VERSION_SETTINGS) + |
93 | QString(VERSION_SETTINGS) + |
90 | QString("\nVersion auf der FlightCtrl: ") + |
94 | QString("\nVersion auf der FlightCtrl: ") + |
91 | QString(RX.decode[1]) + |
95 | QString(RX.decode[1]) + |
92 | QString("\nParameterbearbeitung nicht moeglich."); |
96 | QString("\nParameterbearbeitung nicht moeglich."); |
93 | QMessageBox::warning(this, QA_NAME, |
97 | QMessageBox::warning(this, QA_NAME, |
94 | name, QMessageBox::Ok); |
98 | name, QMessageBox::Ok);*/ |
95 | } |
99 | } |
96 | } |
100 | } |
- | 101 | break; |
|
97 | break; |
102 | // Settings written |
98 | // Settings geschrieben |
103 | case 'S' : // DONE 0.71g |
Line 99... | Line 104... | ||
99 | case 'S' : // DONE 0.71g |
104 | com->stopReSend(); |
100 | o_Connection->stop_ReSend(); |
105 | //TODO: QMessagebox("settings written successful") ? |
101 | break; |
106 | break; |
102 | } |
107 | } |
103 | 108 | ||
104 | case ADDRESS_NC : |
109 | case ADDRESS_NC : |
105 | switch(RX.input[2]) |
110 | switch(RX.input[2]) |
106 | { |
111 | { |
107 | // Navigationsdaten |
112 | // Navigationsdaten |
108 | case 'O' : // NOT DONE 0.12h |
113 | case 'O' : // NOT DONE 0.12h |
109 | if (Parser::decode64(RX)) |
114 | if (Parser::decode64(RX)) |
110 | { |
115 | { |
Line 119... | Line 124... | ||
119 | { |
124 | { |
120 | // LCD-Anzeige |
125 | // LCD-Anzeige |
121 | case 'L' : // DONE 0.71g |
126 | case 'L' : // DONE 0.71g |
122 | if (Parser::decode64(RX)) |
127 | if (Parser::decode64(RX)) |
123 | { |
128 | { |
124 | o_Connection->stop_ReSend(); |
129 | com->stopReSend(); |
Line 125... | Line 130... | ||
125 | 130 | ||
126 | int LCD[150]; |
131 | /*int LCD[150]; |
Line 127... | Line 132... | ||
127 | memcpy(LCD,RX.decode, sizeof(RX.decode)); |
132 | memcpy(LCD,RX.decode, sizeof(RX.decode)); |
Line 128... | Line 133... | ||
128 | 133 | ||
129 | f_LCD->show_Data(LCD); |
134 | f_LCD->show_Data(LCD); |
- | 135 | ||
130 | 136 | LCD_Page = RX.decode[0]; |
|
131 | LCD_Page = RX.decode[0]; |
137 | LCD_MAX_Page = RX.decode[1]; |
132 | LCD_MAX_Page = RX.decode[1]; |
138 | */ |
133 | } |
139 | } |
134 | break; |
140 | break; |
135 | // Analoglabels |
141 | // Analoglabels |
136 | case 'A' : // DONE 0.71g |
142 | case 'A' : // DONE 0.71g |
Line 137... | Line 143... | ||
137 | if (Parser::decode64(RX)) |
143 | if (Parser::decode64(RX)) |
138 | { |
144 | { |
139 | o_Connection->stop_ReSend(); |
145 | com->stopReSend(); |
- | 146 | ||
140 | 147 | int Position = RX.decode[0]; |
|
141 | int Position = RX.decode[0]; |
148 | if (Position != 31) |
142 | if (Position != 31) |
149 | { |
143 | { |
150 | /* |
144 | Settings->Analog1.Label[Position] = ToolBox::dataToQString(RX.decode,1,17).trimmed(); |
151 | Settings->Analog1.Label[Position] = ToolBox::dataToQString(RX.decode,1,17).trimmed(); |
145 | if (Settings->Analog1.Label[Position] == "") |
152 | if (Settings->Analog1.Label[Position] == "") |
146 | { |
153 | { |
147 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
154 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
148 | } |
155 | } |
149 | Position ++; |
156 | Position ++; |
150 | TX_Data[0] = Position; |
157 | TX_Data[0] = Position; |
- | 158 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);*/ |
|
151 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
159 | } |
152 | } |
160 | if (Position == 31) |
153 | if (Position == 31) |
161 | { |
154 | { |
162 | /* |
155 | for (int a = 0; a < MaxAnalog; a++) |
163 | for (int a = 0; a < MaxAnalog; a++) |
156 | { |
164 | { |
157 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
165 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
158 | } |
166 | } |
159 | Settings->Analog1.Version = QString(Mode.Version); |
167 | Settings->Analog1.Version = QString(Mode.Version); |
160 | Settings->write_Settings_AnalogLabels(HardwareID); |
168 | Settings->write_Settings_AnalogLabels(HardwareID); |
161 | config_Plot(); |
169 | config_Plot();*/ |
162 | } |
170 | } |
163 | } |
171 | } |
164 | break; |
172 | break; |
165 | // Debug-Daten |
173 | // Debug-Daten |
166 | case 'D' : // DONE 0.71g |
174 | case 'D' : // DONE 0.71g |
167 | if (Parser::decode64(RX)) |
175 | if (Parser::decode64(RX)) |
168 | { |
176 | { |
169 | for (int i = 0; i < MaxAnalog; i++) |
177 | for (int i = 0; i < MaxAnalog; i++) |
170 | { |
178 | { |
171 | AnalogData[i] = Parser::dataToInt(RX.decode, (i * 2) + 2); |
179 | //AnalogData[i] = Parser::dataToInt(RX.decode, (i * 2) + 2); |
172 | } |
180 | } |
173 | show_DebugData(); |
181 | //show_DebugData(); |
174 | } |
182 | } |
175 | break; |
183 | break; |
176 | // Version |
184 | // Version |
177 | case 'V' : // DONE 0.71h |
- | |
- | 185 | case 'V' : // DONE 0.71h |
|
178 | if (Parser::decode64(RX)) |
186 | if (Parser::decode64(RX)) |
179 | { |
187 | { |
180 | o_Connection->stop_ReSend(); |
188 | com->stopReSend(); |
181 | 189 | /* |
|
182 | Mode.ID = HardwareID; |
190 | Mode.ID = HardwareID; |
Line 281... | Line 289... | ||
281 | else |
289 | else |
282 | for (int a = 0; a < MaxAnalog; a++) |
290 | for (int a = 0; a < MaxAnalog; a++) |
283 | { |
291 | { |
284 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
292 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
285 | } |
293 | } |
286 | config_Plot(); |
294 | config_Plot();*/ |
287 | } |
295 | } |
288 | break; |
296 | break; |
289 | } |
297 | } |
290 | } |
298 | } |
291 | } |
299 | } |
292 | 300 |