From 9a14a714fc4adb943dfe65cb4f75d91f0086e41f Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Sat, 28 Aug 2021 01:28:30 -0400 Subject: [PATCH 1/5] adding Clear and NIR accessors --- adafruit_as7341.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/adafruit_as7341.py b/adafruit_as7341.py index db59fb2..e1645c5 100644 --- a/adafruit_as7341.py +++ b/adafruit_as7341.py @@ -375,8 +375,18 @@ def channel_680nm(self): """The current reading for the 680nm band""" self._configure_f5_f8() return self._channel_3_data + + @property + def channel_clear(self): + """The current reading for the clear sensor""" + self._configure_f5_f8() + return self._channel_4_data - # TODO: Add clear and NIR accessors + @property + def channel_clear(self): + """The current reading for the NIR (near-IR) sensor""" + self._configure_f5_f8() + return self._channel_5_data def _wait_for_data(self, timeout=1.0): """Wait for sensor data to be ready""" From 57fe91779f08aeddd6c0cb7c4443755a157df6cf Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Sat, 28 Aug 2021 01:36:28 -0400 Subject: [PATCH 2/5] adding examples for access Clear and NIR channels --- examples/as7341_simpletest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/as7341_simpletest.py b/examples/as7341_simpletest.py index 1a52c31..24847a3 100644 --- a/examples/as7341_simpletest.py +++ b/examples/as7341_simpletest.py @@ -23,5 +23,7 @@ def bar_graph(read_value): print("F6 - 590nm/Yellow %s" % bar_graph(sensor.channel_590nm)) print("F7 - 630nm/Orange %s" % bar_graph(sensor.channel_630nm)) print("F8 - 680nm/Red %s" % bar_graph(sensor.channel_680nm)) + print("Clear %s" % bar_graph(sensor.channel_clear)) + print("Near-IR (NIR) %s" % bar_graph(sensor.channel_nir)) print("\n------------------------------------------------") sleep(1) From d3932dc49b2ca9914d37168503cc49323bee64c0 Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Sat, 28 Aug 2021 01:48:47 -0400 Subject: [PATCH 3/5] Update README.rst adding clear and NIR examples to readme --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index e9c0d4e..44cb82f 100644 --- a/README.rst +++ b/README.rst @@ -87,6 +87,8 @@ Usage Example print("F6 - 590nm/Yellow %s" % bar_graph(sensor.channel_590nm)) print("F7 - 630nm/Orange %s" % bar_graph(sensor.channel_630nm)) print("F8 - 680nm/Red %s" % bar_graph(sensor.channel_680nm)) + print("Clear %s" % bar_graph(sensor.channel_clear)) + print("Near-IR (NIR) %s" % bar_graph(sensor.channel_nir)) print("\n------------------------------------------------") sleep(1) From 34a9861bf0bf2807f55808e9cb322c7868cad0ef Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Thu, 2 Sep 2021 10:12:33 -0400 Subject: [PATCH 4/5] fixing typo in channel_nir property accessor --- adafruit_as7341.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_as7341.py b/adafruit_as7341.py index e1645c5..8d86572 100644 --- a/adafruit_as7341.py +++ b/adafruit_as7341.py @@ -383,7 +383,7 @@ def channel_clear(self): return self._channel_4_data @property - def channel_clear(self): + def channel_nir(self): """The current reading for the NIR (near-IR) sensor""" self._configure_f5_f8() return self._channel_5_data From 5e6302d333d8f77fd1232c795c0cbbb55074bdce Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Tue, 7 Sep 2021 00:46:45 -0400 Subject: [PATCH 5/5] fixing line endings --- adafruit_as7341.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_as7341.py b/adafruit_as7341.py index 8d86572..ff00deb 100644 --- a/adafruit_as7341.py +++ b/adafruit_as7341.py @@ -375,7 +375,7 @@ def channel_680nm(self): """The current reading for the 680nm band""" self._configure_f5_f8() return self._channel_3_data - + @property def channel_clear(self): """The current reading for the clear sensor"""