Several fixes in frontlight logic (#2991)

* Use PluginShare to exchange data between plugins

* Remove legacy code in reader.lua and kobo/device.lua, and move KOBO_LIGHT_ON_START to kobo/powerd.lua

* A better sync config logic

* Consider kobo without hardware frontlight toggle

* update frontlight widget once toggle is tapped.
This commit is contained in:
Hzj_jie
2017-06-28 23:23:32 -07:00
committed by Frans de Jonge
parent 9b557ed15a
commit a4d5165f7a
6 changed files with 48 additions and 73 deletions

View File

@@ -136,30 +136,6 @@ if G_reader_settings:readSetting("night_mode") then
Device.screen:toggleNightMode()
end
-- restore kobo frontlight settings and probe kobo touch coordinates
if Device:isKobo() then
if Device:hasFrontlight() then
local powerd = Device:getPowerDevice()
if powerd then
-- UIManager:init() should have sanely set up the frontlight_stuff by this point
local intensity = G_reader_settings:readSetting("frontlight_intensity")
powerd.fl_intensity = intensity or powerd.fl_intensity
local is_frontlight_on = G_reader_settings:readSetting("is_frontlight_on")
if is_frontlight_on then
-- default powerd.is_fl_on is false, turn it on
powerd:toggleFrontlight()
else
-- the light can still be turned on manually outside of KOReader
-- or Nickel. so we always set the intensity to 0 here to keep it
-- in sync with powerd.is_fl_on (false by default)
-- NOTE: we cant use setIntensity method here because for Kobo the
-- min intensity is 1 :(
powerd.fl:setBrightness(0)
end
end
end
end
if Device:needsTouchScreenProbe() then
Device:touchScreenProbe()
end