Skip to content

Commit

Permalink
Updated rgbToKelvin() math. Upped version to 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
samclane committed Dec 14, 2021
1 parent 84663d2 commit 39faffc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lifx_control_panel/_constants.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion lifx_control_panel/build_all.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lifx_control_panel/utilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 39faffc

Please sign in to comment.