From 956ecdc9104dd39f47d2b988adb0eb05530bca82 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Apr 2021 00:57:35 +0200 Subject: [PATCH] FrontLight: Ensure the warmth bar is empty at 0 Fix #7548 --- frontend/ui/widget/frontlightwidget.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/ui/widget/frontlightwidget.lua b/frontend/ui/widget/frontlightwidget.lua index b9fc66fa8..2f166d284 100644 --- a/frontend/ui/widget/frontlightwidget.lua +++ b/frontend/ui/widget/frontlightwidget.lua @@ -308,19 +308,20 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group) end if self.natural_light and num_warmth then - for i = 0, math.floor(num_warmth / step) do + local curr_warmth_step = math.floor(num_warmth / step) + for i = 0, curr_warmth_step do table.insert(warmth_group, self.fl_prog_button:new{ text = "", - preselect = true, + preselect = curr_warmth_step > 0 and true or false, enabled = not self.powerd.auto_warmth, - background = button_color, + background = curr_warmth_step > 0 and button_color or nil, callback = function() self:setProgress(self.fl_cur, step, i * step) end }) end - for i = math.floor(num_warmth / step) + 1, self.steps - 1 do + for i = curr_warmth_step + 1, self.steps - 1 do table.insert(warmth_group, self.fl_prog_button:new{ text = "", enabled = not self.powerd.auto_warmth,