9 static const char *
const TAG =
"max31856";
14 ESP_LOGCONFIG(TAG,
"Setting up MAX31856Sensor '%s'...", this->
name_.
c_str());
18 ESP_LOGCONFIG(TAG,
"Setting up assertion on all faults");
21 ESP_LOGCONFIG(TAG,
"Setting up open circuit fault detection");
27 ESP_LOGCONFIG(TAG,
"Completed setting up MAX31856Sensor '%s'...", this->
name_.
c_str());
31 LOG_SENSOR(
"",
"MAX31856",
this);
32 LOG_PIN(
" CS Pin: ", this->
cs_);
33 ESP_LOGCONFIG(TAG,
" Mains Filter: %s",
36 ESP_LOGCONFIG(TAG,
" Thermocouple Type: Unknown");
41 LOG_UPDATE_INTERVAL(
this);
45 ESP_LOGVV(TAG,
"update");
60 if (temp24 & 0x800000) {
66 float temp_c = temp24;
69 ESP_LOGD(TAG,
"Got thermocouple temperature: %.2f°C", temp_c);
75 ESP_LOGVV(TAG,
"one_shot_temperature_");
87 ESP_LOGVV(TAG,
"read_fault_");
91 ESP_LOGV(TAG,
"status_set_warning");
96 ESP_LOGV(TAG,
"status_set_warning");
100 ESP_LOGW(TAG,
"Cold Junction Out-of-Range: '%s'...", this->
name_.
c_str());
103 ESP_LOGW(TAG,
"Thermocouple Out-of-Range: '%s'...", this->
name_.
c_str());
106 ESP_LOGW(TAG,
"Cold-Junction High Fault: '%s'...", this->
name_.
c_str());
109 ESP_LOGW(TAG,
"Cold-Junction Low Fault: '%s'...", this->
name_.
c_str());
112 ESP_LOGW(TAG,
"Thermocouple Temperature High Fault: '%s'...", this->
name_.
c_str());
115 ESP_LOGW(TAG,
"Thermocouple Temperature Low Fault: '%s'...", this->
name_.
c_str());
118 ESP_LOGW(TAG,
"Overvoltage or Undervoltage Input Fault: '%s'...", this->
name_.
c_str());
121 ESP_LOGW(TAG,
"Thermocouple Open-Circuit Fault (possibly not connected): '%s'...", this->
name_.
c_str());
128 ESP_LOGV(TAG,
"clear_fault_");
144 ESP_LOGCONFIG(TAG,
"set_thermocouple_type_: 0x%02X", type);
147 t |= (uint8_t) type & 0x0F;
152 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 0x%02X",
filter_);
156 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 50 Hz, t==0x%02X", t);
159 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 60 Hz, t==0x%02X", t);
165 ESP_LOGVV(TAG,
"write_register_ raw reg=0x%02X value=0x%02X", reg, value);
167 ESP_LOGVV(TAG,
"write_register_ masked reg=0x%02X value=0x%02X", reg, value);
169 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
171 ESP_LOGVV(TAG,
"write_byte value=0x%02X", value);
174 ESP_LOGV(TAG,
"write_register_ 0x%02X: 0x%02X", reg, value);
178 ESP_LOGVV(TAG,
"read_register_ 0x%02X", reg);
180 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
183 ESP_LOGVV(TAG,
"read_byte value=0x%02X", value);
185 ESP_LOGV(TAG,
"read_register_ reg=0x%02X: value=0x%02X", reg, value);
190 ESP_LOGVV(TAG,
"read_register_24_ 0x%02X", reg);
192 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
195 ESP_LOGVV(TAG,
"read_byte msb=0x%02X", msb);
197 ESP_LOGVV(TAG,
"read_byte mid=0x%02X", mid);
199 ESP_LOGVV(TAG,
"read_byte lsb=0x%02X", lsb);
201 const uint32_t value((msb << 16) | (mid << 8) | lsb);
202 ESP_LOGV(TAG,
"read_register_24_ reg=0x%02X: value=0x%06" PRIX32, reg, value);
Linearized TC Temperature, Byte 2.
const float DATA
For components that import data from directly connected sensors like DHT.
MAX31856ConfigFilter filter_
Config 0 fault mode flag.
Config 0 one shot convert flag.
void status_set_warning(const char *message="unspecified")
void spi_setup() override
Fault status Cold Junction Out-of-Range flag.
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Config 0 open circuit fault 01 flag.
Fault status Overvoltage or Undervoltage Input Fault flag.
uint32_t read_register24_(uint8_t reg)
void write_byte(uint8_t data)
void set_thermocouple_type_()
void dump_config() override
Fault status Thermocouple Temperature Low Fault flag.
MAX31856ThermocoupleType thermocouple_type_
void write_register_(uint8_t reg, uint8_t value)
Fault status Thermocouple Temperature High Fault flag.
Fault status Cold-Junction Low Fault flag.
void status_clear_warning()
MAX31856ThermocoupleType
Multiple types of thermocouples supported by the chip.
void publish_state(float state)
Publish a new state to the front-end.
Fault status Cold-Junction High Fault flag.
uint8_t read_register_(uint8_t reg)
Fault status Thermocouple Open-Circuit Fault flag.
constexpr const char * c_str() const
void one_shot_temperature_()
Config 0 Auto convert flag.
Implementation of SPI Controller mode.
void read_thermocouple_temperature_()
Config 0 fault clear flag.
float get_setup_priority() const override
Fault status Thermocouple Out-of-Range flag.
Cold-Junction Temperature Offset Register.