From: 1624952103 Date: Mon, 9 Feb 2026 02:01:27 +0000 (+0800) Subject: 优化低电电压跳变 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=087a29da3eb95d2cc149535498b10e06e39bc7db;p=mirrors%2FFD230.git 优化低电电压跳变 --- diff --git a/code/sdk/zhihui/services/battery/service/battery_driver.cpp b/code/sdk/zhihui/services/battery/service/battery_driver.cpp index 7081bf72a..88c350aa2 100644 --- a/code/sdk/zhihui/services/battery/service/battery_driver.cpp +++ b/code/sdk/zhihui/services/battery/service/battery_driver.cpp @@ -565,8 +565,12 @@ void battery_restore_vol(void) batteryservice_get_voltage_by_channel(&cur_vol,ADC_CHANNEL_BAT_VOLTAGE); - if(bat_vol.percent > 0 && bat_vol.percent<=100 && (fabsf(cur_vol - bat_vol.avg_vol) < 0.25)) - history_percent = bat_vol.percent; + if (bat_vol.percent > 0 && bat_vol.percent <= 100) { + float threshold = get_charge_stat() ? 0.4f : 0.25f; + if (fabsf(cur_vol - bat_vol.avg_vol) < threshold) { + history_percent = bat_vol.percent; + } + } // for(int i = 0; i < AVG_VOLTAGE_COUNT;i++) // { // printf("history_data[%d]:%.3f\n",i,bat_vol.history_data[i]);