From 92de5821bb552644ac45803c828217e99cb5ecd6 Mon Sep 17 00:00:00 2001 From: zwim <36999612+zwim@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:42:13 +0200 Subject: [PATCH] [AutoWarmth] Delay front light actions after resume (#12315) --- plugins/autowarmth.koplugin/main.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/autowarmth.koplugin/main.lua b/plugins/autowarmth.koplugin/main.lua index 1d6d6dfc1..d51322698 100644 --- a/plugins/autowarmth.koplugin/main.lua +++ b/plugins/autowarmth.koplugin/main.lua @@ -428,14 +428,16 @@ function AutoWarmth:setFrontlight(enable, keep_user_toggle) return end - if enable then - Powerd:turnOnFrontlight() - AutoWarmth.fl_turned_off = false - else - Powerd:turnOffFrontlight() - AutoWarmth.fl_turned_off = true - UIManager:broadcastEvent(Event:new("FrontlightTurnedOff")) -- used e.g. in AutoDim - end + UIManager:scheduleIn(0.01, function() + if enable then + Powerd:turnOnFrontlight() + AutoWarmth.fl_turned_off = false + else + Powerd:turnOffFrontlight() + AutoWarmth.fl_turned_off = true + UIManager:broadcastEvent(Event:new("FrontlightTurnedOff")) -- used e.g. in AutoDim + end + end) end -- toggles Frontlight on or off, depending on `now_s`