@ -94,7 +94,7 @@ void Battery::initDefault() {
state = BAT_NORM ;
state = BAT_NORM ;
capacity_state = " ok " ;
capacity_state = " ok " ;
charging_state = UNKNOWN_STATE ;
charging_state = UNKNOWN_STATE ;
charge_level_unit = " mW h" ;
charge_level_unit = " A h" ;
charge_level_current = 0 ;
charge_level_current = 0 ;
charge_level_lastfull = 0 ;
charge_level_lastfull = 0 ;
charge_level_percentage = 0 ;
charge_level_percentage = 0 ;
@ -461,16 +461,18 @@ bool Battery::checkChargeLevelRate () {
return false ;
return false ;
}
}
int _rate = present_rate ;
double _rate = present_rate ;
// FIXME VERIFY CORRECTNESS
// Note that the units used for charge_level_unit and present_rate_unit
// what does tdepowersave expect to see in present_rate (battery.charge_level.rate)?
// are different. This is intentionally because the battery charge
present_rate = bdevice - > dischargeRate ( ) ;
// values are in Ah while the power consumption is displayed in W.
present_rate = bdevice - > dischargeRate ( ) * bdevice - > voltage ( ) ;
if ( present_rate < 0 )
if ( present_rate < 0 )
present_rate = 0 ;
present_rate = 0 ;
if ( present_rate ! = _rate )
if ( present_rate ! = _rate ) {
emit changedBattery ( ) ;
emit changedBattery ( ) ;
}
kdDebugFuncOut ( trace ) ;
kdDebugFuncOut ( trace ) ;
return true ;
return true ;
@ -839,7 +841,7 @@ int Battery::getRemainingMinutes() const {
}
}
//! current charging/discharging rate
//! current charging/discharging rate
int Battery : : getPresentRate ( ) const {
double Battery : : getPresentRate ( ) const {
return present_rate ;
return present_rate ;
}
}