| | |
| | | #define FINAL_MSG_POLL_TX_TS_IDX 10 |
| | | #define FINAL_MSG_RESP_RX_TS_IDX 14 |
| | | #define FINAL_MSG_FINAL_TX_TS_IDX 18 |
| | | #define DELAY_DEFAULT 5000 |
| | | #define DELAY_DEFAULT 50000 |
| | | #define DELAY_BETWEEN_TWO_FRAME_UUS 400 |
| | | #define HALF_SECOND_TIME 62400000 |
| | | |
| | |
| | | temp_tag_num=0;//临时数量为0 |
| | | poll_tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(POLL_DELAY);//发送必须要延时发送才可以用于测距否则立即发送会获取时间戳不对,需要计算程序运行时间,避免设置过去时间 |
| | | tempflag=uwb_tx(uwb_sendbuffer,13+4*nearbase_num,1,poll_tx_en_start_u32);//立即发送 |
| | | |
| | | //gpio_pin_set(IO_PIN_5);//测试 |
| | | #ifdef BOXING |
| | | gpio_pin_set(IO_PIN_5);//测试 |
| | | #endif |
| | | //LOG_INFO(TRACE_MODULE_APP, "进入测距",poll_tx_num,resp_rx_num,distance); |
| | | poll_tx_ts_i64 = ranging_tx_time_correct(poll_tx_en_start_u32 + phy_shr_duration());//修正时间戳 |
| | | temp_count1=phy_timer_count_get(); |
| | |
| | | |
| | | } |
| | | tempflag=uwb_rx(0, 0, RESP_RX_TIMEOUT_US);//立即开启接受并设置0超时 |
| | | //gpio_pin_clr(IO_PIN_5);//测试 |
| | | |
| | | #ifdef BOXING |
| | | gpio_pin_clr(IO_PIN_5);//测试 |
| | | #endif |
| | | }else if(receive_flag==2){//接收出错 |
| | | receive_flag=0; |
| | | tempflag=uwb_rx(0, 0, RESP_RX_TIMEOUT_US);//立即开启接受并设置0超时 |
| | |
| | | // while(mac_is_busy()); |
| | | temp_count1=phy_timer_count_get(); |
| | | } |
| | | //gpio_pin_clr(IO_PIN_5);//测试 |
| | | #ifdef BOXING |
| | | gpio_pin_clr(IO_PIN_5);//测试 |
| | | #endif |
| | | } |
| | | // delay_us(1); |
| | | // uwb_rx_force_off(1); |
| | | //dwt_forecetrxoff(); |
| | | CalculateDists(poll_tx_ts_i64); //计算距离并更新距离表 |
| | | AnchorListUpdate();//更新存活基站列表 |
| | | Rank_ANchor_list_by_dis();//冒泡排序重新按距离重新排列基站列表最小距离存货基站放到最前面 |
| | | // Rank_ANchor_list_by_dis();//冒泡排序重新按距离重新排列基站列表最小距离存货基站放到最前面 |
| | | } |
| | | #endif |