From 218d8ca9ab1885489bc3556726b5e6a239b4eef0 Mon Sep 17 00:00:00 2001 From: Caisking Date: Mon, 9 Mar 2026 16:41:52 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E7=94=B5=E9=87=8F=E5=88=A4?= =?utf8?q?=E6=96=AD=EF=BC=8C=E4=B8=8D=E7=AD=9B=E9=80=89=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../services/battery/service/battery_driver.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/sdk/zhihui/services/battery/service/battery_driver.cpp b/code/sdk/zhihui/services/battery/service/battery_driver.cpp index 2432bd002..c0c201dd4 100644 --- a/code/sdk/zhihui/services/battery/service/battery_driver.cpp +++ b/code/sdk/zhihui/services/battery/service/battery_driver.cpp @@ -544,15 +544,16 @@ void battery_restore_vol(void) uapi_get_file_data("/user/userdata/battery.bin",(uint8_t *)&bat_vol,&len); - uapi_get_timestampe_ss(&time); + /* 不再用时间戳判断是否过期,仅依赖电压接近度决定是否采用历史电量,避免 RTC 异常时误弃用有效数据 */ + // uapi_get_timestampe_ss(&time); - printf("time:%d,l_time:%d\n",time,bat_vol.time ); - if(time - bat_vol.time >= 24 * 60 * 60) - { - memset_s(&bat_vol,sizeof(BAT_VOL_T),0,sizeof(BAT_VOL_T)); - bat_vol.right = -1; - return; - } + // printf("time:%d,l_time:%d\n",time,bat_vol.time ); + // if(time - bat_vol.time >= 24 * 60 * 60) + // { + // memset_s(&bat_vol,sizeof(BAT_VOL_T),0,sizeof(BAT_VOL_T)); + // bat_vol.right = -1; + // return; + // } if(bat_vol.vol_num < 0 || bat_vol.vol_num > AVG_VOLTAGE_COUNT || bat_vol.right < -1 || bat_vol.right >= AVG_VOLTAGE_COUNT || -- 2.17.1