You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently used it in a project, but I had to make some adjustments to the code, because I observed the following behavior:
I'm calling TSL2561_CalculateLux::readIRLuminosity which would never return, if the light sensor wasn't connected to the Arduino. This happened often during development, when the system was only partially assembled and it could have happened in the field, if a cable got loose or if the light sensor somehow wouldn't respond.
The reason for the hang is the following loop in TSL2561_CalculateLux::readRegister:
If the light sensor never responds, Wire.available() will never return true, making the loop an endless loop.
For this reason, I added a timeout to the while loop and set an error flag on the TSL2561_CalculateLux in the event of a timeout, which my code could check.
Would you be willing to accept a pull request which adds a timeout and some way to detect the timeout?
The text was updated successfully, but these errors were encountered:
Hello, thank you for this awesome library!
I recently used it in a project, but I had to make some adjustments to the code, because I observed the following behavior:
I'm calling
TSL2561_CalculateLux::readIRLuminosity
which would never return, if the light sensor wasn't connected to the Arduino. This happened often during development, when the system was only partially assembled and it could have happened in the field, if a cable got loose or if the light sensor somehow wouldn't respond.The reason for the hang is the following loop in
TSL2561_CalculateLux::readRegister
:Grove_Digital_Light_Sensor/Digital_Light_TSL2561.cpp
Line 41 in 457fcf7
If the light sensor never responds,
Wire.available()
will never return true, making the loop an endless loop.For this reason, I added a timeout to the while loop and set an error flag on the
TSL2561_CalculateLux
in the event of a timeout, which my code could check.Would you be willing to accept a pull request which adds a timeout and some way to detect the timeout?
The text was updated successfully, but these errors were encountered: