From: 1624952103 Date: Thu, 26 Mar 2026 10:40:58 +0000 (+0800) Subject: 增加电池信息电压 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3313%2F2;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 cbd01b580..fb9010be6 100644 --- a/code/sdk/zhihui/services/battery/service/battery_driver.cpp +++ b/code/sdk/zhihui/services/battery/service/battery_driver.cpp @@ -774,6 +774,32 @@ static int battery_get_percent_by_voltage(float voltage) // ====================================================================== float temp_value = 0.0f; + // // ===================== 只打印当前使用的数组 ===================== + static bool print_flag = false; + if(!print_flag) + { + print_flag = true; + printf("==== 当前使用的电池电压映射表 ====\n"); + if(get_charge_stat()) + { + printf("==== 充电模式 battery_charge_percent_map ====\n"); + } + else + { + printf("==== 非充电模式 battery_percent_map ====\n"); + } + + for(int i=0; i percent && abs(history_percent - percent) < 10) @@ -848,16 +884,15 @@ static int battery_get_percent_by_voltage(float voltage) if (voltage <= batteryservice_VOLTAGE_MIN) percent = 0; - if (voltage >= batteryservice_VOLTAGE_MAX) //电压大于4.3 + if (voltage >= batteryservice_VOLTAGE_MAX) { - if(get_charge_stat() && history_percent < 100 && history_percent) //充电中则均匀增加 + if(get_charge_stat() && history_percent < 100 && history_percent) { printf("111 history_percent:%d ,percent : %d ,voltage:%.3f \n",history_percent,percent,voltage); - // uapi_save_runtime_log(RUNTIME_LOG_BATTERY_MIN_UP); history_percent++; percent = history_percent; } - else if(!get_charge_stat() && history_percent) //未充电且history_percent不为0 则保持不变 + else if(!get_charge_stat() && history_percent) { printf("222 history_percent:%d ,percent : %d ,voltage:%.3f \n",history_percent,percent,voltage); percent = history_percent; @@ -870,11 +905,9 @@ static int battery_get_percent_by_voltage(float voltage) } } - return percent; } - static uint32_t get_current_timestamp(void) { uint32_t timestamp = 0;