From df5669303bd54d7bfd553c7cfad279231d7ece17 Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期五, 25 四月 2025 09:33:37 +0800
Subject: [PATCH] 3.6,加入蜂鸣器等逻辑

---
 APL/App.c |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/APL/App.c b/APL/App.c
index e30e1d9..6827944 100644
--- a/APL/App.c
+++ b/APL/App.c
@@ -195,7 +195,7 @@
     //deca_sleep(1000);
 
     g_com_map[GROUP_ID]=3;
-	g_com_map[VERSION] = (3<<8)|3;
+	g_com_map[VERSION] = (3<<8)|6;
 
     if (g_com_map[COM_INTERVAL] <50)
     {
@@ -498,6 +498,12 @@
             }
         }
     }
+    if(bat_percent<=1)
+    {
+            HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
+            HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET);
+            HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+    }
 }
 
 extern uint32_t main_time;
@@ -506,6 +512,33 @@
 char str[17]= {"AT+IPR=9600;&W\r\n"};
 extern  UART_HandleTypeDef huart5;
 extern uint8_t stop_flag;
+extern uint16_t beepontime;
+u32 keystarttime,keystarttime2;
+extern uint8_t userkey_state4g;
+void UserKeyTask(void)
+{
+     if(!HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1))
+     {
+        if(HIDO_TimerGetTick() - keystarttime>1000)
+        {
+            beepontime = 2;
+            userkey_state4g = 1;
+//            userkey_state = 1;
+//            heartbeasend_flag = 1;
+            keystarttime =  HIDO_TimerGetTick();
+        }
+     }else
+     {
+       keystarttime =  HIDO_TimerGetTick(); 
+       keystarttime2 =  HIDO_TimerGetTick(); 
+     }
+    if(beepontime>0)
+    {Beep_On();}
+    else
+    {Beep_Off();}
+    Sleep_Panduan_Poll();
+
+} 
 void Main_Poll()
 {    
 //    if(main_time>10&&only_one_flag==0)
@@ -531,8 +564,10 @@
         HIDO_ATLitePoll();
         UDPClient_Poll();
         HAL_IWDG_Refresh(&hiwdg); 
-        PowerDownDetect();
+        PowerDownDetect();        
+        UserKeyTask();
         Sleep_Panduan_Poll();
+
     }
 //    if(AIR780E_IsIPIdle() && Socket_IsSendQueueEmpty(0))
 //    {

--
Gitblit v1.9.3