优化充电ic参数设置DPM 优化满电判断(补充) 3413/2 3413/head
author1624952103 <pl@DESKTOP-EN9LKR5.localdomain>
Thu, 14 May 2026 01:52:51 +0000 (09:52 +0800)
committer1624952103 <pl@DESKTOP-EN9LKR5.localdomain>
Thu, 14 May 2026 01:52:51 +0000 (09:52 +0800)
code/sdk/zhihui/services/battery/service/battery_driver.cpp

index ef6fd38..30b4f61 100644 (file)
@@ -768,7 +768,7 @@ static uint8_t battery_get_power_percentage(void)
 
 #ifdef ENABLE_HP4570
 
-static bool hp4570_check_charge_done(float voltage, uint8_t *percent)
+static bool hp4570_check_charge_done(float voltage, int *percent)
 {
     static float s_hp4570_chg_done_last_v = -1.0f;
     static uint8_t s_hp4570_chg_done_flat_cnt = 0;
@@ -802,7 +802,7 @@ static bool hp4570_check_charge_done(float voltage, uint8_t *percent)
 
     if (s_hp4570_chg_done_flat_cnt >= HP4570_CHG_DONE_FLAT_STREAK && history_percent < 100) {
         history_percent++;
-        *io_percent = history_percent;
+        *percent = history_percent;
         printf("[电池计算] HP4570 CHG_DONE+>=%.1fV 连续电压不升 cnt=%u(>=%u) -> 累加 %% hist=%d\n",
             HP4570_CHG_DONE_MIN_VOLTAGE_V,
             (unsigned int)s_hp4570_chg_done_flat_cnt, (unsigned int)HP4570_CHG_DONE_FLAT_STREAK, history_percent);