From 9b59e87d8280de129c18421b5d12cf96d0ea904e Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 03 九月 2024 10:28:06 +0800 Subject: [PATCH] V1.6 给客户测试 --- keil/include/src/gps.c | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c index 9121dd0..f93df90 100644 --- a/keil/include/src/gps.c +++ b/keil/include/src/gps.c @@ -7,13 +7,17 @@ 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