8static const char *
const TAG =
"max31855";
22 ESP_LOGCONFIG(TAG,
"MAX31855:");
23 LOG_PIN(
" CS Pin: ", this->
cs_);
24 LOG_UPDATE_INTERVAL(
this);
25 LOG_SENSOR(
" ",
"Thermocouple",
this);
29 ESP_LOGCONFIG(TAG,
" Reference temperature disabled.");
42 if (mem != 0xFFFFFFFF) {
45 ESP_LOGE(TAG,
"No data received from MAX31855 (0x%08" PRIX32
"). Check wiring!", mem);
56 int16_t
val = (mem & 0x0000FFF0) >> 4;
60 const float t_ref = float(
val) * 0.0625f;
61 ESP_LOGD(TAG,
"Got reference temperature: %.4f°C", t_ref);
66 if (mem & 0x00000001) {
67 ESP_LOGW(TAG,
"Thermocouple open circuit (not connected) fault from MAX31855 (0x%08" PRIX32
")", mem);
72 if (mem & 0x00000002) {
73 ESP_LOGW(TAG,
"Thermocouple short circuit to ground fault from MAX31855 (0x%08" PRIX32
")", mem);
78 if (mem & 0x00000004) {
79 ESP_LOGW(TAG,
"Thermocouple short circuit to VCC fault from MAX31855 (0x%08" PRIX32
")", mem);
84 if (mem & 0x00010000) {
85 ESP_LOGW(TAG,
"Got faulty reading from MAX31855 (0x%08" PRIX32
")", mem);
92 int16_t
val = (mem & 0xFFFC0000) >> 18;
96 const float t_sense = float(
val) * 0.25f;
97 ESP_LOGD(TAG,
"Got thermocouple temperature: %.2f°C", t_sense);
void status_set_warning()
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
void status_clear_error()
void status_clear_warning()
sensor::Sensor * temperature_reference_
void dump_config() override
void publish_state(float state)
Publish a new state to the front-end.
void spi_setup() override
void read_array(uint8_t *data, size_t length)
constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
Encode a 32-bit value given four bytes in most to least significant byte order.
void HOT delay(uint32_t ms)