From a2e06429983fbf848f6fb3480af839af0d716a95 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 14 Dec 2023 00:12:44 +0100 Subject: [PATCH] Cervantes: Make sure the warmth scaling is accurate For some mysterious reason, we init fl_warmth_max to 100 on Kobo & Cervantes, despite this being the case on absolutely none of them. TL;DR: We update it according to nl_max during init, but this was missing on Cervantes. --- frontend/device/cervantes/powerd.lua | 5 ++++- frontend/device/kobo/powerd.lua | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/device/cervantes/powerd.lua b/frontend/device/cervantes/powerd.lua index 90c7ecb1c..89fe3d1df 100644 --- a/frontend/device/cervantes/powerd.lua +++ b/frontend/device/cervantes/powerd.lua @@ -51,10 +51,13 @@ function CervantesPowerD:init() if self.device:hasNaturalLight() then local nl_config = G_reader_settings:readSetting("natural_light_config") if nl_config then - for key,val in pairs(nl_config) do + for key, val in pairs(nl_config) do self.device.frontlight_settings[key] = val end end + -- Does this device's NaturalLight use a custom scale? + self.fl_warmth_min = self.device.frontlight_settings.nl_min or self.fl_warmth_min + self.fl_warmth_max = self.device.frontlight_settings.nl_max or self.fl_warmth_max -- If this device has a mixer, we can use the ioctl for brightness control, as it's much lower latency. if self.device:hasNaturalLightMixer() then local kobolight = require("ffi/kobolight") diff --git a/frontend/device/kobo/powerd.lua b/frontend/device/kobo/powerd.lua index ab0cb0fd0..b5a92e2f4 100644 --- a/frontend/device/kobo/powerd.lua +++ b/frontend/device/kobo/powerd.lua @@ -139,8 +139,7 @@ function KoboPowerD:init() --- @note: Newer devices appear to block slightly longer on FL ioctls/sysfs, so we only really need a delay on older devices. self.device.frontlight_settings.ramp_delay = self.device.frontlight_settings.ramp_delay or (self.device:hasNaturalLight() and 0.0 or 0.025) - -- If this device has natural light (currently only KA1 & Forma) - -- Use the SysFS interface, and ioctl otherwise. + -- If this device has natural light, use the sysfs interface, and ioctl otherwise. -- NOTE: On the Forma, nickel still appears to prefer using ntx_io to handle the FL, -- but it does use sysfs for the NL... if self.device:hasNaturalLight() then