diff options
author | erg_samowzbudnik <uinarf@autistici.org> | 2021-06-03 16:11:59 +0200 |
---|---|---|
committer | erg_samowzbudnik <uinarf@autistici.org> | 2021-06-03 16:11:59 +0200 |
commit | c228deff3271f20dacfc3858c09838fc05f52edc (patch) | |
tree | f8698bd87bdd18c4e1a09294958fce0b6ab83cbc | |
parent | b4ceccd6c3e2bea832fb5f0b29f2a28c0c855916 (diff) | |
download | RPGH-c228deff3271f20dacfc3858c09838fc05f52edc.tar.gz RPGH-c228deff3271f20dacfc3858c09838fc05f52edc.tar.bz2 RPGH-c228deff3271f20dacfc3858c09838fc05f52edc.zip |
Fix for wrong lux calculation with broadband part of the sensor saturated.
-rw-r--r-- | monitor_unified.py | 9 |
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: |