From dcfa7fb0b7a336114597ec665e33c7c3cb98d917 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 24 九月 2024 18:51:52 +0800 Subject: [PATCH] 修改UDP断线重启4G模块 --- keil/include/src/gps.c | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-) diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c index e02ad9f..67b4889 100644 --- a/keil/include/src/gps.c +++ b/keil/include/src/gps.c @@ -4,7 +4,7 @@ #define GPS_OPEN_TIME_OUT 240 #define GPS_RESTART_TIME1 1200 #define GPS_RESTART_TIME2 120 -#define GPS_RESTART_TIME3 60 +#define GPS_RESTART_TIME3 3600 #define GPS_OPEN_TIME_OUT1 600 extern uint16_t gps_wait_count; uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag,gps_timeout_flag,gps_need_data_flag = 1,gps_1h_open_flag=1; @@ -65,27 +65,27 @@ { if(gps_1h_open_flag) { - - if(gps_need_data_flag) { - gps_power_state = 1; //打开GPS电源 - air780_success_state=1;//4G亮起 - gps_wait_count++; - if(gps_wait_count>=GPS_OPEN_TIME_OUT1) { //超时切换工作状态 - gps_timeout_flag=1;//串口添加改变timeout逻辑 - gps_wait_count=0; - gps_need_data_flag=0;//切换为关闭模式 - TCPHeartBeatUpload();//上传GPS超时无效数据 - } - } else { - gps_wait_count++; - gps_power_state=0;//关闭GPS - air780_success_state=0;//关闭gps1234 - if(gps_wait_count>GPS_RESTART_TIME3) { - gps_power_state=1;//开启GPS - gps_need_data_flag=1; - gps_wait_count=0; - } + + if(gps_need_data_flag) { + gps_power_state = 1; //打开GPS电源 + + gps_wait_count++; + if(gps_wait_count>=GPS_OPEN_TIME_OUT1) { //超时切换工作状态 + gps_timeout_flag=1;//串口添加改变timeout逻辑 + gps_wait_count=0; + gps_need_data_flag=0;//切换为关闭模式 + TCPHeartBeatUpload();//上传GPS超时无效数据 } + } else { + gps_wait_count++; + gps_power_state=0;//关闭GPS + + if(gps_wait_count>GPS_RESTART_TIME3) { + gps_power_state=1;//开启GPS + gps_need_data_flag=1; + gps_wait_count=0; + } + } } else { gps_power_state=0;//关闭gps gps_wait_count=0; -- Gitblit v1.9.3