Skip to content

Commit e7c7f0f

Browse files
authored
Merge pull request #18 from caternuson/float_doc
Ensure a float return for lux.
2 parents c4b706d + b3f27dd commit e7c7f0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_tsl2561.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def enabled(self, enable):
107107

108108
@property
109109
def lux(self):
110-
"""The computed lux value."""
110+
"""The computed lux value or None when value is not computable."""
111111
return self._compute_lux()
112112

113113
@property
@@ -177,7 +177,7 @@ def _compute_lux(self):
177177
elif ratio <= 1.30:
178178
lux = 0.00146 * ch0 - 0.00112 * ch1
179179
else:
180-
lux = 0
180+
lux = 0.
181181
# Pretty sure the floating point math formula on pg. 23 of datasheet
182182
# is based on 16x gain and 402ms integration time. Need to scale
183183
# result for other settings.

0 commit comments

Comments
 (0)