From 50bba4559b0c7846613efd6bf9ec8a9c3b1982ce Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期二, 18 二月 2025 16:59:11 +0800 Subject: [PATCH] 移植了外国sx1268lora模块代码。等板子再调,刚把error解决 --- keil/include/src/gps.c | 26 +++++++++----------------- 1 files changed, 9 insertions(+), 17 deletions(-) diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c index f93df90..9121dd0 100644 --- a/keil/include/src/gps.c +++ b/keil/include/src/gps.c @@ -7,17 +7,13 @@ 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) - { - - if(!gps_timeout_flag) - { - if(gps_need_data_flag) - { - gps_power_state = 1; //打开GPS电源 + + if(gps_4g_flag||gps_uwb_flag) { + gps_power_state = 1; //打开GPS电源 + if(!gps_timeout_flag) { + if(gps_need_data_flag) { 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;//切换为关闭模式 @@ -25,20 +21,16 @@ } 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) - { - gps_power_state = 1; //打开GPS电源 + if(gps_need_data_flag) { 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