mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
feat: add logger module & rewrite kobo suspend script in lua
This commit is contained in:
@@ -4,7 +4,7 @@ local GestureRange = require("ui/gesturerange")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Screen = require("device").screen
|
||||
local Device = require("device")
|
||||
local DEBUG = require("dbg")
|
||||
local logger = require("logger")
|
||||
local T = require("ffi/util").template
|
||||
local _ = require("gettext")
|
||||
|
||||
@@ -40,11 +40,11 @@ end
|
||||
function ReaderFrontLight:onAdjust(arg, ges)
|
||||
local powerd = Device:getPowerDevice()
|
||||
if powerd.fl_intensity ~= nil then
|
||||
DEBUG("frontlight intensity", powerd.fl_intensity)
|
||||
logger.dbg("frontlight intensity", powerd.fl_intensity)
|
||||
local step = math.ceil(#self.steps * ges.distance / self.gestureScale)
|
||||
DEBUG("step = ", step)
|
||||
logger.dbg("step = ", step)
|
||||
local delta_int = self.steps[step] or self.steps[#self.steps]
|
||||
DEBUG("delta_int = ", delta_int)
|
||||
logger.dbg("delta_int = ", delta_int)
|
||||
local new_intensity
|
||||
if ges.direction == "north" then
|
||||
new_intensity = powerd.fl_intensity + delta_int
|
||||
@@ -71,13 +71,13 @@ end
|
||||
|
||||
function ReaderFrontLight:onSwipe(arg, ges)
|
||||
if ges.direction == "north" or ges.direction == "south" then
|
||||
DEBUG("onSwipe activated")
|
||||
logger.dbg("onSwipe activated")
|
||||
return self:onShowIntensity()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFrontLight:onPanRelease(arg, ges)
|
||||
DEBUG("onPanRelease activated")
|
||||
logger.dbg("onPanRelease activated")
|
||||
return self:onShowIntensity()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user