From 3f141eba703463e01e2b5d6489351d3cf50e1100 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期五, 24 九月 2021 10:26:42 +0800 Subject: [PATCH] 1 --- 源码/核心板/Src/application/dw_app.c | 19 +++++++++++++------ 1 files changed, 13 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 61f1291..8dd87c2 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" @@ -1,6 +1,7 @@ #include "dw_app.h" #include "ADC.h" #define TDFILTER +#define CONT_FRAME_PERIOD 124800 enum enumtagstate { DISCPOLL, @@ -8,7 +9,7 @@ NEARPOLL, }tag_state=NEARPOLL; static dwt_config_t config = { - 2, /* Channel number. */ + 5, /* Channel number. */ DWT_PRF_64M, /* Pulse repetition frequency. */ DWT_PLEN_128, /* Preamble length. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ @@ -122,7 +123,7 @@ * performance. */ Reset_DW1000();//重启DW1000 /* Target specific drive of RSTn line into DW1000 low for a period. */ dwt_initialise(DWT_LOADUCODE);//初始化DW1000 - Spi_ChangePrescaler(SPIx_PRESCALER_FAST); //设置为快速模式 + Spi_ChangePrescaler(SPIx_PRESCALER_SLOW); //设置为快速模式 /* Configure DW1000. See NOTE 6 below. */ dwt_configure(&config);//配置DW1000 @@ -345,12 +346,16 @@ { nearbase_distlist[i]=0x1ffff; } + dwt_configcontinuousframemode(CONT_FRAME_PERIOD); tx_nearpoll_msg[MESSAGE_TYPE_IDX] = NEAR_POLL; memcpy(&tx_nearpoll_msg[ANCHOR_ID_IDX],&mainbase_id,2); dwt_writetxdata(13+4*nearbase_num, tx_nearpoll_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去 dwt_writetxfctrl(13+4*nearbase_num, 0);//设置超宽带发送数据长度 - dwt_starttx(DWT_START_TX_IMMEDIATE | DWT_RESPONSE_EXPECTED);//开启发送,发送完成后等待一段时间开启接收,等待时间在dwt_setrxaftertxdelay中设置 - + dwt_starttx(DWT_START_TX_IMMEDIATE);//开启发送,发送完成后等待一段时间开启接收,等待时间在dwt_setrxaftertxdelay中设置 + while(1) + { + IdleTask(); + } flag_finalsend=0; flag_rxon=1; neartimout_timer=0; @@ -828,6 +833,7 @@ dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR); } } +extern u16 dist_threshold; u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,getrange_success=0; u8 Anchor_RecNearPoll(u8 ancrec_nearbasepos) //0 mainbase 1 first near_base { @@ -924,16 +930,17 @@ /*--------------------------以下为非测距逻辑------------------------*/ //dist_cm=33000; getrange_success = 1; - g_Resttimer=0; + LED0_BLINK; //每成功一次通讯则闪烁一次 dis_after_filter=dist_cm; hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10; g_flag_Taggetdist[taglist_pos]=0; if(hex_dist>-10000&&hex_dist<2000000) { - if(abs(hex_dist-his_dist[taglist_pos])<15000||misdist_num[taglist_pos]>3) + if(abs(hex_dist-his_dist[taglist_pos])<dist_threshold||misdist_num[taglist_pos]>3) { int32_t filter_dist; + g_Resttimer=0; #ifdef TDFILTER NewTrackingDiffUpdate(taglist_pos, (float)hex_dist); filter_dist=pos_predict[taglist_pos]/10; -- Gitblit v1.9.3