Kobo Frontlight Tweaks

Now the frontlight remains unchanged from Nickel to koreader and vice
versa.
Also ffi/kobolight.lua has been changed to allow for usage of the toggle
button in the filemanager.
pull/559/head
Markismus 10 years ago
parent dc8b1f365b
commit a153286f44

@ -20,6 +20,7 @@ end
function BasePowerD:init() end
function BasePowerD:toggleFrontlight() end
function BasePowerD:setIntensityHW() end
function BasePowerD:setIntensitySW() end
function BasePowerD:getCapacityHW() end
function BasePowerD:isChargingHW() end
function BasePowerD:suspendHW() end
@ -39,6 +40,14 @@ function BasePowerD:setIntensity(intensity)
self:setIntensityHW()
end
function BasePowerD:setIntensityWithoutHW(intensity)
intensity = intensity < self.fl_min and self.fl_min or intensity
intensity = intensity > self.fl_max and self.fl_max or intensity
self.flIntensity = intensity
self:setIntensitySW()
end
function BasePowerD:getCapacity()
if capacity_pulled_count == capacity_cached_count then
capacity_pulled_count = 0

@ -28,6 +28,13 @@ function KoboPowerD:setIntensityHW()
end
end
function KoboPowerD:setIntensitySW()
if self.fl ~= nil then
self.fl:restoreBrightness(self.flIntensity)
end
end
function KoboPowerD:getCapacityHW()
self.battCapacity = self:read_int_file(self.batt_capacity_file)
return self.battCapacity

@ -1,8 +1,8 @@
#!./koreader-base
require "defaults"
package.path = "./frontend/?.lua;./?.lua"
package.cpath = "?.so;/usr/lib/lua/?.so"
package.path = "?.lua;common/?.lua;frontend/?.lua"
package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so"
local DocSettings = require("docsettings")
local _ = require("gettext")
@ -184,7 +184,8 @@ do
if powerd and powerd.restore_settings then
local intensity = G_reader_settings:readSetting("frontlight_intensity")
intensity = intensity or powerd.flIntensity
powerd:setIntensity(intensity)
powerd:setIntensityWithoutHW(intensity)
-- powerd:setIntensity(intensity)
end
end

Loading…
Cancel
Save