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",
35 LOG_UPDATE_INTERVAL(
this);
39 ESP_LOGVV(TAG,
"update");
54 if (temp24 & 0x800000) {
60 float temp_c = temp24;
63 ESP_LOGD(TAG,
"Got thermocouple temperature: %.2f°C", temp_c);
69 ESP_LOGVV(TAG,
"one_shot_temperature_");
81 ESP_LOGVV(TAG,
"read_fault_");
85 ESP_LOGV(TAG,
"status_set_warning");
90 ESP_LOGV(TAG,
"status_set_warning");
94 ESP_LOGW(TAG,
"Cold Junction Out-of-Range: '%s'...", this->
name_.
c_str());
97 ESP_LOGW(TAG,
"Thermocouple Out-of-Range: '%s'...", this->
name_.
c_str());
100 ESP_LOGW(TAG,
"Cold-Junction High Fault: '%s'...", this->
name_.
c_str());
103 ESP_LOGW(TAG,
"Cold-Junction Low Fault: '%s'...", this->
name_.
c_str());
106 ESP_LOGW(TAG,
"Thermocouple Temperature High Fault: '%s'...", this->
name_.
c_str());
109 ESP_LOGW(TAG,
"Thermocouple Temperature Low Fault: '%s'...", this->
name_.
c_str());
112 ESP_LOGW(TAG,
"Overvoltage or Undervoltage Input Fault: '%s'...", this->
name_.
c_str());
115 ESP_LOGW(TAG,
"Thermocouple Open-Circuit Fault (possibly not connected): '%s'...", this->
name_.
c_str());
122 ESP_LOGV(TAG,
"clear_fault_");
133 ESP_LOGCONFIG(TAG,
"set_thermocouple_type_: 0x%02X", type);
136 t |= (uint8_t) type & 0x0F;
141 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 0x%02X",
filter_);
145 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 50 Hz, t==0x%02X", t);
148 ESP_LOGCONFIG(TAG,
"set_noise_filter_: 60 Hz, t==0x%02X", t);
154 ESP_LOGVV(TAG,
"write_register_ raw reg=0x%02X value=0x%02X", reg, value);
156 ESP_LOGVV(TAG,
"write_register_ masked reg=0x%02X value=0x%02X", reg, value);
158 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
160 ESP_LOGVV(TAG,
"write_byte value=0x%02X", value);
163 ESP_LOGV(TAG,
"write_register_ 0x%02X: 0x%02X", reg, value);
167 ESP_LOGVV(TAG,
"read_register_ 0x%02X", reg);
169 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
172 ESP_LOGVV(TAG,
"read_byte value=0x%02X", value);
174 ESP_LOGV(TAG,
"read_register_ reg=0x%02X: value=0x%02X", reg, value);
179 ESP_LOGVV(TAG,
"read_register_24_ 0x%02X", reg);
181 ESP_LOGVV(TAG,
"write_byte reg=0x%02X", reg);
184 ESP_LOGVV(TAG,
"read_byte msb=0x%02X", msb);
186 ESP_LOGVV(TAG,
"read_byte mid=0x%02X", mid);
188 ESP_LOGVV(TAG,
"read_byte lsb=0x%02X", lsb);
190 const uint32_t value((msb << 16) | (mid << 8) | lsb);
191 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 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.
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.
void status_set_warning()
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.