zhangbo
2025-04-16 e9fc03943f7a429c6c9d0e7123ba637f317805be
keil/uwb_app.c
@@ -749,51 +749,17 @@
//}
//enumwltagstate wltag_state=RANGE;
uint32_t wltag_statetimer,wltag_uwbtimer;
extern uint16_t uwb_time_count;
int uwb_app_poll(void)
{
   switch(wltag_state)
   switch(uwb_time_count)
   {
   case RANGE:
//   time_flag=HIDO_TimerGetTick()-wltag_uwbtimer;
   if(HIDO_TimerGetTick()-wltag_uwbtimer>4&&uwb_rx_flag==0)
      {
         wltag_uwbtimer = HIDO_TimerGetTick();
         OpenUWB();
      }
      else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1)
      {
//         time_flag=HIDO_TimerGetTick()-wltag_uwbtimer;
       wltag_uwbtimer = HIDO_TimerGetTick();
         case 1:
       CloseUWB();
      }
      if(uwb_losttimer>g_com_map[UWB_RNAGE_TIME])
      {
       wltag_statetimer = HIDO_TimerGetTick();
         if(uwb_rx_flag==0)//若要切换到搜索模式时没有开启则开启UWB
         {
            OpenUWB();
         }
     wltag_state = SEARCH;
      }
      break;
   case SEARCH:
      if(HIDO_TimerGetTick()-wltag_statetimer>1)
      {
         wltag_statetimer = HIDO_TimerGetTick();
         wltag_state = CLOSE;
         CloseUWB();
      }
      break;
   case CLOSE:
      if(HIDO_TimerGetTick()-wltag_statetimer>g_com_map[UWB_WAIT_TIME])
      {
         wltag_statetimer = HIDO_TimerGetTick();
         wltag_state = SEARCH;
         case 5:
         OpenUWB();      
      }
                  uwb_time_count=0;
      break;
   }
    UWBIdleTask();