From 7f88304a62e7e0fa3703dafa89ebba49cf55f09d Mon Sep 17 00:00:00 2001 From: tjhowse Date: Mon, 13 Jan 2025 12:03:17 +1000 Subject: [PATCH] Also ignore general error bit. --- esphome/components/max31855/max31855.cpp | 36 +++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/esphome/components/max31855/max31855.cpp b/esphome/components/max31855/max31855.cpp index d52e1c299f..558ed70b58 100644 --- a/esphome/components/max31855/max31855.cpp +++ b/esphome/components/max31855/max31855.cpp @@ -74,23 +74,25 @@ void MAX31855Sensor::read_data_() { this->status_set_warning(); return; } - if ((mem & 0x00000002) && !this->ignore_short_circuit_errors_) { - ESP_LOGW(TAG, "Thermocouple short circuit to ground fault from MAX31855 (0x%08" PRIX32 ")", mem); - this->publish_state(NAN); - this->status_set_warning(); - return; - } - if ((mem & 0x00000004) && !this->ignore_short_circuit_errors_) { - ESP_LOGW(TAG, "Thermocouple short circuit to VCC fault from MAX31855 (0x%08" PRIX32 ")", mem); - this->publish_state(NAN); - this->status_set_warning(); - return; - } - if (mem & 0x00010000) { - ESP_LOGW(TAG, "Got faulty reading from MAX31855 (0x%08" PRIX32 ")", mem); - this->publish_state(NAN); - this->status_set_warning(); - return; + if (!this->ignore_short_circuit_errors_) { + if (mem & 0x00000002) { + ESP_LOGW(TAG, "Thermocouple short circuit to ground fault from MAX31855 (0x%08" PRIX32 ")", mem); + this->publish_state(NAN); + this->status_set_warning(); + return; + } + if (mem & 0x00000004) { + ESP_LOGW(TAG, "Thermocouple short circuit to VCC fault from MAX31855 (0x%08" PRIX32 ")", mem); + this->publish_state(NAN); + this->status_set_warning(); + return; + } + if (mem & 0x00010000) { + ESP_LOGW(TAG, "Got faulty reading from MAX31855 (0x%08" PRIX32 ")", mem); + this->publish_state(NAN); + this->status_set_warning(); + return; + } } // Decode thermocouple temperature