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; }