Kobo: Turn light on/off according to start parameters

Kobo only.
I guess Kindle handles this himself anyway?
This commit is contained in:
WS64
2014-08-12 13:11:13 +02:00
parent 7fb9940063
commit 11996cb6bb

View File

@@ -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"))