mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-02-04 18:50:31 +01:00
battery: Fix power rate checks for amount < 1W
Fix the power rate check, energy_rate is a float, and abs() handles ints, so any rate under 1W would have been truncated to 0.
This commit is contained in:
parent
5db1bce65f
commit
b773285d5e
1 changed files with 1 additions and 1 deletions
|
|
@ -155,7 +155,7 @@ up_device_battery_estimate_power (UpDeviceBattery *self, UpBatteryValues *cur)
|
|||
*/
|
||||
if (cur->state == UP_DEVICE_STATE_UNKNOWN) {
|
||||
/* Consider a rate of 0.5W as "no change", otherwise set CHARGING/DISCHARGING */
|
||||
if (abs(energy_rate) < 0.5)
|
||||
if (ABS(energy_rate) < 0.5)
|
||||
return;
|
||||
else if (energy_rate < 0.0)
|
||||
cur->state = UP_DEVICE_STATE_DISCHARGING;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue