From b23727c7dab2b34ed778dc6d3918564651843213 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期二, 27 十月 2020 12:54:16 +0800 Subject: [PATCH] V2.4 飞机客户初步调通 --- 源码/核心板/Src/application/dw_app.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 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 32474ef..bed88eb 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" @@ -9,11 +9,11 @@ static dwt_config_t config = { 2, /* Channel number. */ DWT_PRF_64M, /* Pulse repetition frequency. */ - DWT_PLEN_128, /* Preamble length. */ + DWT_PLEN_64, /* Preamble length. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ 9, /* TX preamble code. Used in TX only. */ 9, /* RX preamble code. Used in RX only. */ - 0, /* Use non-standard SFD (Boolean) */ + 1, /* Use non-standard SFD (Boolean) */ DWT_BR_6M8, /* Data rate. */ DWT_PHRMODE_STD, /* PHY header mode. */ (129 + 8 - 8) /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */ @@ -38,7 +38,7 @@ static uint64_t resp_tx_ts; static uint64_t final_rx_ts; static double tof; -int32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS]; ; +int32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS]; uint32_t tag_id = 0; uint32_t tag_id_recv = 0; uint32_t anc_id_recv = 0; @@ -506,7 +506,7 @@ flag_rxon=1; neartimout_timer=0; get_newbase=0; - timeout=ceil((float)nearbase_num*SLOT_SCALE)+3; + timeout=ceil((float)nearbase_num*SLOT_SCALE)+2; //timeout=5; mainbase_dist=100000; mainbase_lost_count++; @@ -886,7 +886,7 @@ LED0_BLINK; //每成功一次通讯则闪烁一次 dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; - if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000) + if(abs(hex_dist-his_dist[taglist_pos])<1000) { tagdist_list[taglist_pos] = hex_dist; } @@ -909,7 +909,7 @@ memcpy(&tx_nearresp_msg[TAG_ID_IDX],&tag_id_recv,2); poll_rx_ts = get_rx_timestamp_u64();//获得Poll包接收时间T2 - resp_tx_time = (poll_rx_ts + ((POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。 + resp_tx_time = (poll_rx_ts + ((POLL_RX_TO_RESP_TX_DLY_UUS+(ancrec_nearbasepos)*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。 dwt_setdelayedtrxtime(resp_tx_time);//设置Response发送时间T3 dwt_setrxaftertxdelay(RESP_TX_TO_FINAL_RX_DLY_UUS+(rec_nearbase_num+1-ancrec_nearbasepos)*DELAY_BETWEEN_TWO_FRAME_UUS);//设置发送完成后开启接收延迟时间 dwt_setrxtimeout(FINAL_RX_TIMEOUT_UUS);//接收超时时间 @@ -1177,11 +1177,7 @@ tagpos_rec[(u8)temp_tagpos]=1; rec_nearbase_num=rx_buffer[NEARBASENUM_INDEX]; - if(rec_nearbase_num>ancidlist_num) - { - ancidlist_num=rec_nearbase_num; - memcpy(ancidlist_rec,&rx_buffer[NEARBASEID_INDEX],rec_nearbase_num*2); - } + if(anc_id_recv==dev_id) { Anchor_RecNearPoll(0); -- Gitblit v1.9.3