Cap battery at 100%.

Apparently invalid results can be returned by buggy drivers in old laptops,
as reported by @thukydides. See #596.
This commit is contained in:
Hisham 2017-02-15 22:47:03 -02:00
parent 8af4d9f453
commit bb8dec1582

View File

@ -310,6 +310,9 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
*level = -1;
*isOnAC = AC_ERROR;
}
if (*level > 100.0) {
*level = 100.0;
}
Battery_cacheLevel = *level;
Battery_cacheIsOnAC = *isOnAC;
Battery_cacheTime = now;