ADD 1.增加运行超过24小时就重启;

main
wangbo 1 year ago
parent 5418426527
commit 262a2061be

@ -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;

@ -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 ------------------------------------------------------------*/

@ -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;

@ -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}
};

@ -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

Loading…
Cancel
Save