mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Kobo: Turn light on/off according to start parameters
Kobo only. I guess Kindle handles this himself anyway?
This commit is contained in:
@@ -80,6 +80,7 @@ function UIManager:init()
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
suspend_msg = InfoMessage:new{ text = _("Suspended") }
|
||||
end
|
||||
if KOBO_LIGHT_OFF_ON_SUSPEND then Device:getPowerDevice():setIntensity(0) end
|
||||
self:show(suspend_msg)
|
||||
self:sendEvent(Event:new("FlushSettings"))
|
||||
Device:prepareSuspend()
|
||||
@@ -91,6 +92,9 @@ function UIManager:init()
|
||||
if suspend_msg then
|
||||
self:close(suspend_msg)
|
||||
end
|
||||
if KOBO_LIGHT_ON_START and tonumber(KOBO_LIGHT_ON_START) > -1 then
|
||||
Device:getPowerDevice():setIntensity( math.max( math.min(KOBO_LIGHT_ON_START,100) ,0) )
|
||||
end
|
||||
end
|
||||
end
|
||||
self.event_handlers["Power"] = kobo_power
|
||||
@@ -109,6 +113,9 @@ function UIManager:init()
|
||||
self:sendEvent(input_event)
|
||||
end
|
||||
end
|
||||
if KOBO_LIGHT_ON_START and tonumber(KOBO_LIGHT_ON_START) > -1 then
|
||||
Device:getPowerDevice():setIntensity( math.max( math.min(KOBO_LIGHT_ON_START,100) ,0) )
|
||||
end
|
||||
elseif Device:isKindle() then
|
||||
self.event_handlers["IntoSS"] = function()
|
||||
self:sendEvent(Event:new("FlushSettings"))
|
||||
|
||||
Reference in New Issue
Block a user