From 8aa343c68337975234072baae5eda592487c4271 Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期六, 16 八月 2025 18:29:41 +0800
Subject: [PATCH] 防丢手环V1.0demo版本实现一对多测距和发送震动信息

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

diff --git a/keil/include/main/main.c b/keil/include/main/main.c
index 92b2c91..7d3f7ab 100644
--- a/keil/include/main/main.c
+++ b/keil/include/main/main.c
@@ -231,11 +231,11 @@
 				{
 					power_low_flag=1;
 					gps_air780_power_change(gps_power_state,0);//gps原样,关闭4G 
-					LOG_INFO(TRACE_MODULE_APP, "电池电压低于3.3V,4G,GPS,马达停止工作\r\n");
+					LOG_INFO(TRACE_MODULE_APP, "电池电压低于,3.3V马达停止工作\r\n");
 				}else{
 					power_low_flag=0;
 					gps_air780_power_change(gps_power_state,1);//gps原样,开启4G
-					LOG_INFO(TRACE_MODULE_APP, "电池电压正常,4G,GPS,马达正常工作\r\n");
+					LOG_INFO(TRACE_MODULE_APP, "电池电压正常,马达正常工作\r\n");
 				}
 		//tt2=gpio_pin_get_val(ADC_GND_ENABLE);
   //  LOG_INFO(TRACE_MODULE_APP, "The voltage is %%%d \r\n",bat_percent);
@@ -260,17 +260,14 @@
 void click_Task(void);
 void MotorPoll(void)
 {
-	if(active_flag)
-{
-	if(change_by_distance())
+	if(change_by_distance()&&active_flag)
 	{
 			if(motor_count++%2==0)
 			motor_power_state=0;//开启
 			else{
 			motor_power_state=1;//关闭
 			}
-	}
-}else{
+	}else{
 	motor_power_state=1;//关闭
 	}
 }
@@ -512,7 +509,7 @@
 }
 static void sleep_timer_callback(void *dev, uint32_t time)
 {
-   // IO_control_init();
+    IO_control_init();
 		
 		MotorPoll();
 		update_led_power_state();
@@ -714,9 +711,9 @@
     ip2 = (g_com_map[TCP_IP_2]>>12&0xf)*1000+(g_com_map[TCP_IP_2]>>8&0xf)*100+(g_com_map[TCP_IP_2]>>4&0xf)*10+(g_com_map[TCP_IP_2]&0xf);
     ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf);
     port = g_com_map[TCP_PORT];
-    g_com_map[VERSION] = (1<<8)|14;
+    g_com_map[VERSION] = (1<<8)|0;
     LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id);
-    LOG_INFO(TRACE_MODULE_APP,"固件版本:UWB-4G车载手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
+    LOG_INFO(TRACE_MODULE_APP,"固件版本:UWB-4G防丢手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
     LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port);
 }
 
@@ -793,7 +790,7 @@
 int16_t Voltage_input;
 extern uint8_t uwb_rx_flag;
 int main(void)
-{
+ {
     board_clock_run();
     boot_deinit();
     board_pins_config();

--
Gitblit v1.9.3