remove the UP_DEVICE_SUPPLY_CHARGED_THRESHOLD heuristic

When a full battery starts to discharge, but reports its status as 'Unknown',
it takes a few minutes before g-p-m notices any change.
upowerd guesses the battery is fully charged as long as it has over 90% charge.

I see no reason to delay the reporting of discharging of the battery.
Let's remove this heuristic.

Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
Michal Schmidt 2010-10-12 14:42:35 +02:00 committed by Richard Hughes
parent 5387183d53
commit e76b05967b

View file

@ -42,7 +42,6 @@
#define UP_DEVICE_SUPPLY_REFRESH_TIMEOUT 30 /* seconds */
#define UP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT 2 /* seconds */
#define UP_DEVICE_SUPPLY_UNKNOWN_RETRIES 30
#define UP_DEVICE_SUPPLY_CHARGED_THRESHOLD 90.0f /* % */
#define UP_DEVICE_SUPPLY_COLDPLUG_UNITS_CHARGE TRUE
#define UP_DEVICE_SUPPLY_COLDPLUG_UNITS_ENERGY FALSE
@ -603,13 +602,6 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
percentage = 100.0f;
}
/* some batteries stop charging much before 100% */
if (state == UP_DEVICE_STATE_UNKNOWN &&
percentage > UP_DEVICE_SUPPLY_CHARGED_THRESHOLD) {
egg_debug ("fixing up unknown %f", percentage);
state = UP_DEVICE_STATE_FULLY_CHARGED;
}
/* the battery isn't charging or discharging, it's just
* sitting there half full doing nothing: try to guess a state */
if (state == UP_DEVICE_STATE_UNKNOWN) {