yincheng.zhong
2023-03-28 a4586d89681d7d282c26f49c9b799c5b09f553dd
Src/application/dw_app.c
@@ -471,7 +471,7 @@
u8 nearbase_num=0,last_nearbase_num,next_nearbase_num,last_slotnum, para_update,para_len,stationary_flag=0;
u32 rec_tagpos_binary;
int16_t offset=4700,temptimer;
u8 motor_state,rec_remotepara_state,rec_remotepara[80];
static u8 motor_state,rec_remotepara_state,rec_remotepara[80];
#define SINGLEPOLL_BASENUM 5
@@ -763,6 +763,7 @@
            tagpoll_sync_sec = current_slotpos/200;
            tagslotpos = current_slotpos%200;
            max_slotpos = rec_tagperiod*20;
            tag_frequency = 10/rec_tagperiod;
         tag_state=NEARPOLL;
      }
   }else{
@@ -825,12 +826,7 @@
   recbase_num=0;
//   motor_state=0;
    if(motor_state!=0&&motor_state!=3)
    {
        motor_flag = 1;
    }else{
        motor_flag = 0;
    }
   
   tx_near_msg[BATTARY_IDX] = bat_percent;
   tx_near_msg[BUTTON_IDX] = userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5;
@@ -968,8 +964,7 @@
                           mainbase_dist=temp_dist;
                                    nearbase_distlist[0] = temp_dist;
                                    base_mindist = temp_dist;
                           if((rx_buffer[MOTORSTATE_INDEX]&0xf)!=3)
                              motor_state=rx_buffer[MOTORSTATE_INDEX]&0xf;
                                    if(frame_len==28)
                                     {
                                         memcpy(&rec_maxrangelen,&rx_buffer[MAXRANGE_DISTANCE],2);
@@ -1165,7 +1160,7 @@
{
   static u8 regpoll_count=0;
   mainbase_lost_count = 0;
      tag_frequency = REGISTER_FREQUENCY;
      //tag_frequency = REGISTER_FREQUENCY;
      bigslot_num = TOTAL_SLOTNUM/tag_frequency;
      regpoll_count++;
      if(regpoll_count%2)
@@ -1233,17 +1228,17 @@
                        }
                     }
}
extern void FZNearPoll(void);
u32 id,error_times=0;
u8 ttt = 1;
extern float Height;
void Tag_App(void)//发送模式(TAG标签)
void UWBWkWp(void)
{
   static uint8_t diccount = 0;
   //LED0_ON;
   SPIx_CS_GPIO->BRR = SPIx_CS;
   delay_us(700);
   SPIx_CS_GPIO->BSRR = SPIx_CS;
   id =  dwt_readdevid() ;
       while (DWT_DEVICE_ID != id) 
    {
      //   Dw1000_Init();
@@ -1256,6 +1251,13 @@
        }
    }
    error_times = 0;
}
void Tag_App(void)//发送模式(TAG标签)
{
   static uint8_t diccount = 0,diccount2;
   //LED0_ON;
    UWBWkWp();
   switch(tag_state)
   {
      case REGPOLL:
@@ -1299,7 +1301,9 @@
        case SINGLEPOLL:
          //  Poll();
            break;
   }
     userkey_state = !GET_USERKEY;
   }
    FZNearPoll();
    dwt_forcetrxoff();
    userkey_state = !GET_USERKEY;
   dwt_entersleep();
}