From a67b3b6d5fce352aff5f8de413bedc54204dbca2 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期二, 25 二月 2025 11:40:52 +0800 Subject: [PATCH] V1,8,增加看门口防止升级卡死,修改GGA报文中bat_percent为hex显示适配上位机 --- keil/include/main/main.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/keil/include/main/main.c b/keil/include/main/main.c index 0b15249..93dfebc 100644 --- a/keil/include/main/main.c +++ b/keil/include/main/main.c @@ -348,6 +348,7 @@ extern uint16_t ip0,ip1,ip2,ip3,port; extern uint8_t gps_4g_flag; extern uint8_t gps_need_data_flag,gps_open_flag; +uint8_t bat_bercent_hex; void Program_Init(void) { Usart1ParseDataCallback = UsartParseDataHandler;//需改为默认为gps处理,UsartParseDataHandler为升级处理当调试时候改为 @@ -385,7 +386,7 @@ ip2 = (g_com_map[TCP_IP_2]>>12&0xf)*1000+(g_com_map[TCP_IP_2]>>8&0xf)*100+(g_com_map[TCP_IP_2]>>4&0xf)*10+(g_com_map[TCP_IP_2]&0xf); ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf); port = g_com_map[TCP_PORT]; - g_com_map[VERSION] = (1<<8)|7; + g_com_map[VERSION] = (1<<8)|8; LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); LOG_INFO(TRACE_MODULE_APP,"固件版本:4G-GPS定位手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port); @@ -463,6 +464,17 @@ int test1,test3; uint32_t test4; uint32_t time_count; +static void app_wdt_callback(void *dev, uint32_t status) +{ + ASSERT(status, "WDT TIMEOUT,程序复位"); + //LOG_INFO(TRACE_MODULE_APP, "程序卡死,看门狗复位"); +} + struct WDT_CFG_T app_wdt_cfg = { + .timeout = 32768 * 30, + .rst_en = true, + .int_en = true, + .callback = app_wdt_callback, + }; int main(void) { board_clock_run(); @@ -492,6 +504,7 @@ // Disable watchdog timer wdt_close(WDT_ID0); + wdt_open(WDT_ID0,&app_wdt_cfg);//30s检测喂狗 LOG_INFO(TRACE_MODULE_APP, "UWB simple example\r\n"); // open system timer @@ -540,7 +553,7 @@ while (1) { test4=gpio_pin_get_val(SCL_PIN); - + wdt_ping(WDT_ID0);//喂狗 if(!power_low_flag)//确认是否休眠下才开启功能 { if(flag_TCP_reconnectting||IfTCPConnected()) -- Gitblit v1.9.3