From 054f23b3dafbc72423ec6313ed6ebb7f18950099 Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Sat, 9 May 2020 14:34:36 -0500 Subject: [PATCH 1/2] change color property to use scaled color_raw values --- adafruit_tcs34725.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adafruit_tcs34725.py b/adafruit_tcs34725.py index 34cc0cb..fb58c78 100644 --- a/adafruit_tcs34725.py +++ b/adafruit_tcs34725.py @@ -140,8 +140,11 @@ def color(self): Examples: Red = 16711680 (0xff0000), Green = 65280 (0x00ff00), Blue = 255 (0x0000ff), SlateGray = 7372944 (0x708090) """ - r, g, b = self.color_rgb_bytes - return (r << 16) | (g << 8) | b + r, g, b, c = self.color_raw + scaled_r = r * 255 // 1024 + scaled_g = g * 255 // 1024 + scaled_b = b * 255 // 1024 + return (scaled_r << 16) | (scaled_g << 8) | scaled_b @property def active(self): From a2eb2a36d7f70fa8b4263600948145f406d4121b Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Sat, 9 May 2020 14:51:43 -0500 Subject: [PATCH 2/2] try fix name of clear value --- adafruit_tcs34725.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_tcs34725.py b/adafruit_tcs34725.py index fb58c78..c6159f1 100644 --- a/adafruit_tcs34725.py +++ b/adafruit_tcs34725.py @@ -140,7 +140,7 @@ def color(self): Examples: Red = 16711680 (0xff0000), Green = 65280 (0x00ff00), Blue = 255 (0x0000ff), SlateGray = 7372944 (0x708090) """ - r, g, b, c = self.color_raw + r, g, b, _c = self.color_raw scaled_r = r * 255 // 1024 scaled_g = g * 255 // 1024 scaled_b = b * 255 // 1024