From bb37bc0f05735470caaf3f7e4d7eec9551bf3d44 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期日, 15 十二月 2019 11:14:40 +0800 Subject: [PATCH] 1 --- 源码/核心板/Src/application/dw_app.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" index b0c3c46..151b817 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" @@ -238,7 +238,7 @@ for(i=0;i<255;i++) { g_flag_Taggetdist[i]++; - if(g_flag_Taggetdist[i]>=2) + if(g_flag_Taggetdist[i]>=20) { g_Tagdist[i]=0xffff; } @@ -474,12 +474,13 @@ } int8_t correction_time; extern uint8_t sync_seq; +#define TDFILTER void Anchor_App(void) { uint32_t frame_len; uint32_t resp_tx_time; - + static u8 misdist_num; /* Clear reception timeout to start next ranging process. */ dwt_setrxtimeout(0);//设定接收超时时间,0位没有超时时间 @@ -611,8 +612,9 @@ 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-anchor_dist_last_frm[tag_id_recv-TAG_ID_START]<1500||misdist_num>4) + { + misdist_num=0; if(hex_dist<100000&&hex_dist>-1000) { if(tag_id_recv-TAG_ID_START<=TAG_NUM_IN_SYS) @@ -622,6 +624,10 @@ 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; + #ifdef TDFILTER + TrackingDiffUpdate(pUWBDistanceTrackingDiff, (float)hex_dist); + hex_dist=pUWBDistanceTrackingDiff->pos_predict; + #endif } his_dist[tag_id_recv-TAG_ID_START]=hex_dist; g_flag_Taggetdist[tag_id_recv]=0; @@ -645,9 +651,12 @@ 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; - } + misdist_num++; + } + if(anchor_dist_last_frm[tag_id_recv-TAG_ID_START]>1000) + {anchor_dist_last_frm[tag_id_recv-TAG_ID_START]=anchor_dist_last_frm[tag_id_recv-TAG_ID_START];} } }else{ /* Clear RX error events in the DW1000 status register. */ -- Gitblit v1.9.3