| | |
| | | { if(time32_incr - start_poll>20) |
| | | NVIC_SystemReset(); |
| | | UART_CheckReceive(); |
| | | UART_CheckSend(); |
| | | }; |
| | | |
| | | /* Increment frame sequence number after transmission of the poll message (modulo 256). */ |
| | |
| | | /* Increment frame sequence number after transmission of the final message (modulo 256). */ |
| | | |
| | | random_delay_tim = 0; |
| | | #ifdef TAG_OUTPUT |
| | | #ifdef HEX_OUTPUT |
| | | usart_send[2] = frame_seq_nb++; |
| | | //usart_send[6] = tag_id_recv; |
| | | //usart_send[8] = g_com_map[DEV_ID]; |
| | | memcpy(&usart_send[3],&dev_id,4); |
| | | memcpy(&usart_send[7],&tx_final_msg[ANCHOR_ID_IDX],4); |
| | | hex_dist = rx_buffer[DIST_IDX]; |
| | | memcpy(&usart_send[11],&hex_dist,4); |
| | | usart_send[15] = battary; |
| | | usart_send[16] = button; |
| | | checksum = Checksum_u16(&usart_send[2],19); |
| | | memcpy(&usart_send[21],&checksum,2); |
| | | USART_puts(usart_send,23); |
| | | #else |
| | | printf("Anchor ID: %d, Tag ID: %d, Dist = %d cm\n", g_com_map[DEV_ID], tag_id_recv, (uint16_t)dis_after_filter); |
| | | #endif |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | // deca_sleep(10); |
| | | } |
| | | if(tag_succ_times!=REPOET_ANC_NUM) |
| | | dwt_entersleep(); |
| | | if(tag_succ_times<REPOET_ANC_NUM_MIN) |
| | | { |
| | | random_delay_tim =time32_incr&0x8f+7; |
| | | }else{ |
| | | random_delay_tim=0; |
| | | deca_sleep(random_delay_tim); |
| | | } |
| | | LED0_BLINK; |
| | | deca_sleep(random_delay_tim); |
| | | RTC_SET_ALARM(1); |
| | | /* Execute a delay between ranging exchanges. */ |
| | | dwt_entersleep(); |
| | | |
| | | } |
| | | |
| | | void Anchor_App(void) |