diff --git a/plugins/batterystat.koplugin/main.lua b/plugins/batterystat.koplugin/main.lua index b87c32343..77de9184d 100644 --- a/plugins/batterystat.koplugin/main.lua +++ b/plugins/batterystat.koplugin/main.lua @@ -108,7 +108,10 @@ function BatteryStat:init() -- the unaccumulated values. self.charging_state = State:new(self.settings:readSetting("charging_state")) self.awake_state = State:new(self.settings:readSetting("awake_state")) - self:initCurrentState() + -- Whether the device was suspending before current timestamp. + self.was_suspending = false + -- Whether the device was charging before current timestamp. + self.was_charging = PowerD:isCharging() if self.debugging then self.debugOutput = self._debugOutput @@ -117,13 +120,6 @@ function BatteryStat:init() end end -function BatteryStat:initCurrentState() - -- Whether the device was suspending before current timestamp. - self.was_suspending = false - -- Whether the device was charging before current timestamp. - self.was_charging = PowerD:isCharging() -end - function BatteryStat:onFlushSettings() self.settings:reset({ charging = self.charging, @@ -197,7 +193,6 @@ function BatteryStat:onNotCharging() end function BatteryStat:showStatistics() - self:initCurrentState() self:accumulate() local kv_pairs = self:dump() table.insert(kv_pairs, "----------")