Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1704 | - | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) 04.2007 Holger Buss |
||
3 | // + only for non-profit use |
||
4 | // + www.MikroKopter.com |
||
5 | // + see the File "License.txt" for further Informations |
||
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
7 | |||
8 | #include <avr/io.h> |
||
9 | #include <avr/interrupt.h> |
||
10 | #include <avr/pgmspace.h> |
||
11 | #include <avr/wdt.h> |
||
12 | #include <stdarg.h> |
||
13 | #include <string.h> |
||
14 | |||
15 | #include "main.h" |
||
16 | #include "menu.h" |
||
17 | #include "timer0.h" |
||
18 | #include "uart0.h" |
||
19 | #include "ubx.h" |
||
20 | #include "printf_P.h" |
||
21 | |||
22 | |||
23 | #define FC_ADDRESS 1 |
||
24 | #define NC_ADDRESS 2 |
||
25 | #define MK3MAG_ADDRESS 3 |
||
26 | |||
27 | #define FM_ADDRESS 10 // FOLLOW ME |
||
28 | |||
29 | #define FALSE 0 |
||
30 | #define TRUE 1 |
||
31 | |||
32 | #define ABO_TIMEOUT 4000 // disable abo after 4 seconds |
||
33 | |||
34 | //int8_t test __attribute__ ((section (".noinit"))); |
||
35 | uint8_t Request_VerInfo = FALSE; |
||
36 | uint8_t Request_Display = FALSE; |
||
37 | uint8_t Request_Display1 = FALSE; |
||
38 | uint8_t Request_ExternalControl = FALSE; |
||
39 | uint8_t Request_DebugData = FALSE; |
||
40 | uint8_t Request_DebugLabel = 255; |
||
41 | uint8_t Request_SendFollowMe = FALSE; |
||
42 | uint8_t DisplayLine = 0; |
||
43 | uint8_t DisplayKeys = 0; |
||
44 | |||
45 | volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
||
46 | volatile uint8_t rxd_buffer_locked = FALSE; |
||
47 | volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
||
48 | volatile uint8_t txd_complete = TRUE; |
||
49 | volatile uint8_t ReceivedBytes = 0; |
||
50 | volatile uint8_t *pRxData = 0; |
||
51 | volatile uint8_t RxDataLen = 0; |
||
52 | |||
53 | uint8_t PcAccess = 100; |
||
54 | uint16_t AboTimeOut = 0; |
||
55 | |||
56 | ExternControl_t ExternControl; |
||
57 | DebugOut_t DebugOut; |
||
58 | UART_VersionInfo_t UART_VersionInfo; |
||
59 | |||
60 | uint16_t DebugData_Timer; |
||
61 | uint16_t DebugData_Interval = 0; // in 1ms |
||
62 | uint16_t Display_Timer; |
||
63 | uint16_t Display_Interval = 0; |
||
64 | |||
65 | Point_t FollowMe; |
||
66 | |||
67 | // keep lables in flash to save 512 bytes of sram space |
||
68 | const prog_uint8_t ANALOG_LABEL[32][16] = |
||
69 | { |
||
70 | //1234567890123456 |
||
71 | "Analog_Ch0 ", //0 |
||
72 | "Analog_Ch1 ", |
||
73 | "Analog_Ch2 ", |
||
74 | "Analog_Ch3 ", |
||
75 | "Analog_Ch4 ", |
||
76 | "Analog_Ch5 ", //5 |
||
77 | "Analog_Ch6 ", |
||
78 | "Analog_Ch7 ", |
||
79 | "UBat ", |
||
80 | "SysState ", |
||
81 | "Num_Of_Sats ", //10 |
||
82 | "Zellenzahl ", |
||
83 | "PowerOn ", |
||
84 | "Error ", |
||
85 | "Debug14 ", |
||
86 | "Debug15 ", //15 |
||
87 | "Debug16 ", |
||
88 | "Debug17 ", |
||
89 | "Debug18 ", |
||
90 | "Debug19 ", |
||
91 | "Debug20 ", //20 |
||
92 | "Debug21 ", |
||
93 | "Debug22 ", |
||
94 | "Debug23 ", |
||
95 | "Debug24 ", |
||
96 | "Debug25 ", //25 |
||
97 | "Debug26 ", |
||
98 | "Debug27 ", |
||
99 | "Debug28 ", |
||
100 | "Debug29 ", |
||
101 | "Debug30 ", //30 |
||
102 | "Debug31 " |
||
103 | }; |
||
104 | |||
105 | |||
106 | |||
107 | /****************************************************************/ |
||
108 | /* Initialization of the USART0 */ |
||
109 | /****************************************************************/ |
||
110 | void USART0_Init (void) |
||
111 | { |
||
112 | uint8_t sreg = SREG; |
||
113 | uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * USART0_BAUD) - 1); |
||
114 | |||
115 | // disable all interrupts before configuration |
||
116 | cli(); |
||
117 | |||
118 | // disable RX-Interrupt |
||
119 | UCSR0B &= ~(1 << RXCIE0); |
||
120 | // disable TX-Interrupt |
||
121 | UCSR0B &= ~(1 << TXCIE0); |
||
122 | |||
123 | // set direction of RXD0 and TXD0 pins |
||
124 | // set RXD0 (PD0) as an input pin |
||
125 | PORTD |= (1 << PORTD0); |
||
126 | DDRD &= ~(1 << DDD0); |
||
127 | // set TXD0 (PD1) as an output pin |
||
128 | PORTD |= (1 << PORTD1); |
||
129 | DDRD |= (1 << DDD1); |
||
130 | |||
131 | // USART0 Baud Rate Register |
||
132 | // set clock divider |
||
133 | UBRR0H = (uint8_t)(ubrr >> 8); |
||
134 | UBRR0L = (uint8_t)ubrr; |
||
135 | |||
136 | // USART0 Control and Status Register A, B, C |
||
137 | |||
138 | // enable double speed operation in |
||
139 | UCSR0A |= (1 << U2X0); |
||
140 | // enable receiver and transmitter in |
||
141 | UCSR0B = (1 << TXEN0) | (1 << RXEN0); |
||
142 | // set asynchronous mode |
||
143 | UCSR0C &= ~(1 << UMSEL01); |
||
144 | UCSR0C &= ~(1 << UMSEL00); |
||
145 | // no parity |
||
146 | UCSR0C &= ~(1 << UPM01); |
||
147 | UCSR0C &= ~(1 << UPM00); |
||
148 | // 1 stop bit |
||
149 | UCSR0C &= ~(1 << USBS0); |
||
150 | // 8-bit |
||
151 | UCSR0B &= ~(1 << UCSZ02); |
||
152 | UCSR0C |= (1 << UCSZ01); |
||
153 | UCSR0C |= (1 << UCSZ00); |
||
154 | |||
155 | // flush receive buffer |
||
156 | while ( UCSR0A & (1<<RXC0) ) UDR0; |
||
157 | |||
158 | // enable interrupts at the end |
||
159 | // enable RX-Interrupt |
||
160 | UCSR0B |= (1 << RXCIE0); |
||
161 | // enable TX-Interrupt |
||
162 | UCSR0B |= (1 << TXCIE0); |
||
163 | |||
164 | // initialize the debug timer |
||
165 | DebugData_Timer = SetDelay(DebugData_Interval); |
||
166 | |||
167 | // unlock rxd_buffer |
||
168 | rxd_buffer_locked = FALSE; |
||
169 | pRxData = 0; |
||
170 | RxDataLen = 0; |
||
171 | |||
172 | // no bytes to send |
||
173 | txd_complete = TRUE; |
||
174 | |||
175 | UART_VersionInfo.SWMajor = VERSION_MAJOR; |
||
176 | UART_VersionInfo.SWMinor = VERSION_MINOR; |
||
177 | UART_VersionInfo.SWPatch = VERSION_PATCH; |
||
178 | UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
||
179 | UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
||
180 | |||
181 | // restore global interrupt flags |
||
182 | SREG = sreg; |
||
183 | sei(); |
||
184 | printf("\r\n UART0 init...ok"); |
||
185 | } |
||
186 | |||
187 | /****************************************************************/ |
||
188 | /* USART0 transmitter ISR */ |
||
189 | /****************************************************************/ |
||
190 | ISR(USART0_TX_vect) |
||
191 | { |
||
192 | static uint16_t ptr_txd_buffer = 0; |
||
193 | uint8_t tmp_tx; |
||
194 | if(!txd_complete) // transmission not completed |
||
195 | { |
||
196 | ptr_txd_buffer++; // die [0] wurde schon gesendet |
||
197 | tmp_tx = txd_buffer[ptr_txd_buffer]; |
||
198 | // if terminating character or end of txd buffer was reached |
||
199 | if((tmp_tx == '\r') || (ptr_txd_buffer == TXD_BUFFER_LEN)) |
||
200 | { |
||
201 | ptr_txd_buffer = 0; // reset txd pointer |
||
202 | txd_complete = 1; // stop transmission |
||
203 | } |
||
204 | UDR0 = tmp_tx; // send current byte will trigger this ISR again |
||
205 | } |
||
206 | // transmission completed |
||
207 | else ptr_txd_buffer = 0; |
||
208 | } |
||
209 | |||
210 | /****************************************************************/ |
||
211 | /* USART0 receiver ISR */ |
||
212 | /****************************************************************/ |
||
213 | ISR(USART0_RX_vect) |
||
214 | { |
||
215 | static uint16_t crc; |
||
216 | static uint8_t ptr_rxd_buffer = 0; |
||
217 | uint8_t crc1, crc2; |
||
218 | uint8_t c; |
||
219 | |||
220 | c = UDR0; // catch the received byte |
||
221 | |||
222 | if(rxd_buffer_locked) return; // if rxd buffer is locked immediately return |
||
223 | |||
224 | // the rxd buffer is unlocked |
||
225 | if((ptr_rxd_buffer == 0) && (c == '#')) // if rxd buffer is empty and syncronisation character is received |
||
226 | { |
||
227 | rxd_buffer[ptr_rxd_buffer++] = c; // copy 1st byte to buffer |
||
228 | crc = c; // init crc |
||
229 | } |
||
230 | #if 0 |
||
231 | else if (ptr_rxd_buffer == 1) // handle address |
||
232 | { |
||
233 | rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
||
234 | crc += c; // update crc |
||
235 | } |
||
236 | #endif |
||
237 | else if (ptr_rxd_buffer < RXD_BUFFER_LEN) // collect incomming bytes |
||
238 | { |
||
239 | if(c != '\r') // no termination character |
||
240 | { |
||
241 | rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
||
242 | crc += c; // update crc |
||
243 | } |
||
244 | else // termination character was received |
||
245 | { |
||
246 | // the last 2 bytes are no subject for checksum calculation |
||
247 | // they are the checksum itself |
||
248 | crc -= rxd_buffer[ptr_rxd_buffer-2]; |
||
249 | crc -= rxd_buffer[ptr_rxd_buffer-1]; |
||
250 | // calculate checksum from transmitted data |
||
251 | crc %= 4096; |
||
252 | crc1 = '=' + crc / 64; |
||
253 | crc2 = '=' + crc % 64; |
||
254 | // compare checksum to transmitted checksum bytes |
||
255 | if((crc1 == rxd_buffer[ptr_rxd_buffer-2]) && (crc2 == rxd_buffer[ptr_rxd_buffer-1])) |
||
256 | { // checksum valid |
||
257 | rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character |
||
258 | ReceivedBytes = ptr_rxd_buffer + 1;// store number of received bytes |
||
259 | rxd_buffer_locked = TRUE; // lock the rxd buffer |
||
260 | // if 2nd byte is an 'R' enable watchdog that will result in an reset |
||
261 | if(rxd_buffer[2] == 'R') {wdt_enable(WDTO_250MS);} // Reset-Commando |
||
262 | } |
||
263 | else |
||
264 | { // checksum invalid |
||
265 | rxd_buffer_locked = FALSE; // unlock rxd buffer |
||
266 | } |
||
267 | ptr_rxd_buffer = 0; // reset rxd buffer pointer |
||
268 | } |
||
269 | } |
||
270 | else // rxd buffer overrun |
||
271 | { |
||
272 | ptr_rxd_buffer = 0; // reset rxd buffer |
||
273 | rxd_buffer_locked = FALSE; // unlock rxd buffer |
||
274 | } |
||
275 | |||
276 | } |
||
277 | |||
278 | |||
279 | // -------------------------------------------------------------------------- |
||
280 | void AddCRC(uint16_t datalen) |
||
281 | { |
||
282 | uint16_t tmpCRC = 0, i; |
||
283 | for(i = 0; i < datalen; i++) |
||
284 | { |
||
285 | tmpCRC += txd_buffer[i]; |
||
286 | } |
||
287 | tmpCRC %= 4096; |
||
288 | txd_buffer[i++] = '=' + tmpCRC / 64; |
||
289 | txd_buffer[i++] = '=' + tmpCRC % 64; |
||
290 | txd_buffer[i++] = '\r'; |
||
291 | txd_complete = FALSE; |
||
292 | UDR0 = txd_buffer[0]; // initiates the transmittion (continued in the TXD ISR) |
||
293 | } |
||
294 | |||
295 | |||
296 | |||
297 | // -------------------------------------------------------------------------- |
||
298 | void SendOutData(uint8_t cmd, uint8_t addr, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
||
299 | { |
||
300 | va_list ap; |
||
301 | uint16_t pt = 0; |
||
302 | uint8_t a,b,c; |
||
303 | uint8_t ptr = 0; |
||
304 | |||
305 | uint8_t *pdata = 0; |
||
306 | int len = 0; |
||
307 | |||
308 | txd_buffer[pt++] = '#'; // Start character |
||
309 | txd_buffer[pt++] = 'a' + addr; // Address (a=0; b=1,...) |
||
310 | txd_buffer[pt++] = cmd; // Command |
||
311 | |||
312 | va_start(ap, numofbuffers); |
||
313 | if(numofbuffers) |
||
314 | { |
||
315 | pdata = va_arg(ap, uint8_t*); |
||
316 | len = va_arg(ap, int); |
||
317 | ptr = 0; |
||
318 | numofbuffers--; |
||
319 | } |
||
320 | |||
321 | while(len) |
||
322 | { |
||
323 | if(len) |
||
324 | { |
||
325 | a = pdata[ptr++]; |
||
326 | len--; |
||
327 | if((!len) && numofbuffers) |
||
328 | { |
||
329 | pdata = va_arg(ap, uint8_t*); |
||
330 | len = va_arg(ap, int); |
||
331 | ptr = 0; |
||
332 | numofbuffers--; |
||
333 | } |
||
334 | } |
||
335 | else a = 0; |
||
336 | if(len) |
||
337 | { |
||
338 | b = pdata[ptr++]; |
||
339 | len--; |
||
340 | if((!len) && numofbuffers) |
||
341 | { |
||
342 | pdata = va_arg(ap, uint8_t*); |
||
343 | len = va_arg(ap, int); |
||
344 | ptr = 0; |
||
345 | numofbuffers--; |
||
346 | } |
||
347 | } |
||
348 | else b = 0; |
||
349 | if(len) |
||
350 | { |
||
351 | c = pdata[ptr++]; |
||
352 | len--; |
||
353 | if((!len) && numofbuffers) |
||
354 | { |
||
355 | pdata = va_arg(ap, uint8_t*); |
||
356 | len = va_arg(ap, int); |
||
357 | ptr = 0; |
||
358 | numofbuffers--; |
||
359 | } |
||
360 | } |
||
361 | else c = 0; |
||
362 | txd_buffer[pt++] = '=' + (a >> 2); |
||
363 | txd_buffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
||
364 | txd_buffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
||
365 | txd_buffer[pt++] = '=' + ( c & 0x3f); |
||
366 | } |
||
367 | va_end(ap); |
||
368 | AddCRC(pt); // add checksum after data block and initates the transmission |
||
369 | } |
||
370 | |||
371 | |||
372 | // -------------------------------------------------------------------------- |
||
373 | void Decode64(void) |
||
374 | { |
||
375 | uint8_t a,b,c,d; |
||
376 | uint8_t x,y,z; |
||
377 | uint8_t ptrIn = 3; |
||
378 | uint8_t ptrOut = 3; |
||
379 | uint8_t len = ReceivedBytes - 6; |
||
380 | |||
381 | while(len) |
||
382 | { |
||
383 | a = rxd_buffer[ptrIn++] - '='; |
||
384 | b = rxd_buffer[ptrIn++] - '='; |
||
385 | c = rxd_buffer[ptrIn++] - '='; |
||
386 | d = rxd_buffer[ptrIn++] - '='; |
||
387 | //if(ptrIn > ReceivedBytes - 3) break; |
||
388 | |||
389 | x = (a << 2) | (b >> 4); |
||
390 | y = ((b & 0x0f) << 4) | (c >> 2); |
||
391 | z = ((c & 0x03) << 6) | d; |
||
392 | |||
393 | if(len--) rxd_buffer[ptrOut++] = x; else break; |
||
394 | if(len--) rxd_buffer[ptrOut++] = y; else break; |
||
395 | if(len--) rxd_buffer[ptrOut++] = z; else break; |
||
396 | } |
||
397 | pRxData = &rxd_buffer[3]; |
||
398 | RxDataLen = ptrOut - 3; |
||
399 | } |
||
400 | |||
401 | |||
402 | // -------------------------------------------------------------------------- |
||
403 | void USART0_ProcessRxData(void) |
||
404 | { |
||
405 | // if data in the rxd buffer are not locked immediately return |
||
406 | if(!rxd_buffer_locked) return; |
||
407 | |||
408 | Decode64(); // decode data block in rxd_buffer |
||
409 | |||
410 | |||
411 | switch(rxd_buffer[1] - 'a') |
||
412 | { |
||
413 | case FM_ADDRESS: |
||
414 | |||
415 | switch(rxd_buffer[2]) |
||
416 | { |
||
417 | default: |
||
418 | //unsupported command received |
||
419 | break; |
||
420 | } // case FC_ADDRESS: |
||
421 | |||
422 | default: // any Slave Address |
||
423 | |||
424 | switch(rxd_buffer[2]) |
||
425 | { |
||
426 | case 'a':// request for labels of the analog debug outputs |
||
427 | Request_DebugLabel = pRxData[0]; |
||
428 | if(Request_DebugLabel > 31) Request_DebugLabel = 31; |
||
429 | PcAccess = 255; |
||
430 | break; |
||
431 | |||
432 | case 'h':// request for display columns |
||
433 | PcAccess = 255; |
||
434 | if((pRxData[0] & 0x80) == 0x00) // old format |
||
435 | { |
||
436 | DisplayLine = 2; |
||
437 | Display_Interval = 0; |
||
438 | } |
||
439 | else // new format |
||
440 | { |
||
441 | DisplayKeys |= ~pRxData[0]; |
||
442 | Display_Interval = (uint16_t) pRxData[1] * 10; |
||
443 | DisplayLine = 4; |
||
444 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
||
445 | } |
||
446 | Request_Display = TRUE; |
||
447 | break; |
||
448 | |||
449 | case 'l':// request for display columns |
||
450 | PcAccess = 255; |
||
451 | MenuItem = pRxData[0]; |
||
452 | Request_Display1 = TRUE; |
||
453 | break; |
||
454 | |||
455 | case 'v': // request for version and board release |
||
456 | Request_VerInfo = TRUE; |
||
457 | break; |
||
458 | |||
459 | case 'd': // request for the debug data |
||
460 | DebugData_Interval = (uint16_t) pRxData[0] * 10; |
||
461 | if(DebugData_Interval > 0) Request_DebugData = TRUE; |
||
462 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
||
463 | break; |
||
464 | |||
465 | case 'g':// get external control data |
||
466 | Request_ExternalControl = TRUE; |
||
467 | break; |
||
468 | |||
469 | default: |
||
470 | //unsupported command received |
||
471 | break; |
||
472 | } |
||
473 | break; // default: |
||
474 | } |
||
475 | // unlock the rxd buffer after processing |
||
476 | pRxData = 0; |
||
477 | RxDataLen = 0; |
||
478 | rxd_buffer_locked = FALSE; |
||
479 | } |
||
480 | |||
481 | //############################################################################ |
||
482 | //Routine für die Serielle Ausgabe |
||
483 | int16_t uart_putchar (int8_t c) |
||
484 | //############################################################################ |
||
485 | { |
||
486 | if (c == '\n') |
||
487 | uart_putchar('\r'); |
||
488 | // wait until previous character was send |
||
489 | loop_until_bit_is_set(UCSR0A, UDRE0); |
||
490 | // send character |
||
491 | UDR0 = c; |
||
492 | return (0); |
||
493 | } |
||
494 | |||
495 | |||
496 | //--------------------------------------------------------------------------------------------- |
||
497 | void USART0_TransmitTxData(void) |
||
498 | { |
||
499 | if(!txd_complete) return; |
||
500 | |||
501 | if(CheckDelay(AboTimeOut)) |
||
502 | { |
||
503 | Display_Interval = 0; |
||
504 | DebugData_Interval = 0; |
||
505 | } |
||
506 | |||
507 | if(Request_VerInfo && txd_complete) |
||
508 | { |
||
509 | SendOutData('V', FM_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo)); |
||
510 | Request_VerInfo = FALSE; |
||
511 | } |
||
512 | else if( (((Display_Interval > 0) && CheckDelay(Display_Timer)) || Request_Display) && txd_complete) |
||
513 | { |
||
514 | if(DisplayLine > 3)// new format |
||
515 | { |
||
516 | Menu_Update(DisplayKeys); |
||
517 | DisplayKeys = 0; |
||
518 | SendOutData('H', FC_ADDRESS, 1, (uint8_t *)DisplayBuff, sizeof(DisplayBuff)); |
||
519 | } |
||
520 | else // old format |
||
521 | { |
||
522 | LCD_printfxy(0,0,"!!! INCOMPATIBLE !!!"); |
||
523 | SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), (uint8_t *)DisplayBuff, 20); |
||
524 | if(DisplayLine++ > 3) DisplayLine = 0; |
||
525 | } |
||
526 | Display_Timer = SetDelay(Display_Interval); |
||
527 | Request_Display = FALSE; |
||
528 | } |
||
529 | else if(Request_Display1 && txd_complete) |
||
530 | { |
||
531 | Menu_Update(0); |
||
532 | SendOutData('L', FC_ADDRESS, 3, &MenuItem, sizeof(MenuItem), &MaxMenuItem, sizeof(MaxMenuItem), DisplayBuff, sizeof(DisplayBuff)); |
||
533 | Request_Display1 = FALSE; |
||
534 | } |
||
535 | else if(Request_DebugLabel != 0xFF) // Texte für die Analogdaten |
||
536 | { |
||
537 | uint8_t label[16]; // local sram buffer |
||
538 | memcpy_P(label, ANALOG_LABEL[Request_DebugLabel], 16); // read lable from flash to sram buffer |
||
539 | SendOutData('A', FM_ADDRESS, 2, (uint8_t *) &Request_DebugLabel, sizeof(Request_DebugLabel), label, 16); |
||
540 | Request_DebugLabel = 0xFF; |
||
541 | } |
||
542 | else if(Request_ExternalControl && txd_complete) |
||
543 | { |
||
544 | SendOutData('G', FM_ADDRESS, 1,(uint8_t *) &ExternControl, sizeof(ExternControl)); |
||
545 | Request_ExternalControl = FALSE; |
||
546 | } |
||
547 | else if( (((DebugData_Interval > 0) && CheckDelay(DebugData_Timer)) || Request_DebugData) && txd_complete) |
||
548 | { |
||
549 | SendOutData('D', FM_ADDRESS, 1,(uint8_t *) &DebugOut, sizeof(DebugOut)); |
||
550 | DebugData_Timer = SetDelay(DebugData_Interval); |
||
551 | Request_DebugData = FALSE; |
||
552 | } |
||
553 | else if(Request_SendFollowMe && txd_complete) |
||
554 | { |
||
555 | SendOutData('s', NC_ADDRESS, 1, (uint8_t *)&FollowMe, sizeof(FollowMe)); //'s' = target Position 'w' = Waypoint |
||
556 | FollowMe.Position.Status = PROCESSED; |
||
557 | Request_SendFollowMe = FALSE; |
||
558 | } |
||
559 | } |
||
560 |