From da80b96a9d0f2f9dc6e23d1a1830cc2384f2bd0b Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期五, 01 八月 2025 13:45:57 +0800
Subject: [PATCH] 加入升级代码,但是空间不够  先提交一下  改为分成两个app  由boot来进行跳转

---
 keil/include/main/main.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/keil/include/main/main.c b/keil/include/main/main.c
index a4f638e..bfa8c65 100644
--- a/keil/include/main/main.c
+++ b/keil/include/main/main.c
@@ -130,6 +130,8 @@
 {
     // LOG_INFO(TRACE_MODULE_APP, "Wake up by sleep timer %d\r\n", time);
 }
+extern uint8_t start_wait_flag;
+extern int16_t end_count1;
 static void sleep_timer_callback_normal(void *dev, uint32_t time)
 {
    if(secondtask_count++%2==0)
@@ -138,7 +140,11 @@
     }else{
         flag_secondtask = 0;
     }
-		
+		if(start_wait_flag)//lora升级等待超时标志
+		{
+		if(end_count1--<=0)
+		start_wait_flag=0;
+		}
 // if(delaysleep_count>0)
 //     delaysleep_count--;
 }
@@ -365,7 +371,7 @@
             int_unlock(lock);
 }
 int main(void)
-{		
+{		  
 	// Initialize MCU system
     board_init();
 	 // Disable watchdog timer
@@ -376,8 +382,10 @@
 //	 power_init();
 //	mcu_deep_sleep();
 	if(gpio_pin_get_val(SLEEP_PIN))
-	{
+//        if(1)
+	{ 
 	if(gpio_pin_get_val(MODE_CHANGE_PIN))//记得改回来与正式的相反
+//        if(0)//记得改回来与正式的相反
 	{
 		LOG_INFO(TRACE_MODULE_APP,"固件版本:MK_Air_tag模式 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
 		// Platform init for WSF
@@ -491,7 +499,7 @@
 		LOG_INFO(TRACE_MODULE_APP,"固件版本:MK_免布线模式 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
 		uart0_Init_normal();
 		Lora_1268_Init();
-//		 LOG_INFO(TRACE_MODULE_APP," 切换6\r\n");
+		 //LOG_INFO(TRACE_MODULE_APP," 切换6\r\n");
 		SwitchLoraSettings(478,7,22);
 		Uwb_init();//默认为我们测距配置
 		OpenUWB();
@@ -508,13 +516,14 @@
 						send_flag=0;
 					}
 				uwb_app_poll();//我们的测距逻辑
-				if(flag_secondtask)
-        {
-            flag_secondtask = 0;
-            SecondTask();
-					//Lora_Tx_Poll();
-        }
+                if(flag_secondtask)
+                {
+                    flag_secondtask = 0;
+                    SecondTask();
+                            //Lora_Tx_Poll();
+                }
 				Lora_Tx_Poll();	
+//				LoraUp_Poll();//网关升级
 				if(!gpio_pin_get_val(SLEEP_PIN))
 				{
 					delay_ms(300);

--
Gitblit v1.9.3