From 5a8a10f105a9498d290c04f7f4707496bbac48da Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Sun, 10 Sep 2023 10:09:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E5=90=8E=E6=81=A2=E5=A4=8DTT=E7=8A=B6=E6=80=81=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/core.c | 5 +++++ applications/func/func.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/applications/core.c b/applications/core.c index 5571a8b..d38329b 100644 --- a/applications/core.c +++ b/applications/core.c @@ -262,6 +262,9 @@ void sysInit(void) initTT(); setWindowMode(); } + else if (isNeedRestore()) {//Restoring configuration after a crash + initTT(); + } } //INIT_COMPONENT_EXPORT(sysInit); @@ -710,6 +713,7 @@ void deInitTT_thread_entry() startAlarm(); clearWindowMode(); setManualWindow(-1); + setWorkSta(0); LOG_W("shunt down TT DONE"); } // initThread = RT_NULL; @@ -729,6 +733,7 @@ void initTT() return; } set3SRTC(); + setWorkSta(1); initThread = rt_thread_create("initTT", initTT_thread_entry, RT_NULL, 1024 * 5, 25, 10); /* 创建成功则启动线程 */ if (initThread != RT_NULL) diff --git a/applications/func/func.c b/applications/func/func.c index 985680c..59aa5a4 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -1783,6 +1783,23 @@ void updateSysRTC(uint8_t *din, size_t len) } } +/** + * TT工作后设置状态,用于系统崩溃后恢复 + * @param flag + */ +void setWorkSta(int flag) +{ + set_cfg("isWorking", flag); +} +/** + * 是否需要恢复现场 + * @return + */ +int isNeedRestore(void) +{ + return get_cfg("isWorking"); +} + #define FUNC_DEMO #ifdef FUNC_DEMO //测试时导出命令到控制台 From ff29dd3106d82e62c8f0c4d6f2173ca250a453b4 Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Sun, 10 Sep 2023 17:16:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/func/func.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/func/func.c b/applications/func/func.c index 59aa5a4..c97368f 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -1797,7 +1797,11 @@ void setWorkSta(int flag) */ int isNeedRestore(void) { - return get_cfg("isWorking"); + int rst = get_cfg("isWorking"); + if (rst) { + LOG_W("restoring TT after crash"); + } + return rst; } #define FUNC_DEMO