zhyinch
2022-05-28 b5dc11acf7d70e2ddcff627db25445e2588b3f7a
Ô´Âë/ºËÐİå/Src/application/dw_app.c
@@ -314,7 +314,7 @@
return max_slotpos-1;
}
u8 test=0;
u8 anclost_times=0;
u8 anclost_times=0,usartoutput_count,usartoutput_notenough=0;
u8 exsistbase_list[MAX_NEARBASE_NUM],report_num,get_newbase=0,rec_extratag_battary;
u16 temp_sync_timer1,temp_sync_timer2,rec_extratag_id;
int32_t rec_extratag_dist;
@@ -330,6 +330,7 @@
    dwt_setrxaftertxdelay(POLL_TX_TO_RESP_RX_DLY_UUS);         //设置发送后开启接收,并设定延迟时间
    dwt_setrxtimeout(RESP_RX_TIMEOUT_UUS);      
   tag_succ_times = 0;
    usartoutput_count = 0;
   GPIO_WriteBit(GPIOA, GPIO_Pin_10, Bit_SET);
   if(next_nearbase_num>=MAX_NEARBASE_NUM)
   {
@@ -492,6 +493,7 @@
                              checksum = Checksum_u16(&usart_send[2],17);
                              memcpy(&usart_send[19],&checksum,2);
                              UART_PushFrame(usart_send,21);
                                        usartoutput_count++;
                              #endif
                           }
                           if(rec_extratag_dist!=0x1ffff&&rec_extratag_dist!=0&&rx_buffer[GROUP_ID_IDX]!=supergroupid)
@@ -563,6 +565,7 @@
                              checksum = Checksum_u16(&usart_send[2],17);
                              memcpy(&usart_send[19],&checksum,2);
                              UART_PushFrame(usart_send,21);
                                        usartoutput_count++;
                              #endif
                           //dwt_setdelayedtrxtime(final_tx_time);//设置final包发送时间T5
@@ -699,6 +702,16 @@
//         }else{
//            anclost_times=0;
//         }
        if(usartoutput_count>=2)
        {
            usartoutput_notenough = 0;
        }else{
            tyncpoll_time = (tagslotpos--%max_slotpos)*slottime;
            if(usartoutput_notenough++>10)
            {
                SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader
            }
        }
dwt_forcetrxoff();
   dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR| SYS_STATUS_TXFRS |SYS_STATUS_RXFCG);
}
@@ -954,13 +967,13 @@
      tx_nearresp_msg[GROUP_ID_IDX] = group_id;
         tx_nearresp_msg[MAINBASE_INDEX]=flag_syncbase;
         tx_nearresp_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE;
         tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate;
         if(remotesend_state)
         {
             memcpy(&tx_nearresp_msg[REMOTEPARA_INDEX],remotetag_para,REMOTEPARA_LEN);
            dwt_writetxdata(22+REMOTEPARA_LEN, tx_nearresp_msg, 0);//写入发送数据
            dwt_writetxfctrl(22+REMOTEPARA_LEN, 0);//设定发送长度
         }else{
         tx_nearresp_msg[MOTORSTATE_INDEX]=0;//(remotesend_state<<4)|motorstate;
//         if(remotesend_state)
//         {
//             memcpy(&tx_nearresp_msg[REMOTEPARA_INDEX],remotetag_para,REMOTEPARA_LEN);
//            dwt_writetxdata(22+REMOTEPARA_LEN, tx_nearresp_msg, 0);//写入发送数据
//            dwt_writetxfctrl(22+REMOTEPARA_LEN, 0);//设定发送长度
//         }else{
            if(taglist_pos==1)
            {
               memcpy(&tx_nearresp_msg[EXTRA_TAGID_INDEX], &tagid_list[0], 2);
@@ -973,7 +986,7 @@
            }               
            dwt_writetxdata(28, tx_nearresp_msg, 0);//写入发送数据
            dwt_writetxfctrl(28, 0);//设定发送长度
         }
   //      }
         result = dwt_starttx(DWT_START_TX_DELAYED | DWT_RESPONSE_EXPECTED);//延迟发送,等待接收