adafruit / Adafruit_TSL2591_Library

This is an Arduino library for the TSL2591 digital luminosity (light) sensors.
58 stars 48 forks source link

begin() doesn't return status #38

Closed mikekov closed 3 years ago

mikekov commented 4 years ago

Hi,

Adafruit_TSL2591::begin() always returns true instead of returning real status from a function it calls. Looks like a typo. It breaks a few things down the road that rely on begin().

YordanGanev commented 3 years ago

Yea, seems like typo. I was wondering why it shows sensor present when my board had nothing wired on it.
If you are expecting a status from Adafruit_TSL2591::begin(uint8_t addr) the code below should do the job.

/**************************************************************************/
/*!
    @brief   Setups the I2C interface and hardware, identifies if chip is found
    @param   addr The I2C adress of the sensor (Default 0x29)
    @returns True if a TSL2591 is found, false on any failure
*/
/**************************************************************************/
boolean Adafruit_TSL2591::begin(uint8_t addr) {
  return begin(&Wire, addr);
}

Greetings!

ladyada commented 3 years ago

sure, please submit a PR!

caternuson commented 3 years ago

Closing. Fixed with #43.