| | |
| | | float dis_after_filter; //å½åè·ç¦»å¼ |
| | | LPFilter_Frac* p_Dis_Filter; //æµè·ç¨çä½éæ»¤æ³¢å¨ |
| | | |
| | | uint16_t g_Tagdist[TAG_NUM_IN_SYS]; |
| | | int32_t g_Tagdist[TAG_NUM_IN_SYS]; |
| | | uint8_t g_flag_Taggetdist[256]; |
| | | /*------------------------------------ Functions ------------------------------------------*/ |
| | | |
| | |
| | | uint16_t g_Resttimer; |
| | | uint8_t result; |
| | | u8 tag_succ_times=0; |
| | | int32_t hex_dist; |
| | | int32_t hex_dist,hex_dist2; |
| | | u16 checksum; |
| | | int8_t tag_delaytime; |
| | | extern uint16_t sync_timer; |
| | |
| | | } |
| | | TIM3->CNT=tmp_time; |
| | | } |
| | | memcpy(&anchor_dist_last_frm[0], &rx_buffer[DIST_IDX], 4); |
| | | memcpy(&hex_dist2, &rx_buffer[DIST_IDX], 4); |
| | | memcpy(&tx_final_msg[ANCHOR_ID_IDX], &rx_buffer[ANCHOR_ID_IDX], 4); |
| | | /* Compute final message transmission time. See NOTE 9 below. */ |
| | | final_tx_time = (resp_rx_ts + (RESP_RX_TO_FINAL_TX_DLY_UUS * UUS_TO_DWT_TIME)) >> 8;//计ç®finalå
åéæ¶é´ï¼T5=T4+Treply2 |
| | |
| | | tag_succ_times++; |
| | | |
| | | LED0_BLINK; |
| | | hex_dist = anchor_dist_last_frm[0]; |
| | | |
| | | memcpy(&anc_id_recv,&rx_buffer[ANCHOR_ID_IDX],2); |
| | | // g_Tagdist[anc_id_recv]= hex_dist; |
| | | // g_flag_Taggetdist[anc_id_recv]=0; |
| | |
| | | memcpy(&usart_send[5],&dev_id,2); |
| | | memcpy(&usart_send[7],&rx_buffer[ANCHOR_ID_IDX],2); |
| | | |
| | | memcpy(&usart_send[9],&hex_dist,4); |
| | | memcpy(&usart_send[9],&hex_dist2,4); |
| | | usart_send[13] = battary; |
| | | usart_send[14] = button; |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | |
| | | g_UWB_com_interval = 0; |
| | | dis_after_filter=dist_cm; |
| | | hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; |
| | | if(hex_dist>1000) |
| | | {hex_dist=hex_dist;} |
| | | if(hex_dist<100000&&hex_dist>-1000) |
| | | { |
| | | if(tag_id_recv-TAG_ID_START<=TAG_NUM_IN_SYS) |
| | | { |
| | | if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000) |
| | | { |
| | | g_Tagdist[tag_id_recv-TAG_ID_START] = hex_dist; |
| | | anchor_dist_last_frm[tag_id_recv-TAG_ID_START] = hex_dist; |
| | | g_Tagdist[tag_id_recv]= hex_dist; |
| | | } |
| | | his_dist[tag_id_recv-TAG_ID_START]=hex_dist; |
| | | g_Tagdist[tag_id_recv]= hex_dist; |
| | | g_flag_Taggetdist[tag_id_recv]=0; |
| | | if(!g_com_map[MODBUS_MODE]) |
| | | { |
| | |
| | | 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); |
| | | |
| | | } |
| | | }else{ |
| | | LED0_BLINK; |
| | | } |
| | | } |
| | | }else{ |
| | | /* Clear RX error events in the DW1000 status register. */ |