1.对bat检测进行补偿
This commit is contained in:
parent
4ba93de949
commit
23f4de153d
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user