From 8c9897491bd9cbb2dcbbeff77287a9006d8a1ea1 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期四, 06 七月 2023 15:35:10 +0800 Subject: [PATCH] V2.4 进入切换基站状态,会立刻触发一包获取基站临近信息模式,加快切换的速度 --- Src/application/dw_app.c | 38 ++++++++++++++++++++++---------------- 1 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index c8aceda..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,18 +1056,18 @@ } 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]==1) + 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; } #ifdef SWITCHBASE_ZHUANDIAN - if(temp_dist<nearbase_switchdistlist[rec_nearbasepos]&&nearbase_switchdistlist[rec_nearbasepos]>1&&temp_dist>0) - { - mainbase_id = rec_nearbaseid; - tag_state = GETNEARMSG; - trygetnearmsg_times = 0; - } +// if(temp_dist<nearbase_switchdistlist[rec_nearbasepos]&&nearbase_switchdistlist[rec_nearbasepos]>1&&temp_dist>0) +// { +// mainbase_id = rec_nearbaseid; +// tag_state = GETNEARMSG; +// trygetnearmsg_times = 0; +// } #endif } @@ -1093,23 +1095,27 @@ if(salvebase_mindist<mainbase_dist- THRESHOLD_CHANGE_MAINBASE_DIST ) { changemainbase_count++; - if(changemainbase_count>tag_frequency*2) + if(changemainbase_count>2) { - 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; } #endif - }else if(mainbase_lost_count>5*tag_frequency) + }else if(mainbase_lost_count>10) { + mainbase_lost_count = 0; tag_state = DISCPOLL; + DiscPoll(); } if(mainbase_lost_count!=0) { - if(mainbase_lost_count<=tag_frequency*1) + if(mainbase_lost_count<=5) {NextSlotDelayMs(0); }else{ NextSlotDelayMs(0); @@ -1166,6 +1172,7 @@ if(nearbaseid_list[i]!=nearbaseid_list2[i]) { tag_state = GETNEARMSG; + GetNearMsg(); trygetnearmsg_times = 0; nearbaseid_list0[i]=1; } @@ -1262,7 +1269,6 @@ } } u32 id,error_times=0; - extern float Height; void Tag_App(void)//发送模式(TAG标签) { -- Gitblit v1.9.3