zhyinch
2020-04-04 1560ba22c98a3ddb13710d3592e20eeea8af7616
Src/application/dw_app.c
@@ -319,7 +319,7 @@
uint16_t checksum;
int8_t tag_delaytime;
extern uint16_t sync_timer;
uint16_t tmp_time;
uint16_t tmp_time,sync_count;
uint32_t time32_incr;uint32_t frame_len;
void Tag_App(void)//发送模式(TAG标签)
{
@@ -329,7 +329,8 @@
   uint8_t i,getsync_flag=0;
   //LED0_ON;
   //dwt_forcetrxoff();
       while (DWT_DEVICE_ID != id) // MP IC ONLY (i.e. DW1000) FOR THIS CODE
   id =  dwt_readdevid() ;
       while (DWT_DEVICE_ID != id)
    {
         id =  dwt_readdevid() ;
    }
@@ -366,7 +367,7 @@
   /* Increment frame sequence number after transmission of the poll message (modulo 256). */
   if(status_reg==0xffffffff)
   {
      NVIC_SystemReset();
   //   NVIC_SystemReset();
   }
   if (status_reg & SYS_STATUS_RXFCG)//如果成功接收
@@ -402,6 +403,19 @@
            if(sync_timer>=1010)
               {sync_timer=0;}
         }
         sync_count=(sync_timer*1000+tmp_time)/LPTIMER_LSB;
         __HAL_LPTIM_CNT_SET(&hlptim1, sync_count);
         for(i=0;i<100;i++)
         {
            lastpoll_count = slot_startcount+i*interval_count;
            if(lastpoll_count>sync_count)
            {
             __HAL_LPTIM_COMPARE_SET(&hlptim1, lastpoll_count);
               break;
            }
         }
      //   TIM3->CNT=tmp_time;
      }
         memcpy(&hex_dist2, &rx_buffer[DIST_IDX], 4);
@@ -473,10 +487,10 @@
//   deca_sleep(10);
}
   dwt_entersleep();
   if(tag_succ_times<g_com_map[MIN_REPORT_ANC_NUM])
   {
   //poll_timer +=time32_incr&0x7+3;
   }
//   if(tag_succ_times<g_com_map[MIN_REPORT_ANC_NUM])
//   {
//   //poll_timer +=time32_incr&0x7+3;
//   }
//HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
   /* Execute a delay between ranging exchanges. */