From 09e5143d2fe199c4367d2ea75d67a68b950aeb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fdez?= Date: Sun, 23 Aug 2020 02:20:48 +0200 Subject: [PATCH] pocketbook: fix for devices without natural light :p --- frontend/device/pocketbook/powerd.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/device/pocketbook/powerd.lua b/frontend/device/pocketbook/powerd.lua index ff65b6fae..7f1268ecc 100644 --- a/frontend/device/pocketbook/powerd.lua +++ b/frontend/device/pocketbook/powerd.lua @@ -25,8 +25,10 @@ local PocketBookPowerD = BasePowerD:new{ function PocketBookPowerD:init() -- needed for SetFrontlightState / GetFrontlightState inkview.OpenScreen() - local color = inkview.GetFrontlightColor() - self.fl_warmth = color >= 0 and color or 0 + if self.device:hasNaturalLight() then + local color = inkview.GetFrontlightColor() + self.fl_warmth = color >= 0 and color or 0 + end end function PocketBookPowerD:frontlightIntensityHW() @@ -43,8 +45,10 @@ function PocketBookPowerD:setIntensityHW(intensity) end function PocketBookPowerD:setWarmth(level) - self.fl_warmth = level or self.fl_warmth - inkview.SetFrontlightColor(self.fl_warmth) + if self.fl_warmth then + self.fl_warmth = level or self.fl_warmth + inkview.SetFrontlightColor(self.fl_warmth) + end end function PocketBookPowerD:getCapacityHW()