From 080ddf776d500bcd2c37df42cfc039ee79d8e972 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期四, 06 七月 2023 15:50:13 +0800 Subject: [PATCH] 1 --- Src/application/dw_app.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index 7f10309..226c813 100644 --- a/Src/application/dw_app.c +++ b/Src/application/dw_app.c @@ -118,7 +118,7 @@ LPFilter_Frac* p_Dis_Filter; //测距用的低通滤波器 - +void GetNearMsg(void); static uint64_t get_tx_timestamp_u64(void) { uint8_t ts_tab[5]; @@ -185,6 +185,7 @@ /* Apply default antenna delay value. See NOTE 1 below. */ dwt_setrxantennadelay(RX_ANT_DLY); //设置接收天线延迟 dwt_settxantennadelay(TX_ANT_DLY); //设置发射天线延迟 + /* Set expected response's delay and timeout. See NOTE 4 and 5 below. * As this example only handles one incoming frame with always the same delay and timeout, those values can be set here once for all. */ //设置接收超时时间 @@ -609,8 +610,9 @@ if(minddist!=0x1ffff&&minddist!=0) { trygetnearmsg_times = 0; - tag_state = GETNEARMSG; + tag_state = GETNEARMSG; mainbase_id = mindist_ancid; + GetNearMsg(); } if(getsync_flag==0) @@ -1054,7 +1056,7 @@ } nearbase_distlist[rec_nearbasepos+1]=temp_dist; // nearbase_distlist[1]对应 rec_nearbaseid[0]的距离 final_msg_set_ts(&tx_near_msg[FINAL_MSG_RESP_RX_NEARBASE_IDX+(rec_nearbasepos)*4], resp_rx_ts); - if(temp_dist<salvebase_mindist&&nearbase_switchdistlist[rec_nearbasepos]!=0&&(nearbase_switchdistlist[rec_nearbasepos]==1||temp_dist<nearbase_switchdistlist[rec_nearbasepos])) + if(temp_dist<salvebase_mindist&&nearbase_switchdistlist[rec_nearbasepos]!=0&&(nearbase_switchdistlist[rec_nearbasepos]==1||temp_dist<nearbase_switchdistlist[rec_nearbasepos])) { salvebase_mindist = temp_dist; mindist_slavebaseid = rec_nearbaseid; @@ -1095,10 +1097,11 @@ changemainbase_count++; if(changemainbase_count>2) { - changemainbase_count = 0; - mainbase_id = mindist_slavebaseid; - tag_state = GETNEARMSG; - trygetnearmsg_times = 0; + changemainbase_count = 0; + mainbase_id = mindist_slavebaseid; + tag_state = GETNEARMSG; + trygetnearmsg_times = 0; + GetNearMsg(); } }else{ changemainbase_count = 0; @@ -1108,6 +1111,7 @@ { mainbase_lost_count = 0; tag_state = DISCPOLL; + DiscPoll(); } if(mainbase_lost_count!=0) { @@ -1168,6 +1172,7 @@ if(nearbaseid_list[i]!=nearbaseid_list2[i]) { tag_state = GETNEARMSG; + GetNearMsg(); trygetnearmsg_times = 0; nearbaseid_list0[i]=1; } @@ -1264,7 +1269,6 @@ } } u32 id,error_times=0; - extern float Height; void Tag_App(void)//发送模式(TAG标签) { -- Gitblit v1.9.3