mirror of https://github.com/xzeldon/htop.git
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:
parent
8af4d9f453
commit
bb8dec1582
|
@ -310,6 +310,9 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
|
||||||
*level = -1;
|
*level = -1;
|
||||||
*isOnAC = AC_ERROR;
|
*isOnAC = AC_ERROR;
|
||||||
}
|
}
|
||||||
|
if (*level > 100.0) {
|
||||||
|
*level = 100.0;
|
||||||
|
}
|
||||||
Battery_cacheLevel = *level;
|
Battery_cacheLevel = *level;
|
||||||
Battery_cacheIsOnAC = *isOnAC;
|
Battery_cacheIsOnAC = *isOnAC;
|
||||||
Battery_cacheTime = now;
|
Battery_cacheTime = now;
|
||||||
|
|
Loading…
Reference in New Issue