From f0d3f5192235c9cc03a7952c7a3d9108578a4d2d Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Thu, 23 Jul 2026 09:23:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20LaserTimerMinutes=E6=8C=81=E4=B9=85?= =?UTF-8?q?=E5=8C=96=E5=AD=98=E5=82=A8=E5=88=B0Flash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. AppPara_T新增LaserTimerMinutes字段,上电从Flash加载 2. 首次使用默认10分钟,laser time修改后SAVE_APP_PARA保存 3. 断电重启后保留上次设定值 --- Module/LaserTracing_Debug/UartDebug.c | 2 ++ source/inc/bsp.h | 1 + source/src/main.c | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Module/LaserTracing_Debug/UartDebug.c b/Module/LaserTracing_Debug/UartDebug.c index 26c8426..d066718 100644 --- a/Module/LaserTracing_Debug/UartDebug.c +++ b/Module/LaserTracing_Debug/UartDebug.c @@ -785,6 +785,8 @@ static void DebugLaserConfig(int argc, char *argv[]) return; } SGCP.LaserTimerMinutes = (uint8_t)min; + App.Para.LaserTimerMinutes = (uint8_t)min; + SAVE_APP_PARA((uint32_t *)&App.Para); DBG_LOG("Laser timer set to %d minute(s).\r\n", SGCP.LaserTimerMinutes); } } diff --git a/source/inc/bsp.h b/source/inc/bsp.h index 0aa1a19..b2deb0c 100644 --- a/source/inc/bsp.h +++ b/source/inc/bsp.h @@ -259,6 +259,7 @@ typedef struct { RS485Para_t Rs485Ch1; RS485Para_t Rs485Ch2; uint32_t FactoryFlag;//出厂标志位 + uint8_t LaserTimerMinutes; //激光定时关闭分钟数 LoraPara_t Lora; }AppPara_T, *pAppPara; //#define APP_PARA_ADDRESS (0x0001FC00) diff --git a/source/src/main.c b/source/src/main.c index 7ae88fe..613e238 100644 --- a/source/src/main.c +++ b/source/src/main.c @@ -1,4 +1,4 @@ - + /****************************************************************************** * Include files ******************************************************************************/ @@ -196,9 +196,9 @@ static void AppInit(void) App.Login_LPTimer0 = true; //LPTimer0_ON((App.Nonce % 1200) + 300);//定时30s+随机2分钟,最小间隙100ms LPTimer0_ON(50);//5秒后注册 - SGCP.LaserTimerMinutes = 10; //激光定时关闭默认10分钟 - SGCP.LaserTimerCount = 0; - App.Upload45S10SCount = 0; + if(App.Para.LaserTimerMinutes == 0) + App.Para.LaserTimerMinutes = 10; + SGCP.LaserTimerMinutes = App.Para.LaserTimerMinutes; App.UploadFlag = false; App.Upload_LPTimer0 = false;