mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Fix several crash errors triggered by legacy code (#2962)
This commit is contained in:
@@ -9,8 +9,8 @@ local AndroidPowerD = BasePowerD:new{
|
||||
function AndroidPowerD:init()
|
||||
end
|
||||
|
||||
function AndroidPowerD:setIntensityHW()
|
||||
android.setScreenBrightness(math.floor(255 * self.fl_intensity / 25))
|
||||
function AndroidPowerD:setIntensityHW(intensity)
|
||||
android.setScreenBrightness(math.floor(255 * intensity / 25))
|
||||
end
|
||||
|
||||
function AndroidPowerD:getCapacityHW()
|
||||
|
||||
@@ -29,7 +29,7 @@ function KindlePowerD:setIntensityHW(intensity)
|
||||
if self.lipc_handle ~= nil and intensity > 0 then
|
||||
-- NOTE: We want to bypass setIntensity's shenanigans and simply restore the light as-is
|
||||
self.lipc_handle:set_int_property(
|
||||
"com.lab126.powerd", "flIntensity", self.fronglightIntensity())
|
||||
"com.lab126.powerd", "flIntensity", intensity)
|
||||
else
|
||||
-- NOTE: when intensity is 0, We want to really kill the light, so do it manually
|
||||
-- (asking lipc to set it to 0 would in fact set it to 1)...
|
||||
@@ -73,7 +73,7 @@ function KindlePowerD:afterResume()
|
||||
if self:isFrontlightOn() then
|
||||
-- Kindle stock software should turn on the front light automatically. The follow statement
|
||||
-- ensure the consistency of intensity.
|
||||
self:setIntensityHW()
|
||||
self:turnOnFrontlightHW()
|
||||
else
|
||||
self:turnOffFrontlightHW()
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ end
|
||||
|
||||
function KoboPowerD:setIntensityHW(intensity)
|
||||
if self.fl == nil then return end
|
||||
self.fl:setBrightness(self.frontlightIntensity())
|
||||
self.fl:setBrightness(intensity)
|
||||
self:_syncNickelConf()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user