Failure in library "TSL2561-Arduino-Library"



  • Hi,
    i'm using the sensor TLS2561 and NodeManager 1.7. I installed the libraray "TSL2561-Arduino-Library" as it is described in the README.md.
    The function TSL2561::begin returns always true notwithstanding if the address mode (TSL2561_ADDR_HIGH|FLOAT|LOW) not matches the hardware setting of the address line (high|floating|low).

      Wire.requestFrom(_addr, 1);
    #if ARDUINO >= 100
      int x = Wire.read();
    #else
      int x = Wire.receive();
    #endif
      //Serial.print("0x"); Serial.println(x, HEX);
      if (x & 0x0A ) {
        //Serial.println("Found TSL2561");
      } else {
        return false;
      }
      _initialized = true;
    

    So, if the address matches the TLS2561 anwers with 0x0A. If the address does not match the I2C bus will read as 0xFF. In this case the statement "if (x & 0x0a)" will also be true.
    I changed the statement to "if (x == 0x0A)" and the function works correctly.
    @user2864 Maxbe you could intiate a change in the library. I don't know how to do that in the github environment.
    Greatings from germany, mabe with a special german english😌


  • Contest Winner

    @ab13akl thanks for reporting this issue, tracking it down with https://github.com/mysensors/NodeManager/issues/402, will definitely look at it throughout v1.8 development. Thanks again!


  • Contest Winner

    @ab13akl I was reviewing this in more details and if I have understood correctly the change you have made was in the Adafruit library, right? Do you think there is anything we can do on the NodeManager's side? Thanks!



  • @user2684 Yes, i have changed the Adafruit library. NodeManager code is ok: it generates an "ERROR" message when "(_tsl->begin())" fails. But, in the current Adafruit library begin() never fails. Thanks for the fast response.


  • Contest Winner

    @ab13akl thanks for confirming, I'll then close the issue on the NodeManager side but by keeping track of it other users facing the same problem should at least be able to identify it quicker and have a ready-to-use workaround, many thanks for sharing!


 

324
Online

7.9k
Users

8.8k
Topics

93.8k
Posts