MAX6675: change evaluation of spi result

https://cdn-shop.adafruit.com/datasheets/MAX6675.pdf
When thermocouple is open (bit2), we send a "not ready", reset active and hopefully we get a result next time.
This commit is contained in:
Wurstnase 2016-10-19 22:41:43 +02:00 committed by Nico Tonnhofer
parent bcb6964ceb
commit e7dce1817b
1 changed files with 8 additions and 5 deletions

9
temp.c
View File

@ -250,11 +250,14 @@ static uint16_t temp_max6675_read(temp_sensor_t i) {
spi_deselect_max6675();
if ((temp & 0x8002) == 0) {
// Got "device id".
if ((temp & 4) == 0) {
if ((temp & 0x4) == 0) {
temp = temp >> 3;
}
else {
// thermocouple open, send "not ready"
temp = TEMP_NOT_READY;
// and we will read it next time.
temp_sensors_runtime[i].active = 0;
}
return temp;