mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Fix bogus reading on no communication with MAX31865 (#3505)
This commit is contained in:
		| @@ -103,6 +103,7 @@ esphome/components/lilygo_t5_47/touchscreen/* @jesserockz | |||||||
| esphome/components/lock/* @esphome/core | esphome/components/lock/* @esphome/core | ||||||
| esphome/components/logger/* @esphome/core | esphome/components/logger/* @esphome/core | ||||||
| esphome/components/ltr390/* @sjtrny | esphome/components/ltr390/* @sjtrny | ||||||
|  | esphome/components/max31865/* @DAVe3283 | ||||||
| esphome/components/max44009/* @berfenger | esphome/components/max44009/* @berfenger | ||||||
| esphome/components/max7219digit/* @rspaargaren | esphome/components/max7219digit/* @rspaargaren | ||||||
| esphome/components/max9611/* @mckaymatthew | esphome/components/max9611/* @mckaymatthew | ||||||
|   | |||||||
| @@ -94,6 +94,14 @@ void MAX31865Sensor::read_data_() { | |||||||
|   const uint16_t rtd_resistance_register = this->read_register_16_(RTD_RESISTANCE_MSB_REG); |   const uint16_t rtd_resistance_register = this->read_register_16_(RTD_RESISTANCE_MSB_REG); | ||||||
|   this->write_config_(0b11000000, 0b00000000); |   this->write_config_(0b11000000, 0b00000000); | ||||||
|  |  | ||||||
|  |   // Check for bad connection | ||||||
|  |   if (rtd_resistance_register == 0b0000000000000000 || rtd_resistance_register == 0b1111111111111111) { | ||||||
|  |     ESP_LOGE(TAG, "SPI bus read all 0 or all 1 (0x%04X), check MAX31865 wiring & power.", rtd_resistance_register); | ||||||
|  |     this->publish_state(NAN); | ||||||
|  |     this->status_set_error(); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   // Check faults |   // Check faults | ||||||
|   const uint8_t faults = this->read_register_(FAULT_STATUS_REG); |   const uint8_t faults = this->read_register_(FAULT_STATUS_REG); | ||||||
|   if ((has_fault_ = faults & 0b00111100)) { |   if ((has_fault_ = faults & 0b00111100)) { | ||||||
|   | |||||||
| @@ -11,6 +11,9 @@ from esphome.const import ( | |||||||
|     UNIT_CELSIUS, |     UNIT_CELSIUS, | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | CODEOWNERS = ["@DAVe3283"] | ||||||
|  | DEPENDENCIES = ["spi"] | ||||||
|  |  | ||||||
| max31865_ns = cg.esphome_ns.namespace("max31865") | max31865_ns = cg.esphome_ns.namespace("max31865") | ||||||
| MAX31865Sensor = max31865_ns.class_( | MAX31865Sensor = max31865_ns.class_( | ||||||
|     "MAX31865Sensor", sensor.Sensor, cg.PollingComponent, spi.SPIDevice |     "MAX31865Sensor", sensor.Sensor, cg.PollingComponent, spi.SPIDevice | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user