Adafruit SI1145 library throws error when exceeding UINT16 readings
Opened this issue · 1 comments
I have an Adafruit SI1145 sensor. I have tested it on an Arduino Uno and it works great. I am shining a red laser on it for testing. The readings for infrared are in the 0-100,000 ballpark.
However, I switched over to CircuitPython on both a Pi Pico and FeatherS2. In both cases, when the reading exceeds 65,535, I get the following error (the first value is the IR reading from the sensor):
(305, 0, 100000)
(304, 0, 100000)
(303, 0, 100000)
(301, 0, 100000)
(304, 0, 100000)
(306, 0, 100000)
(303, 0, 100000)
(302, 0, 100000)
(300, 0, 100000)
(65535, 0, 100000) <------ shine red laser on it
Traceback (most recent call last):
File "code.py", line 16, in <module>
File "/lib/adafruit_si1145.py", line 109, in als
File "/lib/adafruit_si1145.py", line 165, in _send_command
RuntimeError: SI1145 Error: 0x80
Code done running.
Is this a programming problem where the value is stored in a UINT16 instead of something higher or some limitation in the Pico and ESP32 chips?
The raw data is 16 bits - comes from reading 2 8 bit registers. So 65535 would be the max.
The Arduino library appears to be doing the same:
https://github.com/adafruit/Adafruit_SI1145_Library/blob/f1b825779ab86293a0e81a6a5749022243a24450/Adafruit_SI1145.cpp#L145
So not sure how you were getting values above 65535 using Arduino.
What Arduino library were you using? What example sketch were you running?