currently the library blocks on every reading of the sensor values:
uint32_t Adafruit_TSL2591::getFullLuminosity (void) {
// ....
// Wait x ms for ADC to complete
for (uint8_t d=0; d<=_integration; d++)
{
delay(120);
}
// ....
}
(all specialized readings are calling the getFullLuminosity function)
this delay is needed because the lib enables the sensor for every interaction and disables it afterwards.
but i think a ~100-600ms blocking delay just for getting a sensor reading is not a nice thing to do..
→ if the sensor is left running you just can read a value and be happy ;-)
if you want to make sure you get a valid reading - first check the Status Register for AVALID.
if the lib needs to make sure it always gets a new conversion value i think
after the read we could disable only the AEN flag (Enable Register) and re enable it directly again.
this should clear the AVALID flag.
i would try and create a pull-request - but i first need a ok/info for how to do this in line with the adafruit goals!
currently the library blocks on every reading of the sensor values:
(all specialized readings are calling the getFullLuminosity function)
this delay is needed because the lib enables the sensor for every interaction and disables it afterwards. but i think a ~100-600ms blocking delay just for getting a sensor reading is not a nice thing to do.. → if the sensor is left running you just can read a value and be happy ;-)
if you want to make sure you get a valid reading - first check the Status Register for AVALID. if the lib needs to make sure it always gets a new conversion value i think after the read we could disable only the AEN flag (Enable Register) and re enable it directly again. this should clear the AVALID flag.
i would try and create a pull-request - but i first need a ok/info for how to do this in line with the adafruit goals!
so the fix for this should also fix #12