2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

pocketbook: fix for devices without natural light :p

This commit is contained in:
Martín Fdez 2020-08-23 02:20:48 +02:00 committed by Martín Fernández
parent 671ea00a2f
commit 09e5143d2f

View File

@ -25,9 +25,11 @@ local PocketBookPowerD = BasePowerD:new{
function PocketBookPowerD:init() function PocketBookPowerD:init()
-- needed for SetFrontlightState / GetFrontlightState -- needed for SetFrontlightState / GetFrontlightState
inkview.OpenScreen() inkview.OpenScreen()
if self.device:hasNaturalLight() then
local color = inkview.GetFrontlightColor() local color = inkview.GetFrontlightColor()
self.fl_warmth = color >= 0 and color or 0 self.fl_warmth = color >= 0 and color or 0
end end
end
function PocketBookPowerD:frontlightIntensityHW() function PocketBookPowerD:frontlightIntensityHW()
if not self.device:hasFrontlight() then return 0 end if not self.device:hasFrontlight() then return 0 end
@ -43,9 +45,11 @@ function PocketBookPowerD:setIntensityHW(intensity)
end end
function PocketBookPowerD:setWarmth(level) function PocketBookPowerD:setWarmth(level)
if self.fl_warmth then
self.fl_warmth = level or self.fl_warmth self.fl_warmth = level or self.fl_warmth
inkview.SetFrontlightColor(self.fl_warmth) inkview.SetFrontlightColor(self.fl_warmth)
end end
end
function PocketBookPowerD:getCapacityHW() function PocketBookPowerD:getCapacityHW()
return inkview.GetBatteryPower() return inkview.GetBatteryPower()