Rev 1055 | Rev 1058 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1055 | Rev 1056 | ||
---|---|---|---|
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) 04.2007 Holger Buss |
2 | // + Copyright (c) 04.2007 Holger Buss |
3 | // + only for non-profit use |
3 | // + only for non-profit use |
4 | // + www.MikroKopter.com |
4 | // + www.MikroKopter.com |
5 | // + see the File "License.txt" for further Informations |
5 | // + see the File "License.txt" for further Informations |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7 | #include <stdarg.h> |
7 | #include <stdarg.h> |
8 | #include <string.h> |
8 | #include <string.h> |
9 | #include "main.h" |
9 | #include "main.h" |
10 | #include "uart.h" |
10 | #include "uart.h" |
11 | 11 | ||
12 | 12 | ||
13 | #define FC_ADDRESS 1 |
13 | #define FC_ADDRESS 1 |
14 | #define NC_ADDRESS 2 |
14 | #define NC_ADDRESS 2 |
15 | #define MK3MAG_ADDRESS 3 |
15 | #define MK3MAG_ADDRESS 3 |
16 | 16 | ||
17 | unsigned char GetExternalControl = 0,DebugDisplayAnforderung1 = 0, DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0, GetPPMChannelAnforderung = 0; |
17 | unsigned char GetExternalControl = 0,DebugDisplayAnforderung1 = 0, DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0, GetPPMChannelAnforderung = 0; |
18 | unsigned char DisplayLine = 0; |
18 | unsigned char DisplayLine = 0; |
19 | unsigned volatile char SioTmp = 0; |
19 | unsigned volatile char SioTmp = 0; |
20 | unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
20 | unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
21 | unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
21 | unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
22 | unsigned volatile char NMEABuffer[MAX_EMPFANGS_BUFF]; |
22 | unsigned volatile char NMEABuffer[MAX_EMPFANGS_BUFF]; |
23 | unsigned volatile char NeuerDatensatzEmpfangen = 0; |
23 | unsigned volatile char NeuerDatensatzEmpfangen = 0; |
24 | unsigned volatile char NeueKoordinateEmpfangen = 0; |
24 | unsigned volatile char NeueKoordinateEmpfangen = 0; |
25 | unsigned volatile char UebertragungAbgeschlossen = 1; |
25 | unsigned volatile char UebertragungAbgeschlossen = 1; |
26 | unsigned volatile char CntCrcError = 0; |
26 | unsigned volatile char CntCrcError = 0; |
27 | unsigned volatile char AnzahlEmpfangsBytes = 0; |
27 | unsigned volatile char AnzahlEmpfangsBytes = 0; |
28 | unsigned char *pRxData = 0; |
28 | unsigned char *pRxData = 0; |
29 | unsigned char RxDataLen = 0; |
29 | unsigned char RxDataLen = 0; |
30 | unsigned volatile char PC_DebugTimeout = 0; |
30 | unsigned volatile char PC_DebugTimeout = 0; |
31 | 31 | ||
32 | unsigned char DebugTextAnforderung = 255; |
32 | unsigned char DebugTextAnforderung = 255; |
33 | unsigned char PcZugriff = 100; |
33 | unsigned char PcZugriff = 100; |
34 | unsigned char MotorTest[4] = {0,0,0,0}; |
34 | unsigned char MotorTest[4] = {0,0,0,0}; |
35 | unsigned char MeineSlaveAdresse = 1; // Flight-Ctrl |
35 | unsigned char MeineSlaveAdresse = 1; // Flight-Ctrl |
36 | unsigned char ConfirmFrame; |
36 | unsigned char ConfirmFrame; |
37 | struct str_DebugOut DebugOut; |
37 | struct str_DebugOut DebugOut; |
38 | struct str_ExternControl ExternControl; |
38 | struct str_ExternControl ExternControl; |
39 | struct str_VersionInfo VersionInfo; |
39 | struct str_VersionInfo VersionInfo; |
40 | struct str_WinkelOut WinkelOut; |
40 | struct str_WinkelOut WinkelOut; |
41 | 41 | ||
42 | int Debug_Timer,Kompass_Timer; |
42 | int Debug_Timer,Kompass_Timer; |
43 | unsigned int DebugDataIntervall = 200; |
43 | unsigned int DebugDataIntervall = 200; |
44 | 44 | ||
45 | const unsigned char ANALOG_TEXT[32][16] = |
45 | const unsigned char ANALOG_TEXT[32][16] = |
46 | { |
46 | { |
47 | //1234567890123456 |
47 | //1234567890123456 |
48 | "IntegralNick ", //0 |
48 | "IntegralNick ", //0 |
49 | "IntegralRoll ", |
49 | "IntegralRoll ", |
50 | "AccNick ", |
50 | "AccNick ", |
51 | "AccRoll ", |
51 | "AccRoll ", |
52 | "GyroGier ", |
52 | "GyroGier ", |
53 | "HoehenWert ", //5 |
53 | "HoehenWert ", //5 |
54 | "AccZ ", |
54 | "AccZ ", |
55 | "Gas ", |
55 | "Gas ", |
56 | "KompassValue ", |
56 | "KompassValue ", |
57 | "Spannung ", |
57 | "Spannung ", |
58 | "Empfang ", //10 |
58 | "Empfang ", //10 |
59 | "Ersatzkompass ", |
59 | "Ersatzkompass ", |
60 | "Motor_Vorne ", |
60 | "Motor_Vorne ", |
61 | "Motor_Hinten ", |
61 | "Motor_Hinten ", |
62 | "Motor_Links ", |
62 | "Motor_Links ", |
63 | "Motor_Rechts ", //15 |
63 | "Motor_Rechts ", //15 |
64 | " ", |
64 | " ", |
65 | "Distance ", |
65 | "Distance ", |
66 | "OsdBar ", |
66 | "OsdBar ", |
67 | "MK3Mag CalState ", |
67 | "MK3Mag CalState ", |
68 | "Servo ", //20 |
68 | "Servo ", //20 |
69 | "Nick ", |
69 | "Nick ", |
70 | "Roll ", |
70 | "Roll ", |
71 | " ", |
71 | " ", |
72 | " ", |
72 | " ", |
73 | " ", //25 |
73 | " ", //25 |
74 | " ", |
74 | " ", |
75 | "Kalman_MaxDrift ", |
75 | "Kalman_MaxDrift ", |
76 | " ", |
76 | " ", |
77 | "Kalman K ", |
77 | "Kalman K ", |
78 | "GPS_Nick ", //30 |
78 | "GPS_Nick ", //30 |
79 | "GPS_Roll " |
79 | "GPS_Roll " |
80 | }; |
80 | }; |
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
84 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
85 | //++ Sende-Part der Datenübertragung |
85 | //++ Sende-Part der Datenübertragung |
86 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
86 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
87 | SIGNAL(INT_VEC_TX) |
87 | SIGNAL(INT_VEC_TX) |
88 | { |
88 | { |
89 | static unsigned int ptr = 0; |
89 | static unsigned int ptr = 0; |
90 | unsigned char tmp_tx; |
90 | unsigned char tmp_tx; |
91 | if(!UebertragungAbgeschlossen) |
91 | if(!UebertragungAbgeschlossen) |
92 | { |
92 | { |
93 | ptr++; // die [0] wurde schon gesendet |
93 | ptr++; // die [0] wurde schon gesendet |
94 | tmp_tx = SendeBuffer[ptr]; |
94 | tmp_tx = SendeBuffer[ptr]; |
95 | if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
95 | if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
96 | { |
96 | { |
97 | ptr = 0; |
97 | ptr = 0; |
98 | UebertragungAbgeschlossen = 1; |
98 | UebertragungAbgeschlossen = 1; |
99 | } |
99 | } |
100 | UDR = tmp_tx; |
100 | UDR = tmp_tx; |
101 | } |
101 | } |
102 | else ptr = 0; |
102 | else ptr = 0; |
103 | } |
103 | } |
104 | 104 | ||
105 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
105 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
106 | //++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
106 | //++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
107 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
107 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
108 | SIGNAL(INT_VEC_RX) |
108 | SIGNAL(INT_VEC_RX) |
109 | { |
109 | { |
110 | static unsigned int crc; |
110 | static unsigned int crc; |
111 | static unsigned char crc1,crc2,buf_ptr; |
111 | static unsigned char crc1,crc2,buf_ptr; |
112 | static unsigned char UartState = 0; |
112 | static unsigned char UartState = 0; |
113 | unsigned char CrcOkay = 0; |
113 | unsigned char CrcOkay = 0; |
114 | 114 | ||
115 | SioTmp = UDR; |
115 | SioTmp = UDR; |
116 | if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
116 | if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
117 | if(SioTmp == '\r' && UartState == 2) |
117 | if(SioTmp == '\r' && UartState == 2) |
118 | { |
118 | { |
119 | UartState = 0; |
119 | UartState = 0; |
120 | crc -= RxdBuffer[buf_ptr-2]; |
120 | crc -= RxdBuffer[buf_ptr-2]; |
121 | crc -= RxdBuffer[buf_ptr-1]; |
121 | crc -= RxdBuffer[buf_ptr-1]; |
122 | crc %= 4096; |
122 | crc %= 4096; |
123 | crc1 = '=' + crc / 64; |
123 | crc1 = '=' + crc / 64; |
124 | crc2 = '=' + crc % 64; |
124 | crc2 = '=' + crc % 64; |
125 | CrcOkay = 0; |
125 | CrcOkay = 0; |
126 | if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
126 | if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
127 | if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
127 | if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
128 | { |
128 | { |
129 | NeuerDatensatzEmpfangen = 1; |
129 | NeuerDatensatzEmpfangen = 1; |
130 | AnzahlEmpfangsBytes = buf_ptr + 1; |
130 | AnzahlEmpfangsBytes = buf_ptr + 1; |
131 | RxdBuffer[buf_ptr] = '\r'; |
131 | RxdBuffer[buf_ptr] = '\r'; |
132 | if(RxdBuffer[2] == 'R') wdt_enable(WDTO_250MS); // Reset-Commando |
132 | if(RxdBuffer[2] == 'R') wdt_enable(WDTO_250MS); // Reset-Commando |
133 | } |
133 | } |
134 | } |
134 | } |
135 | else |
135 | else |
136 | switch(UartState) |
136 | switch(UartState) |
137 | { |
137 | { |
138 | case 0: |
138 | case 0: |
139 | if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
139 | if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
140 | buf_ptr = 0; |
140 | buf_ptr = 0; |
141 | RxdBuffer[buf_ptr++] = SioTmp; |
141 | RxdBuffer[buf_ptr++] = SioTmp; |
142 | crc = SioTmp; |
142 | crc = SioTmp; |
143 | break; |
143 | break; |
144 | case 1: // Adresse auswerten |
144 | case 1: // Adresse auswerten |
145 | UartState++; |
145 | UartState++; |
146 | RxdBuffer[buf_ptr++] = SioTmp; |
146 | RxdBuffer[buf_ptr++] = SioTmp; |
147 | crc += SioTmp; |
147 | crc += SioTmp; |
148 | break; |
148 | break; |
149 | case 2: // Eingangsdaten sammeln |
149 | case 2: // Eingangsdaten sammeln |
150 | RxdBuffer[buf_ptr] = SioTmp; |
150 | RxdBuffer[buf_ptr] = SioTmp; |
151 | if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
151 | if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
152 | else UartState = 0; |
152 | else UartState = 0; |
153 | crc += SioTmp; |
153 | crc += SioTmp; |
154 | break; |
154 | break; |
155 | default: |
155 | default: |
156 | UartState = 0; |
156 | UartState = 0; |
157 | break; |
157 | break; |
158 | } |
158 | } |
159 | } |
159 | } |
160 | 160 | ||
161 | 161 | ||
162 | // -------------------------------------------------------------------------- |
162 | // -------------------------------------------------------------------------- |
163 | void AddCRC(unsigned int wieviele) |
163 | void AddCRC(unsigned int wieviele) |
164 | { |
164 | { |
165 | unsigned int tmpCRC = 0,i; |
165 | unsigned int tmpCRC = 0,i; |
166 | for(i = 0; i < wieviele;i++) |
166 | for(i = 0; i < wieviele;i++) |
167 | { |
167 | { |
168 | tmpCRC += SendeBuffer[i]; |
168 | tmpCRC += SendeBuffer[i]; |
169 | } |
169 | } |
170 | tmpCRC %= 4096; |
170 | tmpCRC %= 4096; |
171 | SendeBuffer[i++] = '=' + tmpCRC / 64; |
171 | SendeBuffer[i++] = '=' + tmpCRC / 64; |
172 | SendeBuffer[i++] = '=' + tmpCRC % 64; |
172 | SendeBuffer[i++] = '=' + tmpCRC % 64; |
173 | SendeBuffer[i++] = '\r'; |
173 | SendeBuffer[i++] = '\r'; |
174 | UebertragungAbgeschlossen = 0; |
174 | UebertragungAbgeschlossen = 0; |
175 | UDR = SendeBuffer[0]; |
175 | UDR = SendeBuffer[0]; |
176 | } |
176 | } |
177 | 177 | ||
178 | 178 | ||
179 | 179 | ||
180 | // -------------------------------------------------------------------------- |
180 | // -------------------------------------------------------------------------- |
181 | void SendOutData(unsigned char cmd,unsigned char modul, unsigned char BufferAnzahl, ...) //unsigned char *snd, unsigned char len) |
181 | void SendOutData(unsigned char cmd,unsigned char address, unsigned char BufferAnzahl, ...) //unsigned char *snd, unsigned char len) |
182 | { |
182 | { |
183 | va_list ap; |
183 | va_list ap; |
184 | unsigned int pt = 0; |
184 | unsigned int pt = 0; |
185 | unsigned char a,b,c; |
185 | unsigned char a,b,c; |
186 | unsigned char ptr = 0; |
186 | unsigned char ptr = 0; |
187 | 187 | ||
188 | unsigned char *snd = 0; |
188 | unsigned char *snd = 0; |
189 | int len = 0; |
189 | int len = 0; |
190 | 190 | ||
191 | SendeBuffer[pt++] = '#'; // Startzeichen |
191 | SendeBuffer[pt++] = '#'; // Startzeichen |
192 | SendeBuffer[pt++] = modul; // Adresse (a=0; b=1,...) |
192 | SendeBuffer[pt++] = 'a' + address; // Adresse (a=0; b=1,...) |
193 | SendeBuffer[pt++] = cmd; // Commando |
193 | SendeBuffer[pt++] = cmd; // Commando |
194 | 194 | ||
195 | va_start(ap, BufferAnzahl); |
195 | va_start(ap, BufferAnzahl); |
196 | if(BufferAnzahl) |
196 | if(BufferAnzahl) |
197 | { |
197 | { |
198 | snd = va_arg(ap, unsigned char*); |
198 | snd = va_arg(ap, unsigned char*); |
199 | len = va_arg(ap, int); |
199 | len = va_arg(ap, int); |
200 | ptr = 0; |
200 | ptr = 0; |
201 | BufferAnzahl--; |
201 | BufferAnzahl--; |
202 | } |
202 | } |
203 | while(len) |
203 | while(len) |
204 | { |
204 | { |
205 | if(len) |
205 | if(len) |
206 | { |
206 | { |
207 | a = snd[ptr++]; |
207 | a = snd[ptr++]; |
208 | len--; |
208 | len--; |
209 | if((!len) && BufferAnzahl) |
209 | if((!len) && BufferAnzahl) |
210 | { |
210 | { |
211 | snd = va_arg(ap, unsigned char*); |
211 | snd = va_arg(ap, unsigned char*); |
212 | len = va_arg(ap, int); |
212 | len = va_arg(ap, int); |
213 | ptr = 0; |
213 | ptr = 0; |
214 | BufferAnzahl--; |
214 | BufferAnzahl--; |
215 | } |
215 | } |
216 | } |
216 | } |
217 | else a = 0; |
217 | else a = 0; |
218 | if(len) |
218 | if(len) |
219 | { |
219 | { |
220 | b = snd[ptr++]; |
220 | b = snd[ptr++]; |
221 | len--; |
221 | len--; |
222 | if((!len) && BufferAnzahl) |
222 | if((!len) && BufferAnzahl) |
223 | { |
223 | { |
224 | snd = va_arg(ap, unsigned char*); |
224 | snd = va_arg(ap, unsigned char*); |
225 | len = va_arg(ap, int); |
225 | len = va_arg(ap, int); |
226 | ptr = 0; |
226 | ptr = 0; |
227 | BufferAnzahl--; |
227 | BufferAnzahl--; |
228 | } |
228 | } |
229 | } |
229 | } |
230 | else b = 0; |
230 | else b = 0; |
231 | if(len) |
231 | if(len) |
232 | { |
232 | { |
233 | c = snd[ptr++]; |
233 | c = snd[ptr++]; |
234 | len--; |
234 | len--; |
235 | if((!len) && BufferAnzahl) |
235 | if((!len) && BufferAnzahl) |
236 | { |
236 | { |
237 | snd = va_arg(ap, unsigned char*); |
237 | snd = va_arg(ap, unsigned char*); |
238 | len = va_arg(ap, int); |
238 | len = va_arg(ap, int); |
239 | ptr = 0; |
239 | ptr = 0; |
240 | BufferAnzahl--; |
240 | BufferAnzahl--; |
241 | } |
241 | } |
242 | } |
242 | } |
243 | else c = 0; |
243 | else c = 0; |
244 | SendeBuffer[pt++] = '=' + (a >> 2); |
244 | SendeBuffer[pt++] = '=' + (a >> 2); |
245 | SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
245 | SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
246 | SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
246 | SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
247 | SendeBuffer[pt++] = '=' + ( c & 0x3f); |
247 | SendeBuffer[pt++] = '=' + ( c & 0x3f); |
248 | } |
248 | } |
249 | va_end(ap); |
249 | va_end(ap); |
250 | AddCRC(pt); |
250 | AddCRC(pt); |
251 | } |
251 | } |
252 | 252 | ||
253 | 253 | ||
254 | // -------------------------------------------------------------------------- |
254 | // -------------------------------------------------------------------------- |
255 | void Decode64(void) // die daten werden im rx buffer dekodiert, das geht nur, weil aus 4 byte immer 3 gemacht werden. |
255 | void Decode64(void) // die daten werden im rx buffer dekodiert, das geht nur, weil aus 4 byte immer 3 gemacht werden. |
256 | { |
256 | { |
257 | unsigned char a,b,c,d; |
257 | unsigned char a,b,c,d; |
258 | unsigned char x,y,z; |
258 | unsigned char x,y,z; |
259 | unsigned char ptrIn = 3; // start at begin of data block |
259 | unsigned char ptrIn = 3; // start at begin of data block |
260 | unsigned char ptrOut = 3; |
260 | unsigned char ptrOut = 3; |
261 | unsigned char len = AnzahlEmpfangsBytes - 6; // von der Gesamtbytezahl eines Frames gehen 3 Bytes des Headers ('#',Addr, Cmd) und 3 Bytes des Footers (CRC1, CRC2, '\r') ab. |
261 | unsigned char len = AnzahlEmpfangsBytes - 6; // von der Gesamtbytezahl eines Frames gehen 3 Bytes des Headers ('#',Addr, Cmd) und 3 Bytes des Footers (CRC1, CRC2, '\r') ab. |
262 | 262 | ||
263 | while(len) |
263 | while(len) |
264 | { |
264 | { |
265 | a = RxdBuffer[ptrIn++] - '='; |
265 | a = RxdBuffer[ptrIn++] - '='; |
266 | b = RxdBuffer[ptrIn++] - '='; |
266 | b = RxdBuffer[ptrIn++] - '='; |
267 | c = RxdBuffer[ptrIn++] - '='; |
267 | c = RxdBuffer[ptrIn++] - '='; |
268 | d = RxdBuffer[ptrIn++] - '='; |
268 | d = RxdBuffer[ptrIn++] - '='; |
269 | 269 | ||
270 | x = (a << 2) | (b >> 4); |
270 | x = (a << 2) | (b >> 4); |
271 | y = ((b & 0x0f) << 4) | (c >> 2); |
271 | y = ((b & 0x0f) << 4) | (c >> 2); |
272 | z = ((c & 0x03) << 6) | d; |
272 | z = ((c & 0x03) << 6) | d; |
273 | 273 | ||
274 | if(len--) RxdBuffer[ptrOut++] = x; else break; |
274 | if(len--) RxdBuffer[ptrOut++] = x; else break; |
275 | if(len--) RxdBuffer[ptrOut++] = y; else break; |
275 | if(len--) RxdBuffer[ptrOut++] = y; else break; |
276 | if(len--) RxdBuffer[ptrOut++] = z; else break; |
276 | if(len--) RxdBuffer[ptrOut++] = z; else break; |
277 | } |
277 | } |
278 | pRxData = (unsigned char*)&RxdBuffer[3]; // decodierte Daten beginnen beim 4. Byte |
278 | pRxData = (unsigned char*)&RxdBuffer[3]; // decodierte Daten beginnen beim 4. Byte |
279 | RxDataLen = ptrOut - 3; // wie viele Bytes wurden dekodiert? |
279 | RxDataLen = ptrOut - 3; // wie viele Bytes wurden dekodiert? |
280 | 280 | ||
281 | } |
281 | } |
282 | 282 | ||
283 | // -------------------------------------------------------------------------- |
283 | // -------------------------------------------------------------------------- |
284 | void BearbeiteRxDaten(void) |
284 | void BearbeiteRxDaten(void) |
285 | { |
285 | { |
286 | if(!NeuerDatensatzEmpfangen) return; |
286 | if(!NeuerDatensatzEmpfangen) return; |
- | 287 | ||
287 | 288 | Decode64(); // dekodiere datenblock im Empfangsbuffer |
|
288 | switch(RxdBuffer[1]-'a') // check for Slave Address |
289 | switch(RxdBuffer[1]-'a') // check for Slave Address |
289 | { |
290 | { |
290 | case FC_ADDRESS: // FC special commands |
291 | case FC_ADDRESS: // FC special commands |
291 | Decode64(); // dekodiere datenblock im Empfangsbuffer |
- | |
- | 292 | ||
292 | switch(RxdBuffer[2]) |
293 | switch(RxdBuffer[2]) |
293 | { |
294 | { |
294 | case 'K':// Kompasswert |
295 | case 'K':// Kompasswert |
295 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
296 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
296 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
297 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
297 | break; |
298 | break; |
298 | 299 | ||
299 | case 't':// Motortest |
300 | case 't':// Motortest |
300 | memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
301 | memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
301 | while(!UebertragungAbgeschlossen); |
302 | while(!UebertragungAbgeschlossen); |
302 | SendOutData('T', MeineSlaveAdresse, 0); |
303 | SendOutData('T', MeineSlaveAdresse, 0); |
303 | PcZugriff = 255; |
304 | PcZugriff = 255; |
304 | break; |
305 | break; |
305 | 306 | ||
306 | case 'p': // get PPM Channels |
307 | case 'p': // get PPM Channels |
307 | GetPPMChannelAnforderung = 1; |
308 | GetPPMChannelAnforderung = 1; |
308 | break; |
309 | break; |
309 | 310 | ||
310 | case 'q':// "Get"-Anforderung für Settings |
311 | case 'q':// "Get"-Anforderung für Settings |
311 | // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
312 | // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
312 | if(pRxData[0] == 0xFF) |
313 | if(pRxData[0] == 0xFF) |
313 | { |
314 | { |
314 | pRxData[0] = GetActiveParamSetNumber(); |
315 | pRxData[0] = GetActiveParamSetNumber(); |
315 | } |
316 | } |
316 | else // request active parameter set |
317 | else // request active parameter set |
317 | { |
318 | { |
318 | if(pRxData[0] < 1) pRxData[0] = 1; // limit to 5 |
319 | if(pRxData[0] < 1) pRxData[0] = 1; // limit to 5 |
319 | else if(pRxData[0] > 5) pRxData[0] = 5; // limit to 5 |
320 | else if(pRxData[0] > 5) pRxData[0] = 5; // limit to 5 |
320 | // load requested parameter set |
321 | // load requested parameter set |
321 | ReadParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
322 | ReadParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
322 | } |
323 | } |
323 | while(!UebertragungAbgeschlossen); |
324 | while(!UebertragungAbgeschlossen); |
324 | SendOutData('Q', FC_ADDRESS, 2, &pRxData[0], sizeof(unsigned char), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
325 | SendOutData('Q', FC_ADDRESS, 2, &pRxData[0], sizeof(unsigned char), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
325 | break; |
326 | break; |
326 | 327 | ||
327 | case 's': // Parametersatz speichern |
328 | case 's': // Parametersatz speichern |
328 | if((1 <= pRxData[0]) && (pRxData[0] <= 5)) // check for setting to be in range |
329 | if((1 <= pRxData[0]) && (pRxData[0] <= 5)) // check for setting to be in range |
329 | { |
330 | { |
330 | memcpy((unsigned char *) &EE_Parameter.Kanalbelegung[0], (unsigned char *)&pRxData[1], STRUCT_PARAM_LAENGE); |
331 | memcpy((unsigned char *) &EE_Parameter.Kanalbelegung[0], (unsigned char *)&pRxData[1], STRUCT_PARAM_LAENGE); |
331 | WriteParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
332 | WriteParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
332 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken |
333 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken |
333 | Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
334 | Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
334 | Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
335 | Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
335 | Piep(GetActiveParamSetNumber()); |
336 | Piep(GetActiveParamSetNumber()); |
336 | while(!UebertragungAbgeschlossen); |
337 | while(!UebertragungAbgeschlossen); |
337 | SendOutData('S', FC_ADDRESS, 1, &pRxData[0], sizeof(unsigned char)); |
338 | SendOutData('S', FC_ADDRESS, 1, &pRxData[0], sizeof(unsigned char)); |
338 | } |
339 | } |
339 | break; |
340 | break; |
340 | - | ||
341 | } |
341 | |
342 | break; // case FC_ADDRESS: |
342 | } // case FC_ADDRESS: |
343 | 343 | ||
344 | default: // any Slave Address |
344 | default: // any Slave Address |
345 | Decode64(); |
345 | |
346 | switch(RxdBuffer[2]) |
346 | switch(RxdBuffer[2]) |
347 | { |
347 | { |
348 | // 't' comand placed here only for compatibility to BL |
348 | // 't' comand placed here only for compatibility to BL |
349 | case 't':// Motortest |
349 | case 't':// Motortest |
350 | memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
350 | memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
351 | while(!UebertragungAbgeschlossen); |
351 | while(!UebertragungAbgeschlossen); |
352 | SendOutData('T', MeineSlaveAdresse, 0); |
352 | SendOutData('T', MeineSlaveAdresse, 0); |
353 | PcZugriff = 255; |
353 | PcZugriff = 255; |
354 | break; |
354 | break; |
355 | // 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address |
355 | // 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address |
356 | case 'K':// Kompasswert |
356 | case 'K':// Kompasswert |
357 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
357 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
358 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
358 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
359 | break; |
359 | break; |
360 | 360 | ||
361 | case 'a':// Texte der Analogwerte |
361 | case 'a':// Texte der Analogwerte |
362 | DebugTextAnforderung = pRxData[0]; |
362 | DebugTextAnforderung = pRxData[0]; |
363 | if (DebugTextAnforderung > 31) DebugTextAnforderung = 31; |
363 | if (DebugTextAnforderung > 31) DebugTextAnforderung = 31; |
364 | PcZugriff = 255; |
364 | PcZugriff = 255; |
365 | break; |
365 | break; |
366 | 366 | ||
367 | case 'b': |
367 | case 'b': |
368 | memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl)); |
368 | memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl)); |
369 | ConfirmFrame = ExternControl.Frame; |
369 | ConfirmFrame = ExternControl.Frame; |
370 | PcZugriff = 255; |
370 | PcZugriff = 255; |
371 | break; |
371 | break; |
372 | case 'd': // Poll the debug data |
372 | case 'd': // Poll the debug data |
373 | DebugDataIntervall = pRxData[0] * 10; |
373 | DebugDataIntervall = pRxData[0] * 10; |
374 | if (DebugDataIntervall>0) DebugDataAnforderung = 1; |
374 | if (DebugDataIntervall > 0) DebugDataAnforderung = 1; |
375 | break; |
375 | break; |
376 | 376 | ||
377 | case 'h':// x-1 Displayzeilen |
377 | case 'h':// x-1 Displayzeilen |
378 | RemoteKeys |= pRxData[0]; |
378 | RemoteKeys |= pRxData[0]; |
379 | if(RemoteKeys) DisplayLine = 0; |
379 | if(RemoteKeys) DisplayLine = 0; |
380 | DebugDisplayAnforderung = 1; |
380 | DebugDisplayAnforderung = 1; |
381 | break; |
381 | break; |
382 | 382 | ||
383 | case 'l':// x-1 Displayzeilen |
383 | case 'l':// x-1 Displayzeilen |
384 | MenuePunkt = pRxData[0]; |
384 | MenuePunkt = pRxData[0]; |
385 | DebugDisplayAnforderung1 = 1; |
385 | DebugDisplayAnforderung1 = 1; |
386 | break; |
386 | break; |
387 | case 'v': // Version-Anforderung und Ausbaustufe |
387 | case 'v': // Version-Anforderung und Ausbaustufe |
388 | GetVersionAnforderung = 1; |
388 | GetVersionAnforderung = 1; |
389 | break; |
389 | break; |
390 | 390 | ||
391 | case 'g':// |
391 | case 'g':// |
392 | GetExternalControl = 1; |
392 | GetExternalControl = 1; |
393 | break; |
393 | break; |
394 | } |
394 | } |
395 | break; // default: |
395 | break; // default: |
396 | } |
396 | } |
397 | NeuerDatensatzEmpfangen = 0; |
397 | NeuerDatensatzEmpfangen = 0; |
398 | pRxData = 0; |
398 | pRxData = 0; |
399 | RxDataLen = 0; |
399 | RxDataLen = 0; |
400 | } |
400 | } |
401 | 401 | ||
402 | //############################################################################ |
402 | //############################################################################ |
403 | //Routine für die Serielle Ausgabe |
403 | //Routine für die Serielle Ausgabe |
404 | int uart_putchar (char c) |
404 | int uart_putchar (char c) |
405 | //############################################################################ |
405 | //############################################################################ |
406 | { |
406 | { |
407 | if (c == '\n') |
407 | if (c == '\n') |
408 | uart_putchar('\r'); |
408 | uart_putchar('\r'); |
409 | //Warten solange bis Zeichen gesendet wurde |
409 | //Warten solange bis Zeichen gesendet wurde |
410 | loop_until_bit_is_set(USR, UDRE); |
410 | loop_until_bit_is_set(USR, UDRE); |
411 | //Ausgabe des Zeichens |
411 | //Ausgabe des Zeichens |
412 | UDR = c; |
412 | UDR = c; |
413 | 413 | ||
414 | return (0); |
414 | return (0); |
415 | } |
415 | } |
416 | 416 | ||
417 | // -------------------------------------------------------------------------- |
417 | // -------------------------------------------------------------------------- |
418 | void WriteProgramData(unsigned int pos, unsigned char wert) |
418 | void WriteProgramData(unsigned int pos, unsigned char wert) |
419 | { |
419 | { |
420 | //if (ProgramLocation == IN_RAM) Buffer[pos] = wert; |
420 | //if (ProgramLocation == IN_RAM) Buffer[pos] = wert; |
421 | // else eeprom_write_byte(&EE_Buffer[pos], wert); |
421 | // else eeprom_write_byte(&EE_Buffer[pos], wert); |
422 | // Buffer[pos] = wert; |
422 | // Buffer[pos] = wert; |
423 | } |
423 | } |
424 | 424 | ||
425 | //############################################################################ |
425 | //############################################################################ |
426 | //INstallation der Seriellen Schnittstelle |
426 | //INstallation der Seriellen Schnittstelle |
427 | void UART_Init (void) |
427 | void UART_Init (void) |
428 | //############################################################################ |
428 | //############################################################################ |
429 | { |
429 | { |
430 | //Enable TXEN im Register UCR TX-Data Enable & RX Enable |
430 | //Enable TXEN im Register UCR TX-Data Enable & RX Enable |
431 | 431 | ||
432 | UCR=(1 << TXEN) | (1 << RXEN); |
432 | UCR=(1 << TXEN) | (1 << RXEN); |
433 | // UART Double Speed (U2X) |
433 | // UART Double Speed (U2X) |
434 | USR |= (1<<U2X); |
434 | USR |= (1<<U2X); |
435 | // RX-Interrupt Freigabe |
435 | // RX-Interrupt Freigabe |
436 | UCSRB |= (1<<RXCIE); |
436 | UCSRB |= (1<<RXCIE); |
437 | // TX-Interrupt Freigabe |
437 | // TX-Interrupt Freigabe |
438 | UCSRB |= (1<<TXCIE); |
438 | UCSRB |= (1<<TXCIE); |
439 | 439 | ||
440 | //Teiler wird gesetzt |
440 | //Teiler wird gesetzt |
441 | UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1); |
441 | UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1); |
442 | //UBRR = 33; |
442 | //UBRR = 33; |
443 | //öffnet einen Kanal für printf (STDOUT) |
443 | //öffnet einen Kanal für printf (STDOUT) |
444 | //fdevopen (uart_putchar, 0); |
444 | //fdevopen (uart_putchar, 0); |
445 | //sbi(PORTD,4); |
445 | //sbi(PORTD,4); |
446 | Debug_Timer = SetDelay(DebugDataIntervall); |
446 | Debug_Timer = SetDelay(DebugDataIntervall); |
447 | Kompass_Timer = SetDelay(220); |
447 | Kompass_Timer = SetDelay(220); |
448 | 448 | ||
449 | VersionInfo.Major = VERSION_MAJOR; |
449 | VersionInfo.Major = VERSION_MAJOR; |
450 | VersionInfo.Minor = VERSION_MINOR; |
450 | VersionInfo.Minor = VERSION_MINOR; |
451 | VersionInfo.Patch = VERSION_PATCH; |
451 | VersionInfo.Patch = VERSION_PATCH; |
452 | VersionInfo.Compatible = VERSION_SERIAL_COMPATIBLE; |
452 | VersionInfo.Compatible = VERSION_SERIAL_COMPATIBLE; |
453 | 453 | ||
454 | pRxData = 0; |
454 | pRxData = 0; |
455 | RxDataLen = 0; |
455 | RxDataLen = 0; |
456 | } |
456 | } |
457 | 457 | ||
458 | //--------------------------------------------------------------------------------------------- |
458 | //--------------------------------------------------------------------------------------------- |
459 | void DatenUebertragung(void) |
459 | void DatenUebertragung(void) |
460 | { |
460 | { |
461 | if(!UebertragungAbgeschlossen) return; |
461 | if(!UebertragungAbgeschlossen) return; |
462 | 462 | ||
463 | if(GetExternalControl && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
463 | if(GetExternalControl && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
464 | { |
464 | { |
465 | SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl)); |
465 | SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl)); |
466 | GetExternalControl = 0; |
466 | GetExternalControl = 0; |
467 | } |
467 | } |
468 | 468 | ||
469 | if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen) |
469 | if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen) |
470 | { |
470 | { |
471 | WinkelOut.Winkel[0] = (int) (IntegralNick / 108); // etwa in 0,1 Grad |
471 | WinkelOut.Winkel[0] = (int) (IntegralNick / 108); // etwa in 0,1 Grad |
472 | WinkelOut.Winkel[1] = (int) (IntegralRoll / 108); // etwa in 0,1 Grad |
472 | WinkelOut.Winkel[1] = (int) (IntegralRoll / 108); // etwa in 0,1 Grad |
473 | WinkelOut.UserParameter[0] = Parameter_UserParam1; |
473 | WinkelOut.UserParameter[0] = Parameter_UserParam1; |
474 | WinkelOut.UserParameter[1] = Parameter_UserParam2; |
474 | WinkelOut.UserParameter[1] = Parameter_UserParam2; |
475 | SendOutData('w', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut)); |
475 | SendOutData('w', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut)); |
476 | if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt |
476 | if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt |
477 | Kompass_Timer = SetDelay(99); |
477 | Kompass_Timer = SetDelay(99); |
478 | } |
478 | } |
479 | if((( DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen) |
479 | if((( DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen) |
480 | { |
480 | { |
481 | SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut)); |
481 | SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut)); |
482 | DebugDataAnforderung = 0; |
482 | DebugDataAnforderung = 0; |
483 | if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall); |
483 | if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall); |
484 | } |
484 | } |
485 | if(DebugTextAnforderung != 255) // Texte für die Analogdaten |
485 | if(DebugTextAnforderung != 255) // Texte für die Analogdaten |
486 | { |
486 | { |
487 | SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),(unsigned char *) ANALOG_TEXT[DebugTextAnforderung], 16); |
487 | SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),(unsigned char *) ANALOG_TEXT[DebugTextAnforderung], 16); |
488 | DebugTextAnforderung = 255; |
488 | DebugTextAnforderung = 255; |
489 | } |
489 | } |
490 | if(ConfirmFrame && UebertragungAbgeschlossen) // Datensatz bestätigen |
490 | if(ConfirmFrame && UebertragungAbgeschlossen) // Datensatz bestätigen |
491 | { |
491 | { |
492 | SendOutData('B', FC_ADDRESS, 1, (uint8_t*)&ConfirmFrame, sizeof(ConfirmFrame)); |
492 | SendOutData('B', FC_ADDRESS, 1, (uint8_t*)&ConfirmFrame, sizeof(ConfirmFrame)); |
493 | ConfirmFrame = 0; |
493 | ConfirmFrame = 0; |
494 | } |
494 | } |
495 | 495 | ||
496 | if(DebugDisplayAnforderung && UebertragungAbgeschlossen) |
496 | if(DebugDisplayAnforderung && UebertragungAbgeschlossen) |
497 | { |
497 | { |
498 | Menu(); |
498 | Menu(); |
499 | SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), &DisplayBuff[DisplayLine * 20], 20); |
499 | SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), &DisplayBuff[DisplayLine * 20], 20); |
500 | DisplayLine++; |
500 | DisplayLine++; |
501 | if(DisplayLine >= 4) DisplayLine = 0; |
501 | if(DisplayLine >= 4) DisplayLine = 0; |
502 | DebugDisplayAnforderung = 0; |
502 | DebugDisplayAnforderung = 0; |
503 | } |
503 | } |
504 | if(DebugDisplayAnforderung1 && UebertragungAbgeschlossen) |
504 | if(DebugDisplayAnforderung1 && UebertragungAbgeschlossen) |
505 | { |
505 | { |
506 | Menu(); |
506 | Menu(); |
507 | SendOutData('L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff)); |
507 | SendOutData('L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff)); |
508 | DebugDisplayAnforderung1 = 0; |
508 | DebugDisplayAnforderung1 = 0; |
509 | } |
509 | } |
510 | if(GetVersionAnforderung && UebertragungAbgeschlossen) |
510 | if(GetVersionAnforderung && UebertragungAbgeschlossen) |
511 | { |
511 | { |
512 | SendOutData('V', FC_ADDRESS, 1, (unsigned char *) &VersionInfo, sizeof(VersionInfo)); |
512 | SendOutData('V', FC_ADDRESS, 1, (unsigned char *) &VersionInfo, sizeof(VersionInfo)); |
513 | GetVersionAnforderung = 0; |
513 | GetVersionAnforderung = 0; |
514 | } |
514 | } |
515 | if(GetPPMChannelAnforderung && UebertragungAbgeschlossen) |
515 | if(GetPPMChannelAnforderung && UebertragungAbgeschlossen) |
516 | { |
516 | { |
517 | SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in)); |
517 | SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in)); |
518 | GetPPMChannelAnforderung = 0; |
518 | GetPPMChannelAnforderung = 0; |
519 | } |
519 | } |
520 | 520 | ||
521 | } |
521 | } |
522 | 522 | ||
523 | 523 |