From 5518a8109bbdc86ef615260bd34e51ef48bc22eb Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sun, 30 Jan 2022 20:52:42 +0100 Subject: [PATCH] PowerD: Ensure we actually pull battery capacity during early boot. (i.e., when MONOTONIC returns something lower than 60). Fix https://github.com/koreader/koreader/pull/8711#issuecomment-1021106079 --- frontend/device/generic/powerd.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/device/generic/powerd.lua b/frontend/device/generic/powerd.lua index e53ac6163..66ca26f0a 100644 --- a/frontend/device/generic/powerd.lua +++ b/frontend/device/generic/powerd.lua @@ -9,8 +9,8 @@ local BasePowerD = { aux_batt_capacity = 0, -- auxiliary battery capacity device = nil, -- device object - last_capacity_pull_time = TimeVal:new{ sec = 0, usec = 0}, -- timestamp of last pull - last_aux_capacity_pull_time = TimeVal:new{ sec = 0, usec = 0}, -- timestamp of last pull + last_capacity_pull_time = TimeVal:new{ sec = -61, usec = 0}, -- timestamp of last pull + last_aux_capacity_pull_time = TimeVal:new{ sec = -61, usec = 0}, -- timestamp of last pull is_fl_on = false, -- whether the frontlight is on } @@ -195,8 +195,8 @@ function BasePowerD:getAuxCapacity() 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} + self.last_capacity_pull_time = TimeVal:new{ sec = -61, usec = 0} + self.last_aux_capacity_pull_time = TimeVal:new{ sec = -61, usec = 0} end function BasePowerD:isAuxCharging()