summaryrefslogtreecommitdiffstats
path: root/src/hardware_battery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hardware_battery.cpp')
-rw-r--r--src/hardware_battery.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/hardware_battery.cpp b/src/hardware_battery.cpp
index ac18b52..2e60fb7 100644
--- a/src/hardware_battery.cpp
+++ b/src/hardware_battery.cpp
@@ -94,7 +94,7 @@ void Battery::initDefault() {
state = BAT_NORM;
capacity_state = "ok";
charging_state = UNKNOWN_STATE;
- charge_level_unit = "mWh";
+ charge_level_unit = "Ah";
charge_level_current = 0;
charge_level_lastfull = 0;
charge_level_percentage = 0;
@@ -461,16 +461,18 @@ bool Battery::checkChargeLevelRate () {
return false;
}
- int _rate = present_rate;
+ double _rate = present_rate;
- // FIXME VERIFY CORRECTNESS
- // what does tdepowersave expect to see in present_rate (battery.charge_level.rate)?
- present_rate = bdevice->dischargeRate();
+ // Note that the units used for charge_level_unit and present_rate_unit
+ // are different. This is intentionally because the battery charge
+ // values are in Ah while the power consumption is displayed in W.
+ present_rate = bdevice->dischargeRate()*bdevice->voltage();
if (present_rate < 0 )
present_rate = 0;
- if (present_rate != _rate)
+ if (present_rate != _rate) {
emit changedBattery();
+ }
kdDebugFuncOut(trace);
return true;
@@ -839,7 +841,7 @@ int Battery::getRemainingMinutes() const {
}
//! current charging/discharging rate
-int Battery::getPresentRate() const {
+double Battery::getPresentRate() const {
return present_rate;
}