From 847f098fdfd333528b1363f4c4a5aab761ecdf0a Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期五, 03 一月 2025 17:11:52 +0800
Subject: [PATCH] 111111111

---
 keil/include/main/main.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/keil/include/main/main.c b/keil/include/main/main.c
index 4b52f06..9376d41 100644
--- a/keil/include/main/main.c
+++ b/keil/include/main/main.c
@@ -61,9 +61,10 @@
 #define TEST_UART_MODE TEST_UART_DMA_MODE
 
 #define NUM_SAMPLES 1
-#define SLEEP_START_TIME 120
+#define SLEEP_START_TIME 30
 uint8_t enable_sleep_count,sleep_flag;
 #define DEBUG_MODE
+
 struct UART_CFG_T test_uart_cfg =
 {
         .parity = UART_PARITY_NONE,
@@ -118,6 +119,7 @@
 static void uart_receive_callback(void *dev, uint32_t err_code)
 {		
 uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);
+    uart_receive(UART_ID0,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);
 }
 void UartInit(void)
 {
@@ -178,7 +180,7 @@
 group_id=g_com_map[GROUP_ID];
 memcpy(&dev_id ,&g_com_map[DEV_ID],2);
 tag_frequence=1000/g_com_map[COM_INTERVAL];	
-g_com_map[VERSION] = (1<<8)|6;
+g_com_map[VERSION] = (1<<8)|8;
 LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id);
 LOG_INFO(TRACE_MODULE_APP,"固件版本:UWB-标签 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
 }
@@ -220,7 +222,7 @@
 {
     board_clock_run();
 		boot_deinit();
-    board_pins_config();
+    board_pins_config(); 
     board_debug_console_open(TRACE_PORT_UART0);
 	    // Reset reason
     reset_cause_get();
@@ -250,7 +252,7 @@
     //sys_timer_open();
 		
     gpio_open();
-    //board_led_init();
+    board_led_init();
 		
 		 //uart_open(UART_ID0, &test_uart_cfg);
 		
@@ -262,13 +264,16 @@
 		//adc_open(&usr_adc_cfg);
 		//adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样
     // Enable sleep timer
+		Tag_uwb_init();
     sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback);
 		//sleep_timer_start(__MS_TO_32K_CNT(g_com_map[COM_INTERVAL]));//测试
-		sleep_timer_start(__MS_TO_32K_CNT(500));//测试
+		sleep_timer_start(__MS_TO_32K_CNT(SLEEP_COUNT));//测试
 		//board_5V_input_init(voltage_input_handler);//有修改3.3V会一直高电平导致无法进入休眠
-//				io_pin_mux_set(IO_PIN_5, IO_FUNC0);//波形测试
-//			gpio_pin_set_dir( IO_PIN_5, GPIO_DIR_OUT, 0);
-//			io_pull_set(IO_PIN_5 , IO_PULL_DOWN, IO_PULL_UP_LEVEL4);
+		#ifdef BOXING 
+				io_pin_mux_set(IO_PIN_5, IO_FUNC0);//波形测试
+			gpio_pin_set_dir( IO_PIN_5, GPIO_DIR_OUT, 0);
+			io_pull_set(IO_PIN_5 , IO_PULL_DOWN, IO_PULL_UP_LEVEL4);
+	#endif
 		//Serial0_PutString("进入app测试\r\n");
     while (1)
     { 
@@ -277,12 +282,14 @@
 			//LOG_INFO(TRACE_MODULE_APP, "测距ing");
 			
 			g_start_send_flag = 0;
-			
+			gpio_pin_set(LED_PIN);//亮
 			TagRange();
+			gpio_pin_clr(LED_PIN);//灭
 			IdleTask();	
 			}else{
 			IdleTask();	
 			}
+            LoraUp_Poll();
 #ifndef DEBUG_MODE
 			if(sleep_flag){//开始一段时间无休眠
 						trace_flush();

--
Gitblit v1.9.3