From 2a2aa76ac915572ae3f551b099a4be5bc47e0a05 Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期三, 09 四月 2025 16:14:20 +0800
Subject: [PATCH] V2.59

---
 Src/main.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/Src/main.c b/Src/main.c
index 4f7d8b5..f7fe6db 100644
--- a/Src/main.c
+++ b/Src/main.c
@@ -43,7 +43,7 @@
 #define NSH1 0x0001
 #define GP   0x0002
 #define FLASH_HARDWARE_VERSION_MAP		(uint32_t)0x08004F00    //硬件版本号和批次信息位置
-#define DEBUG_MODE
+//#define DEBUG_MODE
 UART_WakeUpTypeDef Selection;
 /* USER CODE END Includes */
 
@@ -235,7 +235,7 @@
     hardware_pici = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2);
     hardware_type = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4);
     //deca_sleep(1000);
-    g_com_map[VERSION] = (2<<8)|53;
+    g_com_map[VERSION] = (2<<8)|59;
 //     g_com_map[VERSION] = (3<<8)|2;
 //    g_com_map[DEV_ID]=1158;
 //    g_com_map[GROUP_ID]=1;
@@ -474,7 +474,7 @@
         BeepTask();
     }
 }
-
+uint8_t oneflag;
 /* USER CODE END 0 */
 
 /**
@@ -566,11 +566,24 @@
         
 //        }
         LoraUp_Poll();
+        
+        if(sleep_flag&&oneflag==0)
+        {
+            oneflag=1;
+            Radio.Standby();
+            Radio.Sleep();
+            LedOff_task();
+        }
 #ifndef DEBUG_MODE
         if(beep_flag==0)
         {
         if(!HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)&&motor_keeptime==0)
+        {
+//        sleep_flag=0;
+//            LoraUp_Poll();
             HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
+        }
+//            
         }
 #endif
 
@@ -594,7 +607,7 @@
   /** Configure LSE Drive Capability
   */
   HAL_PWR_EnableBkUpAccess();
-  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
+  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
   /** Initializes the CPU, AHB and APB busses clocks
   */
   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI
@@ -1131,10 +1144,10 @@
             {
                 if(sleep_flag==0)
                 {
-                    Radio.Standby();
-                    Radio.Sleep();
+//                    Radio.Standby();
+//                    Radio.Sleep();
                     sleep_flag = 1;
-                    LedOff_task();
+//                    LedOff_task();
                 }
             } 
 #endif

--
Gitblit v1.9.3