1.修改电池公式
This commit is contained in:
parent
022af3dd8c
commit
b45455d933
|
@ -104,7 +104,7 @@ UINT32 sf_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin, UI
|
|||
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 511;
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 2696;
|
||||
volt = (27 * adcVal + 3097) / 531;
|
||||
volt = (27 * adcVal + 554) / 539;
|
||||
return volt;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ UINT32 sf_aa_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin,
|
|||
*/
|
||||
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 511;
|
||||
volt = (27 * adcVal + 554) / 539;
|
||||
volt = (27 * adcVal + 3097) / 531;
|
||||
return volt;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ UINT32 sf_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin, UIN
|
|||
|
||||
//adcVal = volt * resistanceGnd * 511 / 27 / (resistanceGnd + resistanceVin);
|
||||
//adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin);
|
||||
adcVal = (volt * 531 - 3097) / 27;
|
||||
adcVal = (volt * 539 - 554) / 27;
|
||||
return adcVal;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ UINT32 sf_aa_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin,
|
|||
|
||||
//adcVal = volt * resistanceGnd * 511 / 27 / (resistanceGnd + resistanceVin);
|
||||
//adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin);
|
||||
adcVal = (volt * 539 - 554) / 27;
|
||||
adcVal = (volt * 531 - 3097) / 27;
|
||||
return adcVal;
|
||||
}
|
||||
UINT32 sf_get_max_value(UINT32 *_ValueList)
|
||||
|
|
|
@ -108,7 +108,7 @@ UINT32 sf_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin, UI
|
|||
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 511;
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 2696;
|
||||
volt = (27 * adcVal + 3097) / 531;
|
||||
volt = (27 * adcVal + 554) / 539;
|
||||
return volt;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ UINT32 sf_aa_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin,
|
|||
*/
|
||||
|
||||
//volt = 27 * adcVal * (resistanceGnd + resistanceVin) / resistanceGnd / 511;
|
||||
volt = (27 * adcVal + 554) / 539;
|
||||
volt = (27 * adcVal + 3097) / 531;
|
||||
return volt;
|
||||
}
|
||||
|
||||
|
@ -140,16 +140,17 @@ UINT32 sf_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin, UIN
|
|||
|
||||
//adcVal = volt * resistanceGnd * 511 / 27 / (resistanceGnd + resistanceVin);
|
||||
//adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin);
|
||||
adcVal = (volt * 531 - 3097) / 27;
|
||||
adcVal = (volt * 539 - 554) / 27;
|
||||
return adcVal;
|
||||
}
|
||||
|
||||
UINT32 sf_aa_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin, UINT32 volt)
|
||||
{
|
||||
UINT32 adcVal = 0;
|
||||
|
||||
//adcVal = volt * resistanceGnd * 511 / 27 / (resistanceGnd + resistanceVin);
|
||||
//adcVal = volt * resistanceGnd * 2696 / 27 / (resistanceGnd + resistanceVin);
|
||||
adcVal = (volt * 539 - 554) / 27;
|
||||
adcVal = (volt * 531 - 3097) / 27;
|
||||
return adcVal;
|
||||
}
|
||||
UINT32 sf_get_max_value(UINT32 *_ValueList)
|
||||
|
@ -1674,10 +1675,7 @@ void sf_BatteryInfoSave(char *name, FST_FILE fd)
|
|||
close(fd);
|
||||
printf("Add Success st_size:%ld\n", st.st_size);
|
||||
*/
|
||||
ret_fs = FileSys_SeekFile(fd, 0, FST_SEEK_END);
|
||||
if (ret_fs != FST_STA_OK) {
|
||||
printf("%s:%d seek file failed\r\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
size = strlen(tmpBuf);
|
||||
printf("%s:%d size:%lu\r\n", __FUNCTION__, __LINE__, size);
|
||||
ret_fs = FileSys_WriteFile(fd, (UINT8*)tmpBuf, &size, 0, NULL);
|
||||
|
|
Loading…
Reference in New Issue
Block a user