| | |
| | | //static uint8_t rx_final_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'W', 'A', 'V', 'E', 0x23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| | | |
| | | /* Frame sequence number, incremented after each transmission. */ |
| | | static uint32_t frame_seq_nb = 0; |
| | | static uint32_t frame_seq_nb = 0,frame_seq_nb2=0; |
| | | |
| | | /* Hold copy of status register state here for reference, so reader can examine it at a breakpoint. */ |
| | | static uint32_t status_reg = 0; |
| | |
| | | |
| | | static double tof; |
| | | |
| | | uint32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS]; ; |
| | | int32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS]; ; |
| | | uint32_t tag_id = 0; |
| | | uint32_t tag_id_recv = 0; |
| | | uint8_t random_delay_tim = 0; |
| | |
| | | while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR)))//䏿æ¥è¯¢è¯çç¶æç´å°æåæ¥æ¶æè
åçé误 |
| | | { if(time32_incr - start_poll>20) |
| | | NVIC_SystemReset(); |
| | | UART_CheckReceive(); |
| | | IdleTask(); |
| | | |
| | | }; |
| | | |
| | |
| | | |
| | | battary = rx_buffer[BATTARY_IDX]; |
| | | button = rx_buffer[BUTTON_IDX]; |
| | | frame_seq_nb = rx_buffer[SEQUENCE_IDX]; |
| | | frame_seq_nb2 = rx_buffer[SEQUENCE_IDX]; |
| | | /* We assume that the transmission is achieved correctly, now poll for reception of expected "final" frame or error/timeout. |
| | | * See NOTE 7 below. */ |
| | | if(result==0) |
| | |
| | | LED0_BLINK; //æ¯æå䏿¬¡é讯åéªç䏿¬¡ |
| | | g_UWB_com_interval = 0; |
| | | dis_after_filter=dist_cm; |
| | | hex_dist = (int16_t)(dist_cm+g_com_map[DIST_OFFSET]); |
| | | hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; |
| | | if(tag_id_recv-TAG_ID_START<=TAG_NUM_IN_SYS) |
| | | if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000) |
| | | { |
| | |
| | | { |
| | | usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | | usart_send[4] = frame_seq_nb;//æ°æ®æ®µé¿åº¦ |
| | | usart_send[4] = frame_seq_nb2;//æ°æ®æ®µé¿åº¦ |
| | | memcpy(&usart_send[5],&tag_id_recv,2); |
| | | memcpy(&usart_send[7],&dev_id,2); |
| | | |
| | |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | UART_PushFrame(usart_send,21); |
| | | } |
| | | memcpy(&Modbus_HoldReg[tag_id_recv*2],&anchor_dist_last_frm[tag_id_recv-TAG_ID_START],4); |
| | | |
| | | |
| | | // memcpy(&Modbus_HoldReg[tag_id_recv*2],&anchor_dist_last_frm[tag_id_recv-TAG_ID_START],4); |
| | | Modbus_HoldReg[tag_id_recv*2]=anchor_dist_last_frm[tag_id_recv-TAG_ID_START]>>16; |
| | | Modbus_HoldReg[tag_id_recv*2+1]=anchor_dist_last_frm[tag_id_recv-TAG_ID_START]; |
| | | //dis_after_filter = LP_Frac_Update(p_Dis_Filter, dist_cm); |
| | | |
| | | } |