Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
main.cpp
00001 #include "main_app_functions.h" 00002 #include "main_app_var_configs.h" 00003 00004 int main() 00005 { 00006 debug_uart3 = true; 00007 00008 int header_app_init_ret = header_app_init (); 00009 00010 vz_printf ( "header_app_init %s" , ( header_app_init_ret == 0 ) ? "Ok" : "Failure" ); 00011 00012 if ( header_app_init_ret == 0 ) vz_printf ("Ready"); 00013 00014 debug_uart3 = false; 00015 00016 power_source_timer.start (); 00017 00018 bool init_test = true; 00019 bool end_test = false; 00020 00021 bool init_test_mean = true; 00022 bool end_test_mean = false; 00023 Timer timer; 00024 00025 /*------------------------------------------ main loop ---------------------------------------------------------------*/ 00026 00027 while( true ) 00028 { 00029 if ( main_test_mean ) 00030 { 00031 const uint16_t u16_COUNT_TIMES = 60000; 00032 00033 static uint16_t count = u16_COUNT_TIMES; 00034 00035 static uint64_t u_sum = 0; 00036 00037 if ( init_test_mean ) 00038 { 00039 u_sum = 0; 00040 count = u16_COUNT_TIMES; 00041 00042 init_test_mean = false; 00043 00044 timer.start (); 00045 timer.reset (); 00046 } 00047 else if ( count ) 00048 { 00049 count--; 00050 00051 timer.stop (); 00052 00053 u_sum += timer.read_us (); 00054 00055 timer.start (); 00056 timer.reset (); 00057 00058 if ( count == 0 ) end_test_mean = true; 00059 } 00060 else if ( end_test_mean ) 00061 { 00062 vz_printf ( "Elapsed_time_mean : [ %.2lfu ]", double ( u_sum / u16_COUNT_TIMES ) ); 00063 00064 end_test_mean = false; 00065 init_test_mean = true; 00066 main_test_mean = false; 00067 00068 timer.stop (); 00069 } 00070 } 00071 00072 if ( main_test ) 00073 { 00074 if ( init_test ) 00075 { 00076 init_test = false; 00077 end_test = true; 00078 timer.start (); 00079 timer.reset (); 00080 } else if ( end_test ) 00081 { 00082 timer.stop (); 00083 int u_elapsed_time = timer.read_us (); 00084 int m_elapsed_time = timer.read_ms (); 00085 int s_elapsed_time = timer.read (); 00086 00087 vz_printf ( "Elapsed_time : [ %du, %dm, %ds ]", u_elapsed_time, m_elapsed_time, s_elapsed_time ); 00088 00089 end_test = false; 00090 init_test = true; 00091 main_test = false; 00092 } 00093 } 00094 00095 prompt_process ( NULL, 0 ); 00096 00097 if ( cm -> was_modified () ) 00098 { 00099 update_config_values (); 00100 cm -> set_modified_false (); 00101 } 00102 00103 if ( show_last_rx ) 00104 { 00105 if ( v_call -> size () == 0 ) show_last_rx_pkg_from_cbx (); 00106 show_last_rx = false; 00107 } 00108 00109 if ( show_last_tx ) 00110 { 00111 if ( v_call -> size () == 0 ) show_last_tx_pkg_from_cbx (); 00112 show_last_tx = false; 00113 } 00114 00115 if ( show_hello_status ) 00116 { 00117 show_hello_status_function (); 00118 show_hello_status = false; 00119 } 00120 00121 if( v_cb->size() > max_registered_cbx ) max_registered_cbx = v_cb->size(); 00122 00123 if ( sync_timer.read() > 5 ) 00124 { 00125 sync_timer.reset(); 00126 00127 if( debug_cks == true ) { pcks_s = true; } 00128 00129 if( debug_alive == true ) { pshowcb = true; } 00130 00131 if( !( ++count % 15 ) ) { 00132 if( eth_status ) { 00133 try_reconnect_with_eth (); 00134 } 00135 } 00136 00137 //35 sec. 00138 if( ( count > 7 ) and ( wake_all == false ) and ( not wake_all_disable ) and ( cm -> get_cbx_wake_mode () ) ) { 00139 wake_all = true; 00140 if( debug_wake == true ) vz_printf ( "Time to wake" ); 00141 } 00142 00143 // enable na variavel que exibe lista com estatisticas de pacotes que falharam ao serem enviados via interface eth 00144 if ( debug_missed ) { missed_send_udp_pkg = true; } 00145 00146 } 00147 00148 if ( show_wake_all_up_status ) 00149 { 00150 vz_printf ( "wake_all_up status :: %s", ( wake_all ) ? "Enable" : "Disable" ); 00151 show_wake_all_up_status = false; 00152 } 00153 00154 check_clock (); 00155 00156 if ( r_stats ) 00157 { 00158 reset_stats (); 00159 stats = true; 00160 r_stats = false; 00161 } 00162 00163 if ( stats ) 00164 { 00165 show_stats (); 00166 stats =false; 00167 } 00168 00169 if ( list ) 00170 { 00171 show_cb_list ( v_cb ); 00172 list = false; 00173 } 00174 00175 if ( long_list ) 00176 { 00177 show_cb_long_list ( v_cb, show_time, show_invites ); 00178 long_list = false; 00179 show_time = false; 00180 show_invites = false; 00181 } 00182 00183 if ( pshowcb ) 00184 { 00185 show_cb ( v_cb ); 00186 pshowcb = false; 00187 } 00188 00189 if ( request_clock_now ) 00190 { 00191 request_clock_to_server (); 00192 show_current_time = true; 00193 request_clock_now = false; 00194 } 00195 00196 if ( show_current_time ) 00197 { 00198 show_clock (); 00199 show_current_time = false;; 00200 } 00201 00202 if( show_sip ){ 00203 show_cb_sip ( v_cb ); 00204 show_sip = false; 00205 } 00206 00207 if( pflood == true ) flood(); 00208 00209 if( debug_eth ) { 00210 vz_printf ("Eth status %s", ( eth_status == 0 ) ? "Connected" : "Disconnected" ); 00211 debug_eth = false; 00212 } 00213 00214 00215 // chechando se existe um pacote vindo do cbx pendente 00216 if( status != WAITING ) 00217 { 00218 process_received_pkg_from_cbx (); 00219 } 00220 else if ( test_ts and test_ts_timer.read_ms () > 10 ) 00221 { 00222 if ( v_cb -> size () not_eq 0 ) 00223 { 00224 Call_Box * cb = ( Call_Box * ) v_cb -> get_element ( 0 ); 00225 if ( cb not_eq NULL ) 00226 { 00227 ext = cb -> get_ext (); 00228 port = cb -> get_port (); 00229 } 00230 } 00231 else 00232 { 00233 ext = 5000; 00234 port = 5000; 00235 } 00236 00237 type = INVITE; 00238 data = buffer; 00239 00240 test_ts_timer.reset (); 00241 } 00242 else if ( simulate ) 00243 { 00244 simulate = false; 00245 00246 data = buffer; 00247 00248 data [ SEQ_NUM_PLACE ] = seq_num_to_simulate; 00249 00250 ext = ext_to_simulate; 00251 00252 port = port_to_simulate; 00253 00254 type = num_type_to_simulate; 00255 } 00256 00257 if( sizes == true ) 00258 { 00259 show_sizes (); 00260 sizes = false; 00261 } 00262 00263 // usado pra testes 00264 { 00265 if ( registra ) 00266 { 00267 int internal_ext = 8000; 00268 registra = false; 00269 for( register uint8_t i = 0; i < u8_MAX_CB_IN_A_BRANCH - 2; i++ ) { 00270 v_cb -> add ( new Call_Box ( internal_ext, internal_ext++ ) ); 00271 } 00272 } 00273 00274 if ( registra4 ) 00275 { 00276 int internal_ext = 8000; 00277 registra4 = false; 00278 for( register uint8_t i = 0; i < 4; i++ ) 00279 { 00280 v_cb -> add ( new Call_Box ( internal_ext, internal_ext++ ) ); 00281 } 00282 } 00283 00284 if ( need_registry_someone ) 00285 { 00286 need_registry_someone = false; 00287 00288 v_cb -> add ( new Call_Box ( ext_to_be_registered, ext_to_be_registered ) ); 00289 00290 ext_to_be_registered = 0; 00291 } 00292 } 00293 00294 check_udp_packages_pending ( v_cb ); 00295 00296 if( dshow_rtp == true ) 00297 { 00298 show_rtp (); 00299 dshow_rtp = false; 00300 } 00301 00302 // usado pra test 00303 if ( frtp ) 00304 { 00305 fuck_rtp ( v_cb ); 00306 frtp = false; 00307 } 00308 00309 // usado pra test 00310 if ( rescue_rtp ) 00311 { 00312 rescue_rtp = false; 00313 Call_Box * cb = find_CB( v_cb, rescue_rtp_target ); 00314 if ( cb != NULL ) 00315 { 00316 cb -> set_rtp_port ( rescue_rtp_value ); 00317 } 00318 else 00319 { 00320 vz_debug ("rescue rtp fail"); 00321 } 00322 } 00323 00324 if ( print_v_cb ) 00325 { 00326 v_cb->print_yourself (); 00327 print_v_cb = false; 00328 } 00329 00330 if ( print_v_call ) 00331 { 00332 v_call->print_yourself (); 00333 print_v_call = false; 00334 } 00335 00336 if ( print_cb_var ) 00337 { 00338 show_cb_content (); 00339 print_cb_var = false; 00340 } 00341 00342 if ( print_cb_all ) 00343 { 00344 show_cb_content_all (); 00345 print_cb_all = false; 00346 } 00347 00348 if ( print_hex_cb_var ) 00349 { 00350 show_hex_cb_content (); 00351 print_hex_cb_var = false; 00352 } 00353 00354 if ( print_hex_cb_all ) 00355 { 00356 show_hex_cb_content_all (); 00357 print_hex_cb_all = false; 00358 } 00359 00360 if ( print_sip_var ) 00361 { 00362 show_cb_sip (); 00363 print_sip_var = false; 00364 } 00365 00366 if ( print_sip_all ) 00367 { 00368 show_cb_sip_all (); 00369 print_sip_all = false; 00370 } 00371 00372 if ( print_hex_sip_var ) 00373 { 00374 show_cb_hex_sip (); 00375 print_hex_sip_var = false; 00376 } 00377 00378 if( dcallshow_rtp == true ){ 00379 show_rtp_on_call (); 00380 dcallshow_rtp = false; 00381 } 00382 00383 if ( print_call_var ) 00384 { 00385 show_call (); 00386 print_call_var = false; 00387 00388 } 00389 00390 if ( print_hex_call_var ) 00391 { 00392 show_hex_call (); 00393 print_hex_call_var = false; 00394 } 00395 00396 00397 if ( print_hex_rtp_var ) 00398 { 00399 show_cb_rtp (); 00400 print_hex_rtp_var = false; 00401 } 00402 00403 if ( print_rtp_var ) 00404 { 00405 show_cb_hex_rtp (); 00406 print_rtp_var = false; 00407 } 00408 00409 if( reset_cks == true ) 00410 { 00411 reset_stats_cks (); 00412 pcks_s = true; 00413 reset_cks = false; 00414 } 00415 00416 if( pcks_s == true ) { 00417 show_cb_stats (); 00418 pcks_s = false; 00419 } 00420 00421 if ( show_wdt_string ) 00422 { 00423 char wdt_msg [ 1024 ]; 00424 build_wdt_string ( wdt_msg, sizeof ( wdt_msg ) - 1 ); 00425 00426 int siRet = strlen ( wdt_msg ); 00427 00428 vz_printf ( "wdt_msg.length::%d\r\n%s", siRet, wdt_msg ); 00429 00430 show_wdt_string = false; 00431 } 00432 00433 if( reset_missed_send_udp_pkg ) 00434 { 00435 reset_missed_send_udp (); 00436 missed_send_udp_pkg = true; 00437 reset_missed_send_udp_pkg = false; 00438 } 00439 00440 if ( missed_send_udp_pkg ) 00441 { 00442 show_missed_send_udp_pkg (); 00443 missed_send_udp_pkg = false; 00444 } 00445 00446 // usado pra test 00447 if ( flood_bug_pkg ){ 00448 static int id = 0x10; 00449 if( id < 10 ) id = 0x0b; 00450 send2callboxes( build_cb_package( 5828, 5123, REGISTRY, 00451 ( char * )buffer, id++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); 00452 } 00453 00454 if ( led_sync_timer.read() > 1 ) { 00455 led_sync_timer.reset(); 00456 led3 = !led3; 00457 CAB_LED = !CAB_LED; 00458 } 00459 00460 if ( boolWho_is_your_pair ) 00461 { 00462 boolWho_is_your_pair = false; 00463 00464 Call_Box * cb = find_CB ( v_cb, u16Who_is_your_pair ); 00465 00466 if ( cb not_eq NULL ) 00467 { 00468 cb = cb -> get_pair_cbx (); 00469 00470 if ( cb not_eq NULL ) vz_printf ( "[%d] pair [%d]", u16Who_is_your_pair, cb -> get_ext () ); 00471 00472 else vz_printf ( "[%d] pair nao encontrado", u16Who_is_your_pair ); 00473 00474 } else vz_printf ( "[%d] nao encontrado", u16Who_is_your_pair ); 00475 00476 u16Who_is_your_pair = 0; 00477 } 00478 00479 switch ( type ) 00480 { 00481 case DO_NOTHING :{} 00482 break; 00483 00484 case CB_BYE : 00485 { 00486 cb_bye_counter ++; 00487 Call_Box * cb = find_CB ( v_cb, ext ); 00488 if ( cb != NULL ) 00489 { 00490 if ( debug_invite or debug_main ) vz_debug ("[%d] Bye pkg - msg_id %d e pkg_id %d", ext, cb -> get_msg_id (), data [ 0 ] ); 00491 00492 bool already_removed = true; 00493 00494 if ( cb -> get_status () != cb_idle ) 00495 { 00496 already_removed = false; 00497 00498 data [ TIMESLICE_PLACE ] = 0; 00499 00500 send2callboxes ( build_cb_package ( ext, port, CB_BYE, 00501 ( char * )data, data [ 0 ] or_eq BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); 00502 00503 ts -> return_timeslice ( cb -> call_end () ); 00504 } 00505 00506 if ( already_removed ) if ( debug_main or debug_invite ) vz_debug ( "[%d] Already removed from inviting queue", ext ); 00507 00508 already_removed = true; 00509 00510 for ( register uint8_t i = 0; i < v_call->size(); i++ ) 00511 { 00512 VZ_call * call = (VZ_call *)v_call->get_element( i ); 00513 if( call->get_cb_ext() == ext ) 00514 { 00515 already_removed = false; 00516 00517 data[ TIMESLICE_PLACE ] = 0; 00518 00519 v_call->remove_element( i ); 00520 00521 send2callboxes( build_cb_package( ext, port, CB_BYE, 00522 ( char * )data, data[ 0 ] or_eq BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); 00523 00524 delete( call ); 00525 00526 ts -> return_timeslice ( cb -> call_end () ); 00527 } 00528 } 00529 00530 if( already_removed ) if( debug_main or debug_invite ) vz_debug ( "[%d] Already removed from vector call", ext ); 00531 00532 cb -> registry (); 00533 00534 } else if ( debug_invite or debug_main ) vz_debug ("[%d] Bye from who ?", ext ); 00535 } 00536 break; 00537 00538 case INVITE : 00539 { 00540 if ( drop_invite_pkg ) 00541 { 00542 vz_debug ("[%d] Dropando invite pck - msg id :: %d", ext, data[ 0 ] ); 00543 break; 00544 } 00545 00546 invite_counter ++; 00547 00548 if ( debug_invite ) vz_debug ("[%d] Invite request", ext ); 00549 00550 Call_Box * cb = find_CB ( v_cb, ext ); 00551 00552 if ( cb == NULL ) cb = try_add_new_cbx ( v_cb, ext ); 00553 00554 if ( cb == NULL ) { 00555 if ( debug_memory or debug_invite ) vz_debug ("[%d] Invite allocation cb fail", ext ); 00556 } else { 00557 cb -> update_invite_counter (); 00558 00559 cb -> invite_retry_count_reset (); 00560 00561 cb -> set_msg_id ( data [ 0 ] ); 00562 00563 if ( cb -> get_status () == cb_idle ) { 00564 cb -> call_config (); 00565 if ( test_ts ) vz_debug ("TST::IDLE"); 00566 } else { 00567 data [ TIMESLICE_PLACE ] = cb -> get_timeslice (); 00568 00569 cb -> set_invite_response_pending (); 00570 00571 if ( test_ts ) vz_debug ("TST::%u ", data [ TIMESLICE_PLACE ]); 00572 00573 send2callboxes ( build_cb_package ( ext, port, INVITE, 00574 ( char * )data, cb->msg_id_update (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); 00575 } 00576 00577 invite_handler ( v_call, v_cb, ts, cb ); 00578 } 00579 } 00580 00581 break; 00582 00583 case REGISTRY : { 00584 /* 00585 Colocar um if, de que se o cbx já existia, e tinha dado timeout 00586 ou por slave ou por mestre, resetar o timer dos 2 00587 */ 00588 registry_counter ++; 00589 Call_Box * cb = find_CB ( v_cb, ext ); 00590 00591 if ( cb == NULL ) cb = try_add_new_cbx ( v_cb, ext ); 00592 00593 if ( cb == NULL and debug_memory ) vz_debug ( "[%d] Registry cb allocation fail", ext ); 00594 00595 int registry_ret = -1; 00596 00597 if ( cb not_eq NULL ) registry_ret = cb -> registry (); 00598 00599 if ( ( registry_ret > 0 ) and eth_status ) try_reconnect_with_eth (); 00600 00601 if ( debug_main and registry_ret ) vz_debug ( "[%d %d] Registered", ext, port ); 00602 00603 pkg_wdt = RX_CB_IDLE; 00604 } 00605 break; 00606 00607 case BOOT : { 00608 boot_counter++; 00609 if( debug_boot == true ){ 00610 vz_printf ("[%d %d] Boot pkg -- pkg-id %d", ext, port, data[ 0 ] ); 00611 } 00612 send2callboxes( build_cb_package( ext, port, REGISTRY, 00613 ( char * )data, data[ 0 ] bitor BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); 00614 } 00615 break; 00616 00617 case FW : { 00618 if ( debug_fw_print ) vz_printf ("[%d %d]::FW pkg::", ext, port ); 00619 fw_cbx_pkg ( ext, ( char *) buffer ); 00620 } 00621 break; 00622 00623 case BOOTLOADER_CBX : { 00624 uint16_t bl_cnt2 = 0; 00625 if (debug_bootloader) { 00626 pc.printf("\r\npacote CBX->HDR {"); 00627 for (bl_cnt2 = 0;bl_cnt2 < BL_SIZE + 1;bl_cnt2++) { 00628 if ((bl_cnt2 % 30) == 0) { 00629 pc.printf("\r\n "); 00630 pc.printf(hex16(bl_cnt2)); 00631 pc.printf(" : "); 00632 } 00633 pc.printf(hex8(data[bl_cnt2])); 00634 pc.printf(", "); 00635 } 00636 pc.printf("\r\n}"); 00637 } 00638 bootloader_cbx_counter++; 00639 bl_send_buffer[0] = (char)(ext >> 8); 00640 bl_send_buffer[1] = (char)(ext & 0xff); 00641 for (bl_cnt2 = 0; bl_cnt2 < BL_SIZE; bl_cnt2++) { 00642 bl_send_buffer[bl_cnt2 + 2] = data[bl_cnt2 + 1]; 00643 } 00644 if (debug_bootloader) { 00645 pc.printf("\r\npacote HDR->SRV {"); 00646 for (bl_cnt2 = 0;bl_cnt2 < UDP_BL_SIZE;bl_cnt2++) { 00647 if ((bl_cnt2 % 30) == 0) { 00648 pc.printf("\r\n "); 00649 pc.printf(hex16(bl_cnt2)); 00650 pc.printf(" : "); 00651 } 00652 pc.printf(hex8(bl_send_buffer[bl_cnt2])); 00653 pc.printf(", "); 00654 } 00655 pc.printf("\r\n}"); 00656 } 00657 int udp_bl_client_ret = udp_bl_client.sendTo ( udp_bl_server, bl_send_buffer, UDP_BL_SIZE ); 00658 if ( udp_bl_client_ret not_eq UDP_BL_SIZE ) 00659 { 00660 reconnect_bl (); 00661 miss_bl_udp_send_pkg ++; 00662 if ( debug_reconnect ) vz_printf ( "[%d] Reconnect BL - %d", ext, udp_bl_client_ret ); 00663 } 00664 } 00665 break; 00666 00667 case PROMPT : { 00668 Call_Box * cb = find_CB ( v_cb, ext ); 00669 00670 if ( cb == NULL ) cb = try_add_new_cbx ( v_cb, ext ); 00671 00672 if( cb != NULL ) cb -> registry (); 00673 00674 if ( ( strncasecmp ( ( const char * )data, "ping", 4 ) == 0 ) or ( strncasecmp ( ( const char * )data, "pong", 4 ) == 0 ) ) 00675 { 00676 if( debug_ping ) vz_printf ( "[%d %d] Prompt pkg :: Ping", ext, port ); 00677 } 00678 else 00679 { 00680 prompt_counter++; 00681 00682 vz_printf ( "[%i, %i] Prompt pkg::", ext, port ); 00683 00684 for( register uint8_t i = 0; i < 32; i++ ) { 00685 if( debug_uart3 ) pc.printf("%c", data[ i ] ); 00686 if( i == 15 ) if( debug_uart3 ) pc.printf( "\r\n" ); 00687 } 00688 if( debug_uart3 ) pc.printf("\n\r> "); 00689 00690 if( tcp_session ) { 00691 char aux[ CB_BUFFER_SIZE + 3 ]; 00692 strncpy( aux, (char * )data, CB_BUFFER_SIZE ); 00693 strcat( aux, "\n\r\0" ); 00694 tcp_client.send_all( ( char *)data, strlen( (char * )data ) ); 00695 tcp_client.send_all( "\r\n> ", strlen( "\r\n> " ) ); 00696 } 00697 } 00698 } 00699 break; 00700 00701 case AUDIO : { 00702 audio_counter++; 00703 if ( received_audio_from_cb ) { 00704 vz_debug ("[%d] audio pkg", ext ); 00705 } 00706 00707 VZ_call * call = find_Call ( v_call, ext ); 00708 if ( call != NULL ) 00709 { 00710 if ( drop_rtp_from_cbx_pkg ) 00711 { 00712 led2 = !led2; 00713 break; 00714 } else { 00715 char * pkg = call -> build_eth_package ( data + 2 ); 00716 call -> send_message ( pkg ); 00717 call -> cbx_pkg_idle_timer_reset (); 00718 } 00719 } 00720 00721 Call_Box * cb = find_CB ( v_cb, ext ); 00722 if ( cb != NULL ) 00723 { 00724 if ( cb -> get_invite_response () == false ) 00725 { 00726 cb -> set_invite_response_ok (); 00727 cb -> invite_retry_count_reset (); 00728 } 00729 } else { 00730 if ( debug_main ) vz_debug ("[%d] received missed package", ext ); 00731 } 00732 } 00733 break; 00734 }// fim switch 00735 00736 // rajada 00737 if( invite_retry_timer.read_ms() >= 20 ) 00738 { 00739 invite_ack_to_cb_handler ( v_cb, v_call ); 00740 00741 invite_retry_timer.reset(); 00742 } 00743 00744 check_audio_from_ast ( v_cb, v_call ); 00745 00746 wake_up_or_refresh_handler ( v_cb ); 00747 00748 check_sip_messages_from_ast ( v_cb, v_call ); 00749 00750 /* Verifica andamento de ligações para eventualmente encerra-las por timeout */ 00751 call_manager( v_call, v_cb, ts ); 00752 00753 invite_handler( v_call, v_cb, ts, NULL ); 00754 00755 check_for_runaways_ts ( v_cb, ts ); 00756 00757 check_for_unwanted_rtp_ports ( v_cb ); 00758 00759 tx_buffer_ring_buffer_handler(); 00760 00761 type = DO_NOTHING; 00762 00763 if( eth_status == 0 ) eth_wdt = ETH_CONNECT_TIMEOUT; 00764 00765 if( wdt_timer.read() >= 1 ) { 00766 if ( -1 == wdt_update () ) vz_debug ("Erro!!!!!"); 00767 wdt_timer.reset(); 00768 } 00769 00770 if( debug_wdt ) 00771 { 00772 show_wdt_status (); 00773 debug_wdt = false; 00774 } 00775 00776 update_all_cb_timer ( v_cb ); 00777 00778 if ( !dont_say_hello_again ) send_hello_to_cbx (); 00779 00780 /* Verificacao da fonte de alimentacao */ 00781 if ( power_source_timer.read () > 1 ) 00782 { 00783 check_power_source (); 00784 } 00785 00786 %: ifdef MODE_TEST 00787 wdt.kick(); 00788 %: endif 00789 }// fim while 00790 }// fim main \o/
Generated on Tue Jul 12 2022 16:25:05 by
