From acce179c49a6a9c625e9402e6f9046d1325ffcea Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期三, 26 二月 2025 18:04:26 +0800 Subject: [PATCH] 初步写完键盘驱动和串口初始化 --- keil/include/src/gps.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/keil/include/src/gps.c b/keil/include/src/gps.c index 82c4676..82a9ced 100644 --- a/keil/include/src/gps.c +++ b/keil/include/src/gps.c @@ -1,15 +1,15 @@ #include "board.h" #include "HIDO_Util.h" #include "global_param.h" -#define GPS_OPEN_TIME_OUT 48 //1分钟开启 +#define GPS_OPEN_TIME_OUT 120 //1分钟开启 #define GPS_RESTART_TIME1 480 //10分钟 #define GPS_RESTART_TIME2 48 //1分钟 #define GPS_RESTART_TIME3 30 //30s extern uint16_t gps_wait_count,g_com_map[COM_MAP_SIZE]; extern uint8_t flag_first_TCPconnect; -uint16_t gps_wait_count2; +extern uint16_t gps_wait_count2; uint16_t g_spsum,g_snum,ave_sp; -uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag,gps_timeout_flag,gps_need_data_flag = 1,gps_open_flag; +uint8_t gps_power_state,gps_uwb_flag,gps_4g_flag,gps_timeout_flag,gps_need_data_flag = 1,gps_open_flag,gps_first_flag=1; void GPS_Poll(void) { @@ -77,12 +77,15 @@ } void Gps_change(void) { -if(gps_open_flag){ + if(gps_open_flag){ if(gps_need_data_flag) { gps_power_state = 1; //打开GPS电源 gps_wait_count++; - if(gps_wait_count>=g_com_map[SEND_4G_SECOND]) { //超时切换工作状态 + if(gps_wait_count>34) + gps_first_flag=0;//新加入第一次开启 + if(gps_wait_count>=GPS_OPEN_TIME_OUT) { //超时切换工作状态 + gps_timeout_flag=1;//串口添加改变timeout逻辑 gps_wait_count=0; gps_need_data_flag=0;//切换为关闭模式 @@ -113,6 +116,15 @@ update_led_power_state(); } +void gps_power_on(void) +{ + gpio_pin_set_dir(GPS_Power_Pin , GPIO_DIR_OUT, 1); +} +void gps_power_down(void) +{ + gpio_pin_set_dir(GPS_Power_Pin , GPIO_DIR_OUT, 0); +} + HIDO_INT32 GPS_ParseGSV(HIDO_CHAR *_pcData, HIDO_UINT32 _u32Len) { HIDO_DataStruct spower[4]; -- Gitblit v1.9.3