From 62f6fe8e906f8c17493d154f5567ba8a7ab4c0cf Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期四, 26 六月 2025 18:13:38 +0800
Subject: [PATCH] 注释掉了串口逻辑,加入了与蓝牙串口通信逻辑,能够修改参数,但网关下发配置会出现hardfault未解决

---
 keil/include/main/main.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/keil/include/main/main.c b/keil/include/main/main.c
index ef59210..63c43e5 100644
--- a/keil/include/main/main.c
+++ b/keil/include/main/main.c
@@ -118,6 +118,7 @@
 uint8_t group_id,enable_sleep_count;
 uint32_t dev_id;
 uint16_t disoffset;
+uint16_t set_mk_time;
 uint8_t flag_sleeptimer,flag_secondtask,secondtask_count;
 float nomove_count;
 // Default pool descriptor.
@@ -351,6 +352,8 @@
 }
 uint8_t bat_percent;
 uint8_t  stationary_flag;
+extern uint8_t send_flag;
+extern uint8_t txdone;
 void mcu_deep_sleep(void)
 {
             uint32_t lock;
@@ -368,10 +371,7 @@
 	 // Disable watchdog timer
     wdt_close(WDT_ID0);
     LOG_INFO(TRACE_MODULE_APP, "UCI FiRa example\r\n");
-//	delay_ms(300);
-//	LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n");//测试
-//	 power_init();
-//	mcu_deep_sleep();
+
 	if(gpio_pin_get_val(SLEEP_PIN))
 	{
 	if(gpio_pin_get_val(MODE_CHANGE_PIN))//记得改回来与正式的相反
@@ -475,6 +475,7 @@
         power_manage();
 				if(!gpio_pin_get_val(SLEEP_PIN))
 				{
+				gpio_pin_clr(LORA_NRST);//lora休眠
 				LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n");
 				mcu_deep_sleep();
 				}
@@ -493,6 +494,11 @@
 		sleep_timer_start(__MS_TO_32K_CNT(SLEEP_TIMER_NUM));//测试
 			 while (1)
 				{
+					if(send_flag)
+					{
+						LOG_INFO(TRACE_MODULE_APP,"发送数量%d. \r\n",txdone);
+						send_flag=0;
+					}
 				uwb_app_poll();//我们的测距逻辑
 				if(flag_secondtask)
         {
@@ -503,6 +509,7 @@
 				Lora_Tx_Poll();	
 				if(!gpio_pin_get_val(SLEEP_PIN))
 				{
+				//gpio_pin_clr(LORA_NRST);//lora休眠
 				LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n");
 				mcu_deep_sleep();
 				}
@@ -512,6 +519,9 @@
 }else{
 //delay_ms(300);
 	LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n");
+	//gpio_pin_clr(LORA_NRST);//lora休眠
+//	spi_close(SPI_ID0);
+	//lora_in_sleep();
 	 power_init();
 	mcu_deep_sleep();
 }

--
Gitblit v1.9.3