From 4b19ce29c8c25010cdba0bf4e0835b4e97c971e9 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期三, 25 九月 2024 11:18:46 +0800 Subject: [PATCH] 解决测距失败计数会影响基站和车载测距9位数问题,基站帧间隔单独改为1000 --- keil/uwb_app.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/keil/uwb_app.c b/keil/uwb_app.c index 547ce27..0f23254 100644 --- a/keil/uwb_app.c +++ b/keil/uwb_app.c @@ -79,7 +79,7 @@ /* RX window open in advance */ #define RX_WIN_IN_ADVANCE_US (150) -#define DELAY_BETWEEN_TWO_FRAME_UUS 400 +#define DELAY_BETWEEN_TWO_FRAME_UUS 1000 /* Field index in frame */ #define MSG_SEQ_NUM_IDX 2 @@ -364,7 +364,8 @@ while(mac_is_busy()); gpio_pin_clr(SCL_PIN); } -uint16_t uwb_searchcount,range_timeout_us = 5000; +uint32_t range_timeout_us = 5000; +uint16_t uwb_searchcount; uint8_t flag_recsuccess; extern uint8_t g_start_send_flag,search_open_flag = 1,link_success_flag; int UwbRange(void) @@ -400,7 +401,7 @@ temp_count3=phy_timer_count_get(); gpio_pin_set(SCL_PIN); uwb_rx(0, 0, range_timeout_us);//开启接收 - // while(mac_is_busy()); + // while(mac_is_busy()); // temp_count2=phy_timer_count_get(); start_receive_count=phy_timer_count_get(); poll_timeout=US_TO_PHY_TIMER_COUNT(range_timeout_us);//多一个多0.4ms默认0.4ms计算为0.125*4*100000,默认开启1mss @@ -420,6 +421,7 @@ break; } } + if(receive_flag==1)//成功接收 { @@ -467,6 +469,8 @@ uwb_rx(0, 0, range_timeout_us); } } + delay_us(1); + uwb_rx_force_off(1); if(!flag_recsuccess) { sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US-3));//测试 @@ -479,7 +483,10 @@ search_open_flag = 1; } } + gpio_pin_clr(SCL_PIN); + + return 0; } @@ -581,6 +588,8 @@ uwb_rx(0, 0, RX_SYNC_WIN_US_TEMP);//再次开启接收 } + delay_us(1); + uwb_rx_force_off(1); // LOG_INFO(TRACE_MODULE_APP,"超时定时器:%x,%x,%x\r\n",start_receive_count,end_receive_count,current_count); gpio_pin_clr(SCL_PIN);//测试 return 0;//返回绑定失败标志 -- Gitblit v1.9.3