![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: vz_protocol.cpp
- Revision:
- 135:2f4290590e51
- Parent:
- 132:05cd37f7e007
- Child:
- 136:2da626f30efa
--- a/vz_protocol.cpp Tue Sep 01 19:34:34 2015 +0000 +++ b/vz_protocol.cpp Thu Sep 10 20:11:35 2015 +0000 @@ -14,11 +14,9 @@ return ( 0 ); } -uint8_t * parse_vz_pkg ( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ) -{ - uint8_t e_lsb, e_msb; - uint8_t p_lsb, p_msb; - +uint8_t * +parse_vz_pkg ( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ) +{ if ( ( ext and port and type and cb_buffer ) == NULL ) return ( NULL ); //tratamento dos pacotes do tipo flood logo na chegada @@ -35,8 +33,8 @@ t.start(); } else { if (cb_buffer[0] == 0x00){ - if( debug_uart3 ) pc.printf("%d", t.read_us()); - if( tcp_session and !udp_query ){ + if( debug_uart3 and enable_flood ) pc.printf("%d", t.read_us()); + if( tcp_session and !udp_query and enable_flood ){ char tmp[ 16 ]; sprintf( tmp, "%d", t.read_us() ); tcp_client.send_all( tmp, strlen( tmp ) ); @@ -44,9 +42,9 @@ } flood_cnt++; while (flood_cnt != cb_buffer[0]) { - if( debug_uart3 ) pc.printf("0"); + if( debug_uart3 and enable_flood ) pc.printf("0"); flood_cnt++; - if( tcp_session and !udp_query ){ + if( tcp_session and !udp_query and enable_flood ){ tcp_client.send_all( "0", strlen( "0" ) ); } } @@ -59,22 +57,22 @@ } } if( ok ){ - if( debug_uart3 ) pc.printf("+"); - if( tcp_session and !udp_query ){ + if( debug_uart3 and enable_flood ) pc.printf("+"); + if( tcp_session and !udp_query and enable_flood ){ tcp_client.send_all( "+", strlen( "+" ) ); } }else{ - if( debug_uart3 ) pc.printf("%02x",cb_buffer[0] ); - if( debug_uart3 ) pc.printf("#"); - if( debug_uart3 ) pc.printf("\n\r"); - if( tcp_session and !udp_query ){ + if( debug_uart3 and enable_flood ) pc.printf("%02x",cb_buffer[0] ); + if( debug_uart3 and enable_flood ) pc.printf("#"); + if( debug_uart3 and enable_flood ) pc.printf("\n\r"); + if( tcp_session and !udp_query and enable_flood ){ char tmp[ 16 ]; sprintf( tmp, "%02x#\n\r", cb_buffer[ 0 ] ); tcp_client.send_all( tmp, strlen( tmp ) ); } for( int i = 0; i < 300 ; i++ ){ - if( debug_uart3 ) pc.printf("%x", cb_buffer[ i ]); - if( tcp_session and !udp_query ){ + if( debug_uart3 and enable_flood ) pc.printf("%x", cb_buffer[ i ]); + if( tcp_session and !udp_query and enable_flood ){ char tmp[ 16 ]; sprintf( tmp, "%x", cb_buffer[ i ] ); tcp_client.send_all( tmp, strlen( tmp ) ); @@ -103,6 +101,10 @@ } else { + + uint8_t e_lsb, e_msb; + uint8_t p_lsb, p_msb; + pkg_cksok ++; e_msb = cb_buffer [ 0 ]; e_lsb = cb_buffer [ 1 ];