Extended delays to take into account loose timing with 'delay'

This commit is contained in:
microbuilder
2015-02-19 17:56:43 +01:00
parent 72065d72f0
commit ba1becf7f1

View File

@@ -29,6 +29,10 @@
#include "Adafruit_TSL2561_U.h" #include "Adafruit_TSL2561_U.h"
#define TSL2561_DELAY_INTTIME_13MS (15)
#define TSL2561_DELAY_INTTIME_101MS (120)
#define TSL2561_DELAY_INTTIME_402MS (450)
/*========================================================================*/ /*========================================================================*/
/* PRIVATE FUNCTIONS */ /* PRIVATE FUNCTIONS */
/*========================================================================*/ /*========================================================================*/
@@ -140,13 +144,13 @@ void Adafruit_TSL2561_Unified::getData (uint16_t *broadband, uint16_t *ir)
switch (_tsl2561IntegrationTime) switch (_tsl2561IntegrationTime)
{ {
case TSL2561_INTEGRATIONTIME_13MS: case TSL2561_INTEGRATIONTIME_13MS:
delay(14); delay(TSL2561_DELAY_INTTIME_13MS); // KTOWN: Was 14ms
break; break;
case TSL2561_INTEGRATIONTIME_101MS: case TSL2561_INTEGRATIONTIME_101MS:
delay(102); delay(TSL2561_DELAY_INTTIME_101MS); // KTOWN: Was 102ms
break; break;
default: default:
delay(403); delay(TSL2561_DELAY_INTTIME_402MS); // KTOWN: Was 403ms
break; break;
} }