From 2c4086173a8915035aee593d16b3ea7edc6f5c15 Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期二, 10 九月 2024 18:14:35 +0800
Subject: [PATCH] 初版仅gps1h上报加4G休眠,去掉uwb振动等

---
 keil/include/src/gps.c |   66 +++++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c
index f93df90..cd7bfa0 100644
--- a/keil/include/src/gps.c
+++ b/keil/include/src/gps.c
@@ -1,23 +1,24 @@
 #include "board.h"
+#include "TCPClient.h"
+#include "global_param.h"
 #define GPS_OPEN_TIME_OUT  240
 #define GPS_RESTART_TIME1  1200
 #define GPS_RESTART_TIME2  120
-
+#define GPS_RESTART_TIME3  3600
+#define GPS_OPEN_TIME_OUT1 60
 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;
+uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag,gps_timeout_flag,gps_need_data_flag = 1,gps_1h_open_flag=1;
+extern HIDO_INT32 l_i32TCPClientID;
+extern double jd,wd;
 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 +26,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;
@@ -61,6 +58,37 @@
         gps_need_data_flag=1;
     }
 }
+
+
+void GPS_Poll_1h(void)
+{
+
+    if(gps_1h_open_flag) {
+        gps_power_state = 1;  //打开GPS电源
+            if(gps_need_data_flag) {
+                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;
+        gps_timeout_flag=0;
+        gps_need_data_flag=1;
+    }
+}
 void GpsConrol(uint8_t flag_4g_uwb,uint8_t open_close)
 {
     if(gps_4g_flag==0&&gps_uwb_flag==0)

--
Gitblit v1.9.3