diff --git a/app/include/common.h b/app/include/common.h index 03e430f..a7196a5 100755 --- a/app/include/common.h +++ b/app/include/common.h @@ -124,6 +124,7 @@ typedef enum _BOOT_MSG BOOT_PPP_FOUND_CSG_LINK_FAIL, BOOT_PPP_FOUND_MQTT_LINK_FAIL, BOOT_TTYUSB_NO_FOUND, + BOOT_RUN_OVER_24_HOURS, BOOT_MAX, } BOOT_MSG; diff --git a/app/include/process.h b/app/include/process.h index 3e80713..41d2e07 100755 --- a/app/include/process.h +++ b/app/include/process.h @@ -51,7 +51,6 @@ typedef enum /* Extern global variables ---------------------------------------------------*/ extern int32_t recv_qid; extern uint16_t version_hex; -extern uint32_t start_time; /* Exported macro ------------------------------------------------------------*/ diff --git a/app/lib/a_process/process.c b/app/lib/a_process/process.c index 7a6de68..b52e7b0 100755 --- a/app/lib/a_process/process.c +++ b/app/lib/a_process/process.c @@ -72,7 +72,6 @@ /* Private variables ---------------------------------------------------------*/ int32_t recv_qid; uint16_t version_hex; -uint32_t start_time; sys_ctrl_t sysctrl = {0}; /* Private function prototypes -----------------------------------------------*/ @@ -187,7 +186,6 @@ int32_t main(int32_t argc, char **argv) /* 点 RUN 灯. */ GPIO_RUN_LED(cnt & 0x1); - start_time++; cnt++; sleep(1); @@ -198,6 +196,12 @@ int32_t main(int32_t argc, char **argv) usleep(100*1000); GPIO_WDT_CTRL(0); } + + time_t curTime = time(NULL); + if (CPUMS_DIFF(sysctrl.start_time, curTime) >= 86400) + { + reboot_system(LOG_DEFAULT, BOOT_RUN_OVER_24_HOURS); + } } return 0; diff --git a/app/lib/m_management/common.c b/app/lib/m_management/common.c index a43fccb..e9cd1ef 100755 --- a/app/lib/m_management/common.c +++ b/app/lib/m_management/common.c @@ -609,6 +609,7 @@ boot_msg_t g_bootmsg[] = {BOOT_PPP_FOUND_CSG_LINK_FAIL, "ppp0 found but csg link failed."}, {BOOT_PPP_FOUND_MQTT_LINK_FAIL, "ppp0 found but mqtt link failed."}, {BOOT_TTYUSB_NO_FOUND, "/dev/ttyUSB3 not found."}, + {BOOT_RUN_OVER_24_HOURS, "The device has been running for more than 24 hours and needs to be restarted."}, {BOOT_MAX, NULL} }; diff --git a/build/Makefile b/build/Makefile index 0d7e3a2..ae41bfe 100755 --- a/build/Makefile +++ b/build/Makefile @@ -31,7 +31,7 @@ VERSION_FILE := $(SOURCE_DIR)/include/version.h MQTTLIB_DIR := $(SOURCE_DIR)/lib/l_library VERSION_LIB := version.a DATE_STRING := `date "+%Y.%m.%d %k:%M:%S"` -VERSION_STRING := "6.2.1.15" +VERSION_STRING := "6.2.1.16" MV := mv -f RM := rm -rf