Skip to content

Commit 6bb4985

Browse files
committed
Use real current for li-ion estimation.
1 parent aa978ff commit 6bb4985

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libbattery.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ static inline int fuel_level_LiIon(int mV, int mA, int mOhm)
105105

106106
double battery_estimate(struct battery_info *i)
107107
{
108-
int mA;
108+
int mA = 100;
109109

110-
mA = 100;
110+
if (!isnan(i->current)) {
111+
mA = i->current * 1000;
112+
printf("Have current %d mA\n", mA);
113+
}
111114

112115
return fuel_level_LiIon(i->voltage * 1000, mA, 50) / 100.;
113116
}

0 commit comments

Comments
 (0)