This replaces the case-switch statement for creating an integration time delay with a computed delay using efficient integer math. It allows any arbitrary value of ATIME (and hence _tcs34725IntegrationTime) to be used.
Literal ints use at least 16-bits on Arduino so the computation will not suffer from overflow errors. As a side benefit, it uses 126 less bytes of program storage space.
The old version would add no delay if integration time was set to any other value than the enumerated ones. This would result in the same measurement being read multiple times, an error.
This version gives much more flexibility for setting integration times and still be functional.
This replaces the case-switch statement for creating an integration time delay with a computed delay using efficient integer math. It allows any arbitrary value of ATIME (and hence
_tcs34725IntegrationTime
) to be used.Literal ints use at least 16-bits on Arduino so the computation will not suffer from overflow errors. As a side benefit, it uses 126 less bytes of program storage space.
The old version would add no delay if integration time was set to any other value than the enumerated ones. This would result in the same measurement being read multiple times, an error.
This version gives much more flexibility for setting integration times and still be functional.