From 9844ed8dd3438e5deaba146477b80fd2115196b7 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 19 二月 2025 14:54:41 +0800 Subject: [PATCH] 3.4,提前了看门狗 电量小于1%直接关机 --- APL/App.c | 59 +++++++++++++++++++++++++++++------------------------------ 1 files changed, 29 insertions(+), 30 deletions(-) diff --git a/APL/App.c b/APL/App.c index d6567af..4c97afd 100644 --- a/APL/App.c +++ b/APL/App.c @@ -195,7 +195,7 @@ //deca_sleep(1000); g_com_map[GROUP_ID]=3; - g_com_map[VERSION] = (3<<8)|1; + g_com_map[VERSION] = (3<<8)|4; if (g_com_map[COM_INTERVAL] <50) { @@ -290,7 +290,7 @@ uwbled=WHITE; loraled=WHITE; powerled=WHITE; - + Set4LEDColor(uwbled,gpsled,loraled,powerled); if(HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_12)==0) { powercount = 0; @@ -298,7 +298,7 @@ while(1) { - if((HIDO_TimerGetTick() - l_u32QXpowerTick) >=100) +// if((HIDO_TimerGetTick() - l_u32QXpowerTick) >=100) { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); @@ -379,6 +379,8 @@ loraled = 1; HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET); } +extern uint8_t ledonflag; +extern uint32_t ledontime; void PowerLedTask(void) { static u8 powerled_state=0; @@ -447,36 +449,27 @@ chargedbg_flag = 0; } - if(HIDO_TimerGetTick()%1000<50 ) + if(HIDO_TimerGetTick()-ledontime>100&&ledonflag==1) { -// if(powerled_state==0) + ledonflag=0; + Set4LEDColor_Off(); + } +// else // { -////// if(bat_percent>15) -////// { -////// powerled = BLUE; -////// }else{ -////// powerled = RED; -////// } -// powerled_state = 1; -//// // bat_percent = Battery_GetPercentage(); -////// Set4LEDColor(uwbled,gpsled,loraled,powerled); -// } - }else - { -// if(powerled_state) - { - powerled_state = 0; -// powerled = LEDOFF; -// uwbled = LEDOFF; -// gpsled = LEDOFF; -// loraled = LEDOFF; -// Set4LEDColor(uwbled,gpsled,loraled,powerled); - Set4LEDColor_Off(); - } - - } +//// if(powerled_state) +// { +// powerled_state = 0; +//// powerled = LEDOFF; +//// uwbled = LEDOFF; +//// gpsled = LEDOFF; +//// loraled = LEDOFF; +//// Set4LEDColor(uwbled,gpsled,loraled,powerled); +// Set4LEDColor_Off(); +// } +// +// } - + if(HIDO_TimerGetTick()-adctick>6000) //10分钟采样一次 电量 { adctick = HIDO_TimerGetTick(); @@ -505,6 +498,12 @@ } } } + if(bat_percent<=1) + { + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET); + } } extern uint32_t main_time; -- Gitblit v1.9.3