From 147d2248cd39e7686e73313ef5408fda066fdb0a Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期二, 27 八月 2019 21:09:00 +0800
Subject: [PATCH] 增加标签确定序号

---
 源码/核心板/Src/main.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c"
index e07463e..872fdb4 100644
--- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c"
+++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c"
@@ -16,6 +16,7 @@
 {
 	RCC_Configuration();
 	//SystemInit();
+	NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x5000);
 	Nvic_Init();
 	Systick_Init();
 	Led_Init();
@@ -100,7 +101,7 @@
 		{
 			if(g_com_map[DEV_ROLE]==0)
 			{int8_t correction_time;
-				correction_time=tag_timer-(GROUP_TAG_NUM+1)*3;
+				correction_time=tag_timer-g_com_map[DEV_ID]*3;
 				tag_delaytime=correction_time;
 							if(tag_delaytime>g_com_map[COM_INTERVAL]/2)
 							{
@@ -110,6 +111,20 @@
 		g_start_send_flag=1;
 		}
 		
+	}
+	if(g_com_map[CNT_UPDATE]==1)
+	{
+	uint32_t result = 0;
+		u16 tmp = 0xAAAA;
+	__disable_irq();
+	result = FLASH_Prepare(0x8004A38, 2);
+	if(result)
+		result = FLASH_Write(0x8004A38, (const uint8_t*)&tmp, 2); 
+	__enable_irq();
+		printf("进入升级模式\r\n");
+		//	STMFLASH_Write_NoCheck(0x8004A38,0xAAAA);
+		//	Delay_ms(100);
+			SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader   
 	}
 
 	}
@@ -130,8 +145,7 @@
 		IdleTask();		
 	if(g_start_send_flag)
 	{
-		g_start_send_flag = 0;
-		
+		g_start_send_flag = 0;		
 		Tag_App();
 	}
 	

--
Gitblit v1.9.3