1
WXK
2025-02-24 a0539c862b71248602919b1ebdad764e72dc7fb7
keil/uwb_app.c
@@ -10,7 +10,7 @@
#include "global_param.h"
#include "board.h"
#include "lib_aoa.h"
#include "WS2812.h"
extern int simple_main(void);
extern int temp_main(void);
void Calibration_Time(void);
@@ -469,6 +469,7 @@
        {
            tagid_list[j]=tagid_list[i];
            tagdist_list[j] = tagdist_list[i];
                  anchordata_bat[j]=anchordata_bat[i];//电量随之更新
            tagofflinetime[j++]=tagofflinetime[i];
        }
      }
@@ -547,7 +548,7 @@
      &&!((end_receive_count-current_count_calibration<=MS_TO_PHY_TIMER_COUNT(200))||(end_receive_count+(UINT32_MAX-current_count_calibration)<=MS_TO_PHY_TIMER_COUNT(200))))
   {
      start_receive_count_calibration=current_count_calibration;//更新开始时间
//      MotorPoll();
      
      if(secondtask_search_count++%2==0)
    {
@@ -574,13 +575,13 @@
{
      uwb_rx_force_off(1);
      uwb_rx_flag=0;
   LOG_INFO(TRACE_MODULE_APP,"关闭uwb_rx\r\n");
   //LOG_INFO(TRACE_MODULE_APP,"关闭uwb_rx\r\n");
}
void OpenUWB(void)
{
      flag_temp1=uwb_rx(0, 0,range_timeout_us);//提交接收请求
      uwb_rx_flag=1;
      LOG_INFO(TRACE_MODULE_APP,"打开uwb_rx\r\n");
      //LOG_INFO(TRACE_MODULE_APP,"打开uwb_rx\r\n");
}   
void UWBOneSecondTask(void)
{
@@ -603,12 +604,12 @@
//   switch(wltag_state)
//   {
//   case RANGE:
//   if(HIDO_TimerGetTick()-wltag_uwbtimer>0&&uwb_rx_flag==0)
//   if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==0)
//      {
//            wltag_uwbtimer = HIDO_TimerGetTick();
//            OpenUWB();
//      }
//   else if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==1)
//   else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1)
//      {
//            wltag_uwbtimer = HIDO_TimerGetTick();
//            CloseUWB();
@@ -659,6 +660,7 @@
            memcpy(rec_ancidlist,&rx_buf[FZ_NEARBASEID_INDEX],2*rec_nearbase_num);
            memcpy(rec_ancdistlist,&rx_buf[FZ_NEARBASEID_INDEX+2*rec_nearbase_num],2*rec_nearbase_num);
            memcpy(&rec_antdelay,&rx_buf[FZ_NEARBASEID_INDEX+rec_nearbase_num*4],2);
            uwbled=BLUE;
//            for(i=0; i<rec_nearbase_num; i++)
//            {
//                if(rec_ancidlist[i] == dev_id)
@@ -693,10 +695,12 @@
                              {
                                    Anchor_RecNearPoll(i);
                                    tagdist_list[taglist_pos]=rec_ancdistlist[i];
                                    anchordata_bat[taglist_pos] = battary;//保存该基站电量
                                    if(taglist_pos==taglist_num)// taglist_pos==taglist_num 说明这个基站不在当前列表中
                                    {   //tempid==dev_id 说明基站下发测距报文有这个标签的信息
                                          taglist_num++;          //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况
                                          tagid_list[taglist_pos] = tag_id_recv;
                                    }
                                    break;
                              }