Fix calculation of remaining charging time in TDE hardware library

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 075cf11458)
pull/16/head
Slávek Banko 9 years ago
parent 76adbedc16
commit 43b1218e15

@ -3028,12 +3028,17 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
} }
// Calculate time remaining // Calculate time remaining
// Discharge rate is in watt-hours // Discharge/charge rate is in watt-hours
// Energy is in watt-hours // Energy is in watt-hours
// Therefore, energy/rate = time in hours // Therefore, energy/rate = time in hours
// Convert to seconds... // Convert to seconds...
if (bdevice->status() == TDEBatteryStatus::Charging) {
bdevice->internalSetTimeRemaining(((bdevice->maximumEnergy()-bdevice->energy())/bdevice->dischargeRate())*60*60);
}
else {
bdevice->internalSetTimeRemaining((bdevice->energy()/bdevice->dischargeRate())*60*60); bdevice->internalSetTimeRemaining((bdevice->energy()/bdevice->dischargeRate())*60*60);
} }
}
if (device->type() == TDEGenericDeviceType::PowerSupply) { if (device->type() == TDEGenericDeviceType::PowerSupply) {
// Populate all power supply values // Populate all power supply values

Loading…
Cancel
Save