Adafruit_APDS9960 icon indicating copy to clipboard operation
Adafruit_APDS9960 copied to clipboard

'calculateLux' unexpected overflow behavior due to use of uint16_t

Open atomdog opened this issue 1 year ago • 0 comments

  • Arduino board: ESP32

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.16

  • List the steps to reproduce the problem below: In dark conditions a call to apds.calculateLux inverts values and returns values at or near 65534. You can reproduced this via: uint16_t lux = apds.calculateLux(r, g, b); or uint32_t lux = apds.calculateLux(r, g, b);

    This is a straightforward fix and I can make a pull request if this repo is still being maintained.

atomdog avatar Jun 15 '23 20:06 atomdog