From 0533236e453d9368d6f66341cafa2a8f2fe81dc3 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期日, 14 三月 2021 13:18:19 +0800
Subject: [PATCH] V2.23 尝试修复红灯常亮BUG

---
 Src/application/dw_app.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index c102ec6..abca4ba 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -847,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();
+                        }
 					}
 				}
 			}
@@ -948,7 +951,7 @@
 								}
 							}
 }
-u32 id;
+u32 id,error_times=0;
 void Tag_App(void)//发送模式(TAG标签)
 {
 	
@@ -961,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:

--
Gitblit v1.9.3