Open Abestanis opened 2 years ago
Also, do you prefer the timeout parameter to be in the init
function?
Hi,
How about not enabling timeout when timeout=0。 This is how most timeout mechanisms are designed, so that
How about not enabling timeout when timeout=0
Good idea, done.
Hey @lakshanthad, sorry to ping you but you said in #5 that you might review this. Is this blocked by anything?
This allows not to loop endlessly and to detect not responding light sensors. Closes #5.
This change is backwards compatible, because by default the timeout is disabled. ~The only incompatible change is the undefinition of the
max
macro in the header, which was required to get the value for theTSL2561_NO_READ_TIMEOUT
macro.~ ~We could get around that problem by not including<Arduino.h>
and include<cstdint>
instead. That could also be a breaking change if someone relied on the implicit import of the<Arduino.h>
header, but I think it would be the better solution here. What's your opinion on this?~I noticed that the availability check for the
ISL29035
is commented out: https://github.com/Seeed-Studio/Grove_Digital_Light_Sensor/blob/69f7175ed1349276364994d1d45041c6e90a129b/Digital_Light_ISL29035.cpp#L59 Therefore I didn't add a timeout for that class. But if you want to have a loop with a timeout for theISL29035
as well, we could add a common base class and put the timeout functionality in there. What do you think?