We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fa3c2e commit e427332Copy full SHA for e427332
adafruit_tsl2591.py
@@ -248,8 +248,15 @@ def lux(self):
248
and visible light channels.
249
"""
250
channel_0, channel_1 = self.raw_luminosity
251
+
252
+ # Set the maximum sensor counts based on the atime setting
253
+ if 100 == atime:
254
+ maxCounts = 36863
255
+ else:
256
+ maxCounts = 0xFFFF
257
258
# Handle overflow.
- if channel_0 == 0xFFFF or channel_1 == 0xFFFF:
259
+ if channel_0 == maxCounts or channel_1 == maxCounts:
260
raise RuntimeError('Overflow reading light channels!')
261
# Calculate lux using same equation as Arduino library:
262
# https://github.com/adafruit/Adafruit_TSL2591_Library/blob/master/Adafruit_TSL2591.cpp
0 commit comments