From 23f4de153de8ffdd037ea374b6e0570ea7dc0c4c Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 28 Dec 2023 10:38:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AF=B9bat=E6=A3=80=E6=B5=8B=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=A1=A5=E5=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/source/battery/sf_battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/application/source/sf_app/code/source/battery/sf_battery.c b/code/application/source/sf_app/code/source/battery/sf_battery.c index 61287a9e7..14318a85c 100755 --- a/code/application/source/sf_app/code/source/battery/sf_battery.c +++ b/code/application/source/sf_app/code/source/battery/sf_battery.c @@ -133,7 +133,7 @@ UINT32 sf_aa_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin, //volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 511; if(adcVal) { - volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 2696; + volt = 27 * (adcVal + 136) * (resistanceGnd + resistanceVin) / resistanceGnd / 2696;//compensate 136 //volt = (27 * adcVal + 3097) / 531; } return volt; @@ -162,7 +162,7 @@ UINT32 sf_aa_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin, if(volt) { //adcVal = (volt * 531 - 3097) / 27; - adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin); + adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin) - 136;//compensate 136 } return adcVal; }