RobTillaart / MAX31855_RT

Arduino library for MAX31855 chip for K type thermocouple
MIT License
17 stars 5 forks source link

if tc.read() fails then the last Temperatures held internally might get corrupted when updated #9

Closed RobTillaart closed 4 years ago

RobTillaart commented 4 years ago

When the tc.read() is called and the state returned is an error, it might be that the value of the temperature that is held by the tc object is incorrect.

So it seems better to return status as soon as it is detected it is not OK

in code

uint8_t MAX31855::read()
{
   ....
  // process status bit 0-2   
  _status = value & 0x0007;
  if (_status) return _status;   // do not update _temperature and _internal as they might be incorrect.