From 1e03a466ce599d677cd061283cc03491afe8b4e1 Mon Sep 17 00:00:00 2001 From: Zhangwen <13970730+mkc46119@user.noreply.gitee.com> Date: Wed, 4 Jun 2025 16:58:48 +0800 Subject: [PATCH] =?UTF-8?q?feature:=201.=E6=B7=BB=E5=8A=A0=E9=95=BF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=97=A0=E6=93=8D=E4=BD=9C=E5=85=B3=E6=9C=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=B8=BA3min?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/app_config.c | 2 ++ source/app/app_config.h | 2 ++ source/app/main.h | 36 ------------------------------------ source/app/task_appstatus.c | 31 +++++++++++++++++++------------ source/app/task_appstatus.h | 19 ++++++------------- source/app/task_keystatus.c | 5 ++++- source/bsp/bsp_oid.c | 2 ++ source/bsp/chipid.c | 2 +- 8 files changed, 36 insertions(+), 63 deletions(-) diff --git a/source/app/app_config.c b/source/app/app_config.c index 08334ff..3b52f08 100644 --- a/source/app/app_config.c +++ b/source/app/app_config.c @@ -115,6 +115,8 @@ void L3_iap_2_reg(void) void L3_reg_reset(void) { U8 i = 0; + + R.Operate_time = 0; R.app_status = POW_OFF; diff --git a/source/app/app_config.h b/source/app/app_config.h index 2cf7b03..ff5d72a 100644 --- a/source/app/app_config.h +++ b/source/app/app_config.h @@ -87,6 +87,8 @@ typedef struct global_register APP_STATUS app_status; + U32 Operate_time; + }GlobalRegister; extern GlobalRegister R; diff --git a/source/app/main.h b/source/app/main.h index 51b7ad5..ee7594e 100644 --- a/source/app/main.h +++ b/source/app/main.h @@ -1,39 +1,3 @@ -////////////////////////////////////////////////////////////////////////// -/// COPYRIGHT NOTICE -/// Copyright (c) 2017, 传控科技 -/// All rights reserved. -/// -/// @file main.c -/// @brief main app -/// -///(本文件实现的功能的详述) -/// -/// @version 1.1 CCsens technology -/// @author CC -/// @date 20150102 -/// -/// -/// 修订说明:最初版本 -/// Modified by: -/// Modified date: -/// Version: -/// Descriptions: -/// -/// -/// -/// -/// -/// -/// -/// msp: humtemp flow -/// bsp: i2c adc -/// -/// -/// -/// -/// -////////////////////////////////////////////////////////////////////////// - #ifndef _MAIN_H #define _MAIN_H diff --git a/source/app/task_appstatus.c b/source/app/task_appstatus.c index ea48319..2f7069f 100644 --- a/source/app/task_appstatus.c +++ b/source/app/task_appstatus.c @@ -1,15 +1,3 @@ -//////////////////////////////////////////////////////////////////////////// -///@copyright Copyright (c) 2018, 传控科技 All rights reserved. -///------------------------------------------------------------------------- -/// @file bsp_drv.c -/// @brief bsp @ driver config -///------------------------------------------------------------------------- -/// @version 1.0 -/// @author CC -/// @date 20180331 -/// @note cc_AS_stc02 -////////////////////////////////////////////////////////////////////////////// - #include "../app/task_appstatus.h" #include "../bsp/bsp_led.h" #include "../bsp/bsp_key.h" @@ -47,6 +35,12 @@ void L3_task_appstatus_handler(S_TASK_APPSTATUS *s) L2_task_go(D_task_DETECTCHANGE); TTSS_Task_step(D_task_DETECTCHANGE) + if (R.app_status != POW_OFF) + { + //低功耗模式判断 + PowerOff_judge(); + } + if(s->status != R.app_status) { s->status = R.app_status; @@ -147,4 +141,17 @@ void L3_task_appstatus_handler(S_TASK_APPSTATUS *s) L2_task_go_Tdelay(D_task_DETECTCHANGE,D_Tdelay_500ms); TTSS_Task_end(); +} + +// 无操作进入低功耗模式 +void PowerOff_judge() +{ + U32 Nowtime = D_sys_now; + if( Nowtime - R.Operate_time > Noperate_Time_Seconds) // 180000/JIFFIES = 180s + { + // R.ScrTouch_flag = 0; + R.app_status = POW_OFF; + L0_uart0_sendstr("R.app_status = POW_OFF!!!"); + L0_uart0_0d0a(); + } } \ No newline at end of file diff --git a/source/app/task_appstatus.h b/source/app/task_appstatus.h index b72c1c3..7eed10a 100644 --- a/source/app/task_appstatus.h +++ b/source/app/task_appstatus.h @@ -1,16 +1,3 @@ -//////////////////////////////////////////////////////////////////////////// -///@copyright Copyright (c) 2018, 传控科技 All rights reserved. -///------------------------------------------------------------------------- -/// @file bsp_drv.h -/// @brief bsp @ driver config -///------------------------------------------------------------------------- -/// @version 1.0 -/// @author CC -/// @date 20180331 -/// @note cc_AS_stc02 - -////////////////////////////////////////////////////////////////////////////// - #ifndef _TASK_APPSTATUS_H #define _TASK_APPSTATUS_H @@ -18,6 +5,11 @@ #include "../clib/clib.h" #include "app_config.h" + +#define Noperate_Time_MSeconds 180000 + +#define Noperate_Time_Seconds Noperate_Time_MSeconds/JIFFIES // 180000/JIFFIES = 180s + typedef struct _s_task_appstatus { TS_task task; @@ -27,5 +19,6 @@ typedef struct _s_task_appstatus extern S_TASK_APPSTATUS _s_task_appstatus; extern void L3_task_AppStatus_init(void); extern void L3_task_appstatus_handler(S_TASK_APPSTATUS *s); +extern void PowerOff_judge(); #endif // #ifndef diff --git a/source/app/task_keystatus.c b/source/app/task_keystatus.c index 40c85e8..898675c 100644 --- a/source/app/task_keystatus.c +++ b/source/app/task_keystatus.c @@ -44,13 +44,14 @@ void L3_task_keystatus_handler(S_TASK_KEYSTATUS *s) TTSS_Task_step(D_task_KEY_DETECT) if(L2_ReadKey3() == Key_Down) { + R.Operate_time = D_sys_now; if (s->Key3_Down_Begin_Time == 0) { s->Key3_Down_Begin_Time = D_sys_now; } else { - U32 diff = D_sys_now -s->Key3_Down_Begin_Time; + U32 diff = D_sys_now - s->Key3_Down_Begin_Time; // L0_uart0_ulhex(diff); if (diff >= LongKey_PWR_MSeconds/JIFFIES && s->Key3_handled == 0) { @@ -82,6 +83,7 @@ void L3_task_keystatus_handler(S_TASK_KEYSTATUS *s) } else if (L2_ReadKey1() == Key_Down) { + R.Operate_time = D_sys_now; if (s->Key1_handled == 0 && R.app_status != POW_OFF) { s->Key1_handled = 1; @@ -91,6 +93,7 @@ void L3_task_keystatus_handler(S_TASK_KEYSTATUS *s) } else if (L2_ReadKey2() == Key_Down) { + R.Operate_time = D_sys_now; if (s->Key2_handled == 0 && R.app_status != POW_OFF) { s->Key2_handled = 1; diff --git a/source/bsp/bsp_oid.c b/source/bsp/bsp_oid.c index 6b6fec9..5ca5280 100644 --- a/source/bsp/bsp_oid.c +++ b/source/bsp/bsp_oid.c @@ -8,6 +8,7 @@ #include "../app/app_task_speech.h" #include "../bsp/bsp_WT2605B.h" #include "../bsp/bsp_wifi.h" +#include "../app/app_config.h" /****************************************************************************************************** 变量定义 @@ -472,6 +473,7 @@ void L1_Oid_readoid(void) { if(!OID_DET) { + R.Operate_time = D_sys_now; // L2_WT2605B_Broadcast(&audio_game_correct); ts_oid.pre_x = ts_oid.X100; ts_oid.pre_y = ts_oid.Y100; diff --git a/source/bsp/chipid.c b/source/bsp/chipid.c index 99cad66..ca5a4d0 100644 --- a/source/bsp/chipid.c +++ b/source/bsp/chipid.c @@ -42,7 +42,7 @@ void L0_id_get_chipid() P_SW2 |= 0x80; for(i=0;i