zhyinch
2020-04-02 0781da980b9359a5542bacba06b6a60b0508650c
Ô´Âë/ºËÐİå/Src/application/dw_app.c
@@ -345,6 +345,7 @@
      change_base_count=0;
   }
}
u8 anclost_times=0;
void NearPoll(void)
{
   static u8 mainbase_lost_count=0,flag_finalsend;
@@ -417,7 +418,7 @@
                           //////////////////////////////////时间同步
                           memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2);
                           memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2);
                           memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2);
//                           memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2);
                           tmp_time=tmp_time+450;
                           if(tmp_time>999)
                           {
@@ -427,9 +428,9 @@
                                 {sync_timer=0;}
                           }
                           TIM3->CNT=tmp_time;
                           if(tagslotpos>max_slotpos)
                              tagslotpos=tagslotpos%(max_slotpos+1);
                              tyncpoll_time=(tagslotpos-1)*slottime;
//                           if(tagslotpos>max_slotpos)
//                              tagslotpos=tagslotpos%(max_slotpos+1);
//                              tyncpoll_time=(tagslotpos-1)*slottime;
                           ////////////////////////////
                           mainbase_lost_count=0;
                           flag_finalsend=1;
@@ -489,15 +490,19 @@
            tag_state=DISCPOLL;
         }
         NearAncSelect();
//            if(result==0)
//         {while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))//不断查询芯片状态直到发送完成
//         { };
//
//   }
//   else
//   {
         if(recbase_num<g_com_map[MIN_REPORT_ANC_NUM] )
         {
            anclost_times++;
            if(anclost_times>3)
            {
               tagslotpos=poll_tx_ts%(max_slotpos+1);
            }
         }else{
            anclost_times=0;
         }
   dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
//   }
}
@@ -560,9 +565,9 @@
    
         break;
      case NEARPOLL:
         GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET);
         //GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET);
         NearPoll();
         GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET);
         //GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET);
         break;
   }
}