Rev 1866 | Rev 2099 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1866 | Rev 2039 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /**************************************************************************** |
1 | /**************************************************************************** |
2 | * Copyright (C) 2009-2013 by Claas Anders "CaScAdE" Rathje * |
2 | * Copyright (C) 2009-2014 by Claas Anders "CaScAdE" Rathje * |
3 | * admiralcascade@gmail.com * |
3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
5 | * * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
7 | * it under the terms of the GNU General Public License as published by * |
Line 130... | Line 130... | ||
130 | #if FCONLY |
130 | #if FCONLY |
131 | (c == 'V' || c == 'D' || c == 'Q' || c == 'L')) { // version, debug, settings, LCD |
131 | (c == 'V' || c == 'D' || c == 'Q' || c == 'L')) { // version, debug, settings, LCD |
132 | #else |
132 | #else |
133 | (c == 'V' || c == 'O' || c == 'Q' || c == 'C')) { // version, OSD, settings, 3D-Data |
133 | (c == 'V' || c == 'O' || c == 'Q' || c == 'C')) { // version, OSD, settings, 3D-Data |
134 | #endif |
134 | #endif |
135 | usart_rx_ok = 1; |
135 | usart_rx_ok = 1; |
136 | rxd_buffer[ptr_rxd_buffer++] = c2; |
136 | rxd_buffer[ptr_rxd_buffer++] = c2; |
137 | crc = c2; |
137 | crc = c2; |
138 | rxd_buffer[ptr_rxd_buffer++] = c1; |
138 | rxd_buffer[ptr_rxd_buffer++] = c1; |
139 | crc += c1; |
139 | crc += c1; |
140 | rxd_buffer[ptr_rxd_buffer++] = c; |
140 | rxd_buffer[ptr_rxd_buffer++] = c; |
141 | crc += c; |
141 | crc += c; |
142 | c2 = 0; |
142 | c2 = 0; |
143 | c1 = 0; |
143 | c1 = 0; |
144 | LED1_ON |
144 | LED1_ON |
145 | LED2_OFF |
145 | LED2_OFF |
146 | } else { |
146 | } else { |
147 | c2 = c1; |
147 | c2 = c1; |
148 | c1 = c; |
148 | c1 = c; |
149 | } |
149 | } |
150 | } else if (ptr_rxd_buffer < RXD_BUFFER_LEN) { // collect incomming bytes |
150 | } else if (ptr_rxd_buffer < RXD_BUFFER_LEN) { // collect incomming bytes |
151 | if (c != '\r') { // no termination character |
151 | if (c != '\r') { // no termination character |
152 | rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
152 | rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
153 | crc += c; // update crc |
153 | crc += c; // update crc |
154 | } else { // termination character was received |
154 | } else { // termination character was received |
Line 223... | Line 223... | ||
223 | rxd_buffer_locked = 0; |
223 | rxd_buffer_locked = 0; |
224 | usart1_EnableTXD(); |
224 | usart1_EnableTXD(); |
225 | usart1_puts_pgm(message); |
225 | usart1_puts_pgm(message); |
226 | usart1_DisableTXD(); |
226 | usart1_DisableTXD(); |
227 | static uint8_t wait = 0; |
227 | static uint8_t wait = 0; |
228 | wait = 0; |
228 | wait = 0; |
- | 229 | ||
- | 230 | // wait for complete answer |
|
229 | while (rxd_buffer_locked == 0 && wait < 150) { |
231 | while (rxd_buffer_locked == 0 && wait < 200) { |
230 | wait++; |
232 | wait++; |
231 | _delay_ms(50); |
233 | _delay_ms(10); |
232 | } |
234 | } |
233 | _delay_ms(100); |
235 | _delay_ms(150); |
234 | } |
236 | } |
235 | Decode64(); |
237 | Decode64(); |
236 | } |
238 | } |
Line 237... | Line 239... | ||
237 | 239 |