![](/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: prompt.cpp
- Revision:
- 67:cdedc64d9921
- Parent:
- 66:3f1d22e69e7b
- Child:
- 72:895ca792c647
--- a/prompt.cpp Tue Oct 28 18:35:48 2014 +0000 +++ b/prompt.cpp Thu Oct 30 19:26:41 2014 +0000 @@ -23,6 +23,7 @@ uint8_t debug_eth_tx = 0; uint8_t debug_prompt_eth = 0; uint8_t debug_file = 0; +bool dbl = false; bool from_eth = false; bool udp_request = false; bool tcp_session = false; @@ -47,6 +48,7 @@ uint16_t cb_bye_counter = 0; uint16_t prompt_counter = 0; uint16_t flood_counter = 0; +uint16_t bootloader_cbx_counter = 0; uint8_t test_debug = 1; #define PVERSION 5 // Sempre atualizar a versao do prompt @@ -283,8 +285,10 @@ cat("/qspi/telemetry_port.txt"); strcpy( last_cmd, tmp_cmd ); - debug_buf[ 0 ] = 0; + //debug_buf[ 0 ] = 0; + //bufptr = 0; bufptr = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; if( tcp_session ) tcp_client.send_all( "\n\r> " , strlen( "\n\r> " ) ); else if( udp_request ){ @@ -383,8 +387,10 @@ debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; if( tcp_session ){ tcp_client.send_all( debug_buf, strlen( debug_buf ) ); - debug_buf[ 0 ] = 0; + //debug_buf[ 0 ] = 0; + //bufptr = 0; bufptr = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; } } } @@ -444,8 +450,10 @@ }else if( udp_request ){ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } - debug_buf[ 0 ] = 0; + //debug_buf[ 0 ] = 0; + //bufptr = 0; bufptr = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; } } @@ -493,8 +501,10 @@ }else if( udp_request ){ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } - debug_buf[ 0 ] = 0; + //debug_buf[ 0 ] = 0; + //bufptr = 0; bufptr = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; } } } @@ -853,7 +863,7 @@ pc.printf("\n\r MUUUUUUUuuuuUUUUUU - I'm not a dog!!!! \n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "MUUUUUUUuuuuUUUUUU - I'm not a dog!!!!\n\r"); - debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; + //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; } } @@ -1127,8 +1137,10 @@ } debug_buf = ref; + //bufptr = 0; + //debug_buf[ 0 ] = 0; bufptr = 0; - debug_buf[ 0 ] = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; } else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "_pcb",4 )) { @@ -1526,17 +1538,13 @@ miss_match = false; int ext,port; char cmd[ 16 ]; - strcpy( cmd, "call init " ); ext = atoi( debug_buf + 7 ); port = convert_ext_to_port( ext ); - if( ext % 2 ){ - ext--; - strcat( cmd, "B\r\r" ); - }else{ - strcat( cmd, "A\r\r" ); - } + strcpy( cmd, ( ext % 2 ) ? "call init B" : "call init A" ); + + if( ext % 2 ) ext--; promptcb_last_ext = ext; promptcb_last_port = port; @@ -1547,7 +1555,18 @@ strcpy( promptcb_last_cmd, cmd ); pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n", ext, port, cmd ); + + pc.printf("\n\r--------------------------------------------------------\n\r"); + for( uint16_t i = 0; i < strlen( cmd ) ; i++ ) pc.printf( "%02x ", cmd[ i ] ); + __send_to_cb__( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); + pc.printf("\n\r--------------------------------------------------------\n\r"); + for( uint16_t i = 0; i < 300 ; i++ ){ + pc.printf( "%02x ", write_buffer[ i ] ); + if( i != 0 && !( ( i + 1 ) % 30 ) ) pc.printf("\n\r"); + } + + pc.printf("\n\rComando enviado\n\r"); if( from_eth ){ @@ -1561,7 +1580,7 @@ } bufptr = 0; - debug_buf[ 0 ] = 0; + for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; } if( miss_match ){