From 39faffcb4be6676048f1e2fe9477ea50131ac013 Mon Sep 17 00:00:00 2001 From: Sawyer McLane Date: Tue, 14 Dec 2021 11:46:19 -0700 Subject: [PATCH] Updated rgbToKelvin() math. Upped version to 2.1.0 --- lifx_control_panel/_constants.py | 4 ++-- lifx_control_panel/build_all.spec | 2 +- lifx_control_panel/utilities/utils.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lifx_control_panel/_constants.py b/lifx_control_panel/_constants.py index a5b7c66..296a150 100644 --- a/lifx_control_panel/_constants.py +++ b/lifx_control_panel/_constants.py @@ -1,4 +1,4 @@ -VERSION = "2.1.0" -BUILD_DATE = "2021-12-05T15:19:39.347158" +VERSION = "2.1.1" +BUILD_DATE = "2021-12-14T11:43:33.756405" AUTHOR = "Sawyer McLane" DEBUGGING = False diff --git a/lifx_control_panel/build_all.spec b/lifx_control_panel/build_all.spec index 880c9ba..2562bde 100644 --- a/lifx_control_panel/build_all.spec +++ b/lifx_control_panel/build_all.spec @@ -3,7 +3,7 @@ import datetime bd = datetime.datetime.now().isoformat() auth = "Sawyer McLane" -vers = "2.1.0" +vers = "2.1.1" is_debug = False # Write version info into _constants.py resource file diff --git a/lifx_control_panel/utilities/utils.py b/lifx_control_panel/utilities/utils.py index 9aae951..c60c525 100644 --- a/lifx_control_panel/utilities/utils.py +++ b/lifx_control_panel/utilities/utils.py @@ -169,19 +169,19 @@ def kelvinToRGB(temperature: int) -> TypeRGB: # pylint: disable=invalid-name temperature /= 100 # calc red - if temperature < 66: + if temperature <= 66: red = 255 else: red = temperature - 60 - red = 329.698727446 * (red ** -0.1332047592) + red = 329.698727466 * (red ** -0.1332047592) if red < 0: red = 0 if red > 255: red = 255 # calc green - if temperature < 66: + if temperature <= 66: green = temperature - green = 99.4708025861 * log(green) - 161.1195681661 + green = 99.4708025861 * log(green + 0.0000000001) - 161.1195681661 if green < 0: green = 0 if green > 255: @@ -197,7 +197,7 @@ def kelvinToRGB(temperature: int) -> TypeRGB: if temperature >= 66: blue = 255 else: - if temperature < 19: + if temperature <= 19: blue = 0 else: blue = temperature - 10