From 4bdcef16fd860b674793c435288ed3afb50ddabe Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期六, 03 六月 2023 11:38:07 +0800
Subject: [PATCH] V2.17 Z增加参数保护,有bug

---
 Src/application/dw_app.c |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index 74ca7f5..f4189f1 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -828,7 +828,30 @@
 	recbase_num=0;
 //	motor_state=0;
 
-	
+//	for(uint8_t i=0;i<nearbase_num+1;i++)
+//    {
+//        usart_send[0] = 0x55;
+//        usart_send[1] = 0xaa;
+//        usart_send[2] = 1;//正常模式 
+//        usart_send[3] = 17;//数据段长度
+//        usart_send[4] = frame_seq_nb;//数据段长度
+//        memcpy(&usart_send[5],&dev_id,2);
+//        if(i==0)
+//        {
+//            memcpy(&usart_send[7],&mainbase_id,2);
+//        }else{
+//            memcpy(&usart_send[7],&nearbaseid_list[i-1],2);			
+//        }
+//        memcpy(&usart_send[9],&nearbase_distlist[i],4);
+//        usart_send[13] = battary;
+//        usart_send[14] = button;
+//        usart_send[15] = rec_anc_signalpower[i]>>8;
+//        usart_send[16] = rec_anc_signalpower[i];
+//        checksum = Checksum_u16(&usart_send[2],17);
+//        memcpy(&usart_send[19],&checksum,2);
+//       
+//        USART_puts(usart_send,21);
+//    }
 	tx_near_msg[BATTARY_IDX] = bat_percent;
 	tx_near_msg[BUTTON_IDX] = userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5;
 	tx_near_msg[SEQUENCE_IDX] = frame_seq_nb;
@@ -852,7 +875,7 @@
 	memcpy(&tx_near_msg[ANCHOR_ID_IDX],&mainbase_id,2);	
 	dwt_writetxdata(29+8*nearbase_num, tx_near_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
 	dwt_writetxfctrl(29+8*nearbase_num, 0);//设置超宽带发送数据长度
-				current_count=HAL_LPTIM_ReadCounter(&hlptim1);
+	current_count=HAL_LPTIM_ReadCounter(&hlptim1);
 		
 		while(current_count<poll_startcount||current_count>poll_startcount+16384)
 		{
@@ -1102,7 +1125,7 @@
                     pack_msgtype = rec_remotepara[0];
                     pack_index = rec_remotepara[1];
                     pack_length = rec_remotepara[2];
-                    if(pack_msgtype==2)
+                    if(pack_msgtype==2&&(pack_index!=DEV_ID))
                     {
                         if( pack_index == MOTOR_ONTIME_INDEX)
                         {
@@ -1112,6 +1135,7 @@
                             if(pack_index<200)
                             {
                                 memcpy((uint8_t*)&g_com_map + pack_index, &rec_remotepara[3], pack_length);
+                                memcpy((uint8_t*)&g_com_map2 + pack_index, &rec_remotepara[3], pack_length);
                                 //返回一个error状态
                                 //SendComMap(pack_datalen,pack_index);
                                 save_com_map_to_flash();
@@ -1146,6 +1170,7 @@
                     GetNearMsg();
                 }
 			}
+
             if(pos_nochange)
             {
                 flag_tagnewpos = 0;
@@ -1303,7 +1328,7 @@
           //  Poll();
             break;
 	}       
-    FZNearPoll();
+ //   FZNearPoll();
     dwt_forcetrxoff();
 //    userkey_state = !GET_USERKEY;
 	dwt_entersleep();

--
Gitblit v1.9.3