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 //测试时导出命令到控制台