zhyinch
2020-10-29 613cb918c5d9d0c7bef84514c21dcca216d7b334
源码/核心板/Src/main.c
@@ -71,7 +71,7 @@
   {
     g_com_map[COM_INTERVAL]=100;
   }
   g_com_map[VERSION] = 0x011c;
   g_com_map[VERSION] = 0x011f;
   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;
@@ -119,6 +119,17 @@
UART_PushFrame(hbsend,16);
}
uint16_t temp;
float dw_vbat;
void StartUpTest(void)
{
   temp=dwt_readtempvbat(1);
   dw_vbat=(float)((temp&0xff)-173)/173+3.3;
   if(dw_vbat<2.8)
   {
      SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //杞浣嶅洖鍒癰ootloader
   }
}
extern u8 g_start_sync_flag,usart_send_flag,anc_report_num;
u16 heartbeat_timer,poll_timer;
int16_t sync_timer;
@@ -131,6 +142,7 @@
      
         UART_CheckReceive();
      UART_CheckSend();
   if(heartbeat_timer>1000)
   {
      heartbeat_timer=0;
@@ -139,6 +151,16 @@
   }
   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();
               }
            }
     flag_newsecond=0;
      tagpos_binary=0;
      memcpy(ancidlist_send,ancidlist_rec,ancidlist_num*2);
@@ -206,6 +228,7 @@
{
 
   Device_Init();
   //StartUpTest();
   Program_Init();
   Dw1000_Init();
  delay_ms(10);