mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
24
reader.lua
24
reader.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user