mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
PowerD: Make sure we immediately display accurate battery capacity on
resume. (MONOTONIC doesn't trick during suspend, so we could happily display the pre-suspend capacity for a while).
This commit is contained in:
@@ -191,6 +191,11 @@ function BasePowerD:getAuxCapacity()
|
||||
return self.aux_batt_capacity
|
||||
end
|
||||
|
||||
function BasePowerD:invalidateCapacityCache()
|
||||
self.last_capacity_pull_time = TimeVal:new{ sec = 0, usec = 0}
|
||||
self.last_aux_capacity_pull_time = TimeVal:new{ sec = 0, usec = 0}
|
||||
end
|
||||
|
||||
function BasePowerD:isAuxCharging()
|
||||
return self:isAuxChargingHW()
|
||||
end
|
||||
|
||||
@@ -1792,6 +1792,10 @@ Executes all the operations of a resume (i.e., wakeup) request.
|
||||
This function usually wakes up the device.
|
||||
]]
|
||||
function UIManager:resume()
|
||||
-- MONOTONIC doesn't tick during suspend,
|
||||
-- invalidate the last battery capacity pull time so that we get up to date data immediately.
|
||||
Device:getPowerDevice():invalidateCapacityCache()
|
||||
|
||||
if Device:isCervantes() or Device:isKobo() or Device:isSDL() or Device:isRemarkable() or Device:isSonyPRSTUX() then
|
||||
self.event_handlers["Resume"]()
|
||||
elseif Device:isKindle() then
|
||||
|
||||
Reference in New Issue
Block a user