zhyinch
2021-03-14 0533236e453d9368d6f66341cafa2a8f2fe81dc3
Src/application/dw_app.c
@@ -646,6 +646,7 @@
   uint32_t final_tx_time;
   u32 start_poll;
   u8 i,j,getsync_flag=0,timeout;
    USART_putc(current_slotnum);
    dwt_setrxaftertxdelay(POLL_TX_TO_RESP_RX_DLY_UUS);         //设置发送后开启接收,并设定延迟时间
    dwt_setrxtimeout(RESP_RX_TIMEOUT_UUS);      
   tag_succ_times = 0;
@@ -765,7 +766,7 @@
                           }
                           ancsync_time=((sync_timer)*1000+tmp_time);   
                           last_slotnum=current_slotnum;
                           current_slotnum=((float)(sync_timer*10)/(SLOTTIME_MS*bigslot_num))+1;
                           current_slotnum=((float)(sync_timer*10 - tagslotpos*SLOTTIME_MS)/(SLOTTIME_MS*bigslot_num))+1;
                           if(current_slotnum==last_slotnum-1)
                           {flag_getresponse=1;}
                           lastsync_timer=sync_timer;
@@ -808,6 +809,8 @@
                  }         
               //   dwt_write32bitreg(SYS_STATUS_ID,SYS_STATUS_RXFCG| SYS_STATUS_ALL_RX_ERR);
         }
            if(flag_finalsend!=1)
            {flag_finalsend = 2;}
         dwt_forcetrxoff();
dwt_write32bitreg(SYS_STATUS_ID,SYS_STATUS_RXFCG| SYS_STATUS_ALL_RX_ERR);
@@ -844,12 +847,15 @@
                        if(motor_keeptime==0)
                            motor_keeptime = rec_remotepara[3];
               }else{
                  memcpy((uint8_t*)&g_com_map + pack_index, &rec_remotepara[3], pack_length);
               //返回一个error状态
               //SendComMap(pack_datalen,pack_index);
               save_com_map_to_flash();
               delay_ms(100);
               NVIC_SystemReset();
                        if(pack_index<200)
                        {
                            memcpy((uint8_t*)&g_com_map + pack_index, &rec_remotepara[3], pack_length);
                            //返回一个error状态
                            //SendComMap(pack_datalen,pack_index);
                            save_com_map_to_flash();
                            delay_ms(100);
                            NVIC_SystemReset();
                        }
               }
            }
         }
@@ -945,7 +951,7 @@
                        }
                     }
}
u32 id;
u32 id,error_times=0;
void Tag_App(void)//发送模式(TAG标签)
{
   
@@ -958,7 +964,13 @@
    {
      //   Dw1000_Init();
         id =  dwt_readdevid() ;
        IdleTask();
        if(error_times++>20)
        {
            SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader
        }
    }
    error_times = 0;
   switch(tag_state)
   {
      case REGPOLL: