aboutsummaryrefslogtreecommitdiff
path: root/monitor_unified.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_unified.py')
-rw-r--r--monitor_unified.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/monitor_unified.py b/monitor_unified.py
index 83b5f63..805bd78 100644
--- a/monitor_unified.py
+++ b/monitor_unified.py
@@ -338,7 +338,12 @@ class Light(Sensor):
_CMD = 0x80
# max reading a channel can hold
+ # on exposure 402ms:
max_read = 65535
+ # on exposure 100ms:
+ max_read_1 = 37177
+ # on exposure 13.7ms:
+ max_read_2 = 5047
# commands
_ON = 0x03
@@ -439,6 +444,10 @@ class Light(Sensor):
lux = 0
elif ch0 == self.nan or ch1 == self.nan:
lux = self.nan
+ # normally broadband maxes out before infrared which makes visible
+ # drop which is clearly wrong hence:
+ elif ch0 == max_read or ch1 == max_read:
+ lux = self.nan
else:
ratio = ch1/ch0
if 0 < ratio <= 0.52: