zhyinch
2021-06-21 083ca82eb09340e71de8694fbb5bae9b99489b38
源码/核心板/Src/main.c
@@ -44,7 +44,8 @@
   checksum = Checksum_u16(&hbsend[2],12);
   memcpy(&hbsend[14],&checksum,2);
}
u16 tyncpoll_time;
uint16_t vel_factor,pos_factor;
u16 tyncpoll_time,dist_threshold;
u16 slottime,max_slotpos;
extern u8 module_power;
extern u16 total_slotnum;
@@ -71,13 +72,23 @@
   {
     g_com_map[COM_INTERVAL]=100;
   }
   g_com_map[VERSION] = 0x011d;
   g_com_map[VERSION] = 0x0132;
dist_threshold = (g_com_map[SPEEDFILTER_THRES]*10)/(1000/g_com_map[COM_INTERVAL]);
      if(dist_threshold<300)
      {dist_threshold = 300;}
      if(dist_threshold>15000)
      {dist_threshold = 15000;}
   g_com_map[SW_TYPE] =    SW_FANGZHUANG;
   dev_id = g_com_map[DEV_ID];
   slottime=ceil((double)g_com_map[MAX_REPORT_ANC_NUM]*SLOT_SCALE)+3;
   max_slotpos=g_com_map[COM_INTERVAL]/slottime;
   tyncpoll_time=(g_com_map[DEV_ID]%max_slotpos)*slottime;   
   module_power = g_com_map[POWER];
   total_slotnum = 1000/g_com_map[COM_INTERVAL];
         vel_factor=g_com_map[FILTER_COEFFICIENT];
      pos_factor=g_com_map[FILTER_COEFFICIENT];
      if(module_power>67)
      {
         module_power=67;
@@ -152,15 +163,15 @@
   if(flag_newsecond)
   {
      uint32_t temp23;
         temp23 =  dwt_read32bitreg(CHAN_CTRL_ID) ;
         if(temp23!=0x4A480022)
         {
            temp23 =  dwt_read32bitreg(CHAN_CTRL_ID) ;
               if(temp23!=0x4A480022)
               {
                  NVIC_SystemReset();
               }
            }
//         temp23 =  dwt_read32bitreg(CHAN_CTRL_ID) ;
//         if(temp23!=0x4A480022)
//         {
//            temp23 =  dwt_read32bitreg(CHAN_CTRL_ID) ;
//               if(temp23!=0x4A480022)
//               {
//                  NVIC_SystemReset();
//               }
//            }
     flag_newsecond=0;
      tagpos_binary=0;
      memcpy(ancidlist_send,ancidlist_rec,ancidlist_num*2);
@@ -172,7 +183,7 @@
         tagpos_rec[i] = 0;
      }
   }
   if(target_time>1000)
   if(target_time>=1000)
   {target_time-=1000;}
   #ifdef USART_INTEGRATE_OUTPUT
   if(g_com_map[DEV_ROLE]==0&&usart_send_flag)
@@ -239,7 +250,7 @@
   usart_send[1]=0xAA;
   usart_send_anc[0]=0x55;
   usart_send_anc[1]=0xAA;
    NearPoll();
   while(1)
   {
   g_start_sync_flag=0;