From b930edd3675dbc937717ae680b2aee4593a3e414 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期二, 11 十月 2022 15:49:16 +0800 Subject: [PATCH] V2.52 改正dicpoll FINAL 标志位bug --- 源码/核心板/Src/application/dw_app.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 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 294cdb1..2df9cea 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" @@ -7,9 +7,9 @@ NEARPOLL, }tag_state=GETNEARMSG; static dwt_config_t config = { - 2, /* Channel number. */ + 3, /* Channel number. */ DWT_PRF_64M, /* Pulse repetition frequency. */ - DWT_PLEN_64, /* Preamble length. */ + DWT_PLEN_128, /* 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. */ @@ -23,7 +23,7 @@ static uint8_t tx_final_msg[60] = {0}; static uint8_t tx_resp_msg[22] = {0}; static uint8_t tx_nearpoll_msg[80] = {0}; -static uint8_t tx_nearresp_msg[80] = {0}; +static uint8_t tx_nearresp_msg[90] = {0}; static uint8_t tx_nearfinal_msg[80] = {0}; static uint8_t tx_near_msg[80] = {0}; @@ -398,7 +398,7 @@ dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXFCG | SYS_STATUS_TXFRS);//清楚标志位 frame_len = dwt_read32bitreg(RX_FINFO_ID) & RX_FINFO_RXFLEN_MASK;//数据长度 dwt_readrxdata(rx_buffer, frame_len, 0);//读取接收数据 - if (rx_buffer[MESSAGE_TYPE_IDX] == FINAL&&!memcmp(&rx_buffer[TAG_ID_IDX],&tag_id_recv,2)) //判断是否为Final包 + if (rx_buffer[MESSAGE_TYPE_IDX] == DISCOVERFINAL&&!memcmp(&rx_buffer[TAG_ID_IDX],&tag_id_recv,2)) //判断是否为Final包 { uint32_t poll_tx_ts, resp_rx_ts, final_tx_ts; uint32_t poll_rx_ts_32, resp_tx_ts_32, final_rx_ts_32; @@ -472,7 +472,7 @@ } uint32_t time_monitor[10]; extern uint16_t configremotetagID; -extern u8 remotetag_paralen; +extern u8 remotetag_paralen,userdatasend_flag[TAG_NUM_IN_SYS]; u8 finalsend=0; u16 signalpower_list[TAG_NUM_IN_SYS]; uint32_t poll_tx_ts, resp_rx_ts, final_tx_ts; @@ -497,7 +497,7 @@ 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);//接收超时时间 //dwt_readdiagnostics(&d1); - if(tagpos[taglist_pos].tagid==tag_id_recv) + if(tagpos[taglist_pos].tagid==tag_id_recv&&userdatasend_flag[taglist_pos] == 1) { memcpy(&tx_nearresp_msg[TAGPOS_INDEX],&tagpos[taglist_pos],tagpos[taglist_pos].datalen+3); tagpossend_flag = 1; @@ -611,7 +611,7 @@ LED0_BLINK; //每成功一次通讯则闪烁一次 dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; - + userdatasend_flag[taglist_pos] =0; if(hex_dist>-1000&&hex_dist<200000) { g_flag_Taggetdist[taglist_pos]=0; @@ -732,7 +732,7 @@ { uint16_t checksum; case DISCOVERPOLL: - if (anchor_type == rx_buffer[ANCHOR_ID_IDX]) + if (anchor_type == rx_buffer[ANCHOR_ID_IDX]&&g_com_map[NEARSWITCH_DISTANCE_INDEX] != 0) { taglist_pos=CmpTagInList(tag_id_recv); if(taglist_pos==taglist_num) -- Gitblit v1.9.3