adafruit/Adafruit-MLX90614-Library

Return NaN if reading failed

Closed this issue · 3 comments

Currently the library returns 54.67 for the readObjectTempC() if the sensor is not connected and it is hard to determine if the reading was successful or not (without calling begin()).
I suggest to add checks if the reading is successful or not. If it's not, the function should return NaN

EDIT: It seems like the function is returning -273.01, not 54.67 when the sensor is not connected. However, I still believe that returning NAN would be better.
EDIT 2: I've noticed that if the sensor is not connected readObjectTempC() sometimes returns -273.01 and sometimes 54.67 which makes it even harder to check if the reading i successful.

any PR to change / update behavior is welcome

@ladyada I've created PR ;)

thanx!!