yincheng.zhong
2024-01-29 4691492f913d0730703f8fcdacd0a02d455d65a1
Src/application/dw_fz_tag.c
@@ -110,7 +110,7 @@
    for(int i=0;i<11;i++)
    {
        rec_anc_signalpower[i] = exsistbase_list[i];
      if(exsistbase_list[i]>2)
      if(exsistbase_list[i]==KEEP_TIMES)
      {
          if(config.chan==2)
          {
@@ -157,7 +157,7 @@
static uint8_t last_nearbase_num,next_nearbase_num,last_slotnum, para_update,para_len,tag_succ_times,recbase_num;
static uint32_t rec_tagpos_binary;
static int16_t offset=2700,g_commap_antdelay=0;
uint8_t motor_state;
uint8_t motor_state,ancnum,thistime_ancnum;
static uint8_t rec_remotepara_state,rec_remotepara[80],t1;
static uint32_t temp1,temp2,dw_systime;
void NearPoll(void)
@@ -189,6 +189,7 @@
   send_buffer[BUTTON_IDX] =  0;
   send_buffer[SEQUENCE_IDX] = frame_seq_nb++;
   send_buffer[NEARBASENUM_INDEX] = nearbase_num;
    ancnum = nearbase_num;
   memcpy(&send_buffer[NEARBASEID_INDEX],&nearbaseid_list,nearbase_num*2);
    memcpy(&send_buffer[NEARBASEID_INDEX+nearbase_num*2],&u16_nearbase_distlist,nearbase_num*2);
   send_buffer[MESSAGE_TYPE_IDX] = NEAR_POLL;   
@@ -208,7 +209,7 @@
   mainbase_dist=100000;
   mainbase_lost_count++;
    start_count=HAL_LPTIM_ReadCounter(&hlptim1);
    timeout=ceil((float)nearbase_num*SLOT_SCALE)+3;
    timeout=ceil((float)nearbase_num*SLOT_SCALE)+8;
    end_count=start_count+(timeout<<5);
    if(end_count>=32768)
    {
@@ -220,21 +221,7 @@
    while(current_count<end_count||current_count>end_count+15000)
         {
               while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR)))//不断查询芯片状态直到成功接收或者发生错误
               {
                        if(flag_finalsend)
                  {
                     dw_systime=dwt_readsystimestamphi32();
                     if(dw_systime>temp1&&dw_systime<temp2)
                     {
                        dwt_forcetrxoff();
                        flag_rxon=0;
//                        dwt_setdelayedtrxtime(final_tx_time);
//                        result=dwt_starttx(DWT_START_TX_DELAYED);//设定为延迟发送
                        flag_finalsend=0;
                        break;
                     }
                        }
               {
                current_count=HAL_LPTIM_ReadCounter(&hlptim1);
                if(current_count>=end_count&&current_count<end_count+15000)
                    break;
@@ -412,6 +399,17 @@
//         {
//            nearbase_distlist[i]=0x1ffff;
//         }
             if(recbase_num!=next_nearbase_num)
            {   uint16_t current_count1,lpcount1;
                current_count1=HAL_LPTIM_ReadCounter(&hlptim1);
                lpcount1 = current_count1+current_count1%200+3276;//测距丢包就改成10hz
                if(lpcount1>=32768)
                {
                    lpcount1 -=32768;
                }
                __HAL_LPTIM_COMPARE_SET(&hlptim1, lpcount1);
            }
            thistime_ancnum = recbase_num;
   dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR| SYS_STATUS_TXFRS |SYS_STATUS_RXFCG);
}