From 2e7e22e3a8fdd2dfbbf9b4e1dd92b96cbf96868b Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期三, 04 九月 2024 11:06:06 +0800 Subject: [PATCH] 调4G休眠唤醒功能,还有BUG --- keil/include/src/gps.c | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c index 94770f2..f93df90 100644 --- a/keil/include/src/gps.c +++ b/keil/include/src/gps.c @@ -4,16 +4,20 @@ #define GPS_RESTART_TIME2 120 extern uint16_t gps_wait_count; -uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag = 1,gps_timeout_flag,gps_need_data_flag = 1; +uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag,gps_timeout_flag,gps_need_data_flag = 1; void GPS_Poll(void) { - - if(gps_4g_flag||gps_uwb_flag) { - gps_power_state = 1; //打开GPS电源 - if(!gps_timeout_flag) { - if(gps_need_data_flag) { + if(gps_4g_flag||gps_uwb_flag) + { + + if(!gps_timeout_flag) + { + if(gps_need_data_flag) + { + gps_power_state = 1; //打开GPS电源 gps_wait_count++; - if(gps_wait_count>=GPS_OPEN_TIME_OUT) { //超时切换工作状态 + if(gps_wait_count>=GPS_OPEN_TIME_OUT) + { //超时切换工作状态 gps_timeout_flag=1;//串口添加改变timeout逻辑 gps_wait_count=0; gps_need_data_flag=0;//切换为关闭模式 @@ -21,16 +25,20 @@ } else { gps_wait_count++; gps_power_state=0;//关闭GPS - if(gps_wait_count>GPS_RESTART_TIME2) { + if(gps_wait_count>GPS_RESTART_TIME2) + { gps_power_state=1;//开启GPS gps_need_data_flag=1; gps_wait_count=0; } } } else { //超时工作状态 - if(gps_need_data_flag) { + if(gps_need_data_flag) + { + gps_power_state = 1; //打开GPS电源 gps_wait_count++; - if(gps_wait_count>=GPS_OPEN_TIME_OUT) { //超时切换工作状态 + if(gps_wait_count>=GPS_OPEN_TIME_OUT) + { //超时切换工作状态 gps_timeout_flag=1; gps_need_data_flag=0; gps_wait_count=0; -- Gitblit v1.9.3