From a82ed914c9e431a1f45772d587655d8858b2f64a Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 10 Oct 2020 09:46:07 +0200 Subject: [PATCH] Allow backlight function to turn off backlight entirely (#8005) --- radio/src/functions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radio/src/functions.cpp b/radio/src/functions.cpp index 6b41254c4..4806d3584 100644 --- a/radio/src/functions.cpp +++ b/radio/src/functions.cpp @@ -358,7 +358,10 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext { getvalue_t raw = getValue(CFN_PARAM(cfn)); #if defined(COLORLCD) - requiredBacklightBright = (1024 - raw) * (BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN) / 2048; + if (raw == -1024) + requiredBacklightBright = 100; + else + requiredBacklightBright = (1024 - raw) * (BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN) / 2048; #else requiredBacklightBright = (1024 - raw) * 100 / 2048; #endif