From 51393af87f6dc09a00e78d71dbff8a15721c1198 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 18 二月 2025 10:29:46 +0800 Subject: [PATCH] V1.9 增加看门狗 --- APL/APL.c | 92 +++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 45 deletions(-) diff --git a/APL/APL.c b/APL/APL.c index fc052b8..17efae9 100644 --- a/APL/APL.c +++ b/APL/APL.c @@ -233,52 +233,52 @@ void PowerLedTask(void) { static u8 powerled_state=0; - if(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) - { - chongman_time=0; - only_one_flag=0; - if(!power_state&&!chargedbg_flag) - { - CloseRTK4G(); - DBG_SetMode(DBG_MODE_CHARGE); - power_state = 1; - } - while(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)&&DBG_GetMode() == DBG_MODE_CHARGE) - { - if(HIDO_TimerGetTick()-adctick>6000) //6s采样一次 电量 - { - adctick = HIDO_TimerGetTick(); - chongman_time=chongman_time+6; - #ifdef BATTARY_DEBUG - //printf("电压: %f V,电量 %d,标志位%d,时间 %d\r\n",fVoltage1,bat_percent2,only_one_flag,chongman_time); - #endif - if( HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_10)) - { - bat_percent2=Power_GetBatteryPercentage(); +// if(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) +// { +// chongman_time=0; +// only_one_flag=0; +// if(!power_state&&!chargedbg_flag) +// { +// CloseRTK4G(); +// DBG_SetMode(DBG_MODE_CHARGE); +// power_state = 1; +// } +// while(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)&&DBG_GetMode() == DBG_MODE_CHARGE) +// { +// if(HIDO_TimerGetTick()-adctick>6000) //6s采样一次 电量 +// { +// adctick = HIDO_TimerGetTick(); +// chongman_time=chongman_time+6; +// #ifdef BATTARY_DEBUG +// //printf("电压: %f V,电量 %d,标志位%d,时间 %d\r\n",fVoltage1,bat_percent2,only_one_flag,chongman_time); +// #endif +// if( HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_10)) +// { +// bat_percent2=Power_GetBatteryPercentage(); - }else{ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET); - bat_percent2=Power_GetBatteryPercentage(); - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); - } - } - if(fVoltage1>=4.15&&!only_one_flag) - { - only_one_flag=1; - chongman_time=0; - } - if(fVoltage1>=4.15&&chongman_time>=1800) - { - powerled = GREEN; - }else{ - powerled = RED; - } - delay_ms(100); - DBG_Poll(); - Internet_Poll(); - Set4LEDColor(0,0,0,powerled); - } - } +// }else{ +// HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET); +// bat_percent2=Power_GetBatteryPercentage(); +// HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); +// } +// } +// if(fVoltage1>=4.15&&!only_one_flag) +// { +// only_one_flag=1; +// chongman_time=0; +// } +// if(fVoltage1>=4.15&&chongman_time>=1800) +// { +// powerled = GREEN; +// }else{ +// powerled = RED; +// } +// delay_ms(100); +// DBG_Poll(); +// Internet_Poll(); +// Set4LEDColor(0,0,0,powerled); +// } +// } chargeon = 0; if(power_state) @@ -466,9 +466,11 @@ } +extern IWDG_HandleTypeDef hiwdg; uint8_t udp_uwbenable = 1,uwb_state; void APL_Poll(void) { + HAL_IWDG_Refresh(&hiwdg); APLPollTask(); if(uwb_state!=udp_uwbenable) -- Gitblit v1.9.3