Skip to content

Commit 0d5d8b6

Browse files
author
caternuson
committed
return None instead of 0 for sensor saturation
1 parent b61fc0b commit 0d5d8b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_tsl2561.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ def integration_time(self, time):
135135
def _compute_lux(self):
136136
"""Based on datasheet for FN package."""
137137
ch0, ch1 = self.luminosity
138-
if ch0 == 0: return 0
139-
if ch0 > TSL2561_CLIP_THRESHOLD[self.integration_time]: return 0
140-
if ch1 > TSL2561_CLIP_THRESHOLD[self.integration_time]: return 0
138+
if ch0 == 0: return None
139+
if ch0 > TSL2561_CLIP_THRESHOLD[self.integration_time]: return None
140+
if ch1 > TSL2561_CLIP_THRESHOLD[self.integration_time]: return None
141141
ratio = ch1 / ch0
142142
if ratio > 0 and ratio <= 0.50:
143143
lux = 0.0304 * ch0 - 0.062 * ch0 * ratio**1.4

0 commit comments

Comments
 (0)