20static const char *
const TAG =
"bmp581";
25static const LogString *oversampling_to_str(
Oversampling oversampling) {
26 return OversamplingStrings::get_log_str(
static_cast<uint8_t
>(oversampling), OversamplingStrings::LAST_INDEX);
32static const LogString *iir_filter_to_str(
IIRFilter filter) {
33 return IIRFilterStrings::get_log_str(
static_cast<uint8_t
>(filter), IIRFilterStrings::LAST_INDEX);
37 ESP_LOGCONFIG(TAG,
"BMP581:");
39 switch (this->error_code_) {
43 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
46 ESP_LOGE(TAG,
"Unknown chip ID");
49 ESP_LOGE(TAG,
"Reset failed");
52 ESP_LOGE(TAG,
"Get status failed");
55 ESP_LOGE(TAG,
"IIR Filter failed to prime with initial measurement");
58 ESP_LOGE(TAG,
"Error %d", (
int) this->error_code_);
62 LOG_UPDATE_INTERVAL(
this);
64 ESP_LOGCONFIG(TAG,
" Measurement conversion time: %ums", this->
conversion_time_);
97 this->error_code_ =
NONE;
104 ESP_LOGE(TAG,
"Reset failed");
120 ESP_LOGE(TAG,
"Read chip ID failed");
129 if (chip_id != BMP581_ASIC_ID) {
130 ESP_LOGE(TAG,
"Unknown chip ID");
143 ESP_LOGE(TAG,
"Failed to read status register");
152 if (!(this->
status_.bit.status_nvm_rdy)) {
153 ESP_LOGE(TAG,
"NVM not ready");
162 if (this->
status_.bit.status_nvm_err) {
163 ESP_LOGE(TAG,
"NVM error detected");
177 ESP_LOGE(TAG,
"Failed to write interrupt source register");
199 ESP_LOGE(TAG,
"Failed to write oversampling register");
219 ESP_LOGE(TAG,
"Failed to write IIR configuration registers");
228 ESP_LOGE(TAG,
"Failed to prime the IIR filter with an initial measurement");
260 ESP_LOGVV(TAG,
"Requesting measurement");
263 ESP_LOGW(TAG,
"Requesting forced measurement failed");
285 ESP_LOGW(TAG,
"Failed to read temperature and pressure; skipping update");
292 ESP_LOGW(TAG,
"Failed to read temperature; skipping update");
323 ESP_LOGD(TAG,
"Data not ready, sensor is in standby mode");
330 ESP_LOGE(TAG,
"Failed to read interrupt status register");
363 ESP_LOGE(TAG,
"Failed to write oversampling register");
371 ESP_LOGE(TAG,
"Failed to write IIR source register");
381 ESP_LOGE(TAG,
"Failed to request a forced measurement");
393 ESP_LOGE(TAG,
"IIR priming measurement was not ready");
401 ESP_LOGE(TAG,
"Failed to write IIR source register");
417 ESP_LOGW(TAG,
"Data not ready, skipping this update");
425 ESP_LOGW(TAG,
"Failed to read measurement");
432 int32_t
raw_temp = (int32_t) data[2] << 16 | (int32_t) data[1] << 8 | (int32_t) data[0];
446 ESP_LOGW(TAG,
"Data not ready, skipping this update");
454 ESP_LOGW(TAG,
"Failed to read measurement");
461 int32_t
raw_temp = (int32_t) data[2] << 16 | (int32_t) data[1] << 8 | (int32_t) data[0];
465 int32_t raw_press = (int32_t) data[5] << 16 | (int32_t) data[4] << 8 | (int32_t) data[3];
466 pressure = (float) (raw_press / 64.0);
478 ESP_LOGE(TAG,
"Failed to write reset command");
489 ESP_LOGE(TAG,
"Failed to read interrupt status register");
539 this->
int_source_.bit.drdy_data_reg_en = data_ready_enable;
550 this->
osr_config_.bit.osr_t = temperature_oversampling;
551 this->
osr_config_.bit.osr_p = pressure_oversampling;
BedjetMode mode
BedJet operating mode.
virtual void mark_failed()
Mark this component as failed.
void status_set_warning(const char *message=nullptr)
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_warning()
bool read_temperature_(float &temperature)
IIRFilter iir_pressure_level_
IIRFilter iir_temperature_level_
union esphome::bmp581_base::BMP581Component::@42 iir_config_
bool write_interrupt_source_settings_(bool data_ready_enable)
Oversampling pressure_oversampling_
bool write_oversampling_settings_(Oversampling temperature_oversampling, Oversampling pressure_oversampling)
virtual bool bmp_read_byte(uint8_t a_register, uint8_t *data)=0
virtual bool bmp_read_bytes(uint8_t a_register, uint8_t *data, size_t len)=0
bool start_measurement_()
union esphome::bmp581_base::BMP581Component::@41 dsp_config_
sensor::Sensor * pressure_sensor_
bool write_iir_settings_(IIRFilter temperature_iir, IIRFilter pressure_iir)
union esphome::bmp581_base::BMP581Component::@39 int_status_
union esphome::bmp581_base::BMP581Component::@38 int_source_
virtual bool bmp_write_bytes(uint8_t a_register, uint8_t *data, size_t len)=0
union esphome::bmp581_base::BMP581Component::@44 odr_config_
union esphome::bmp581_base::BMP581Component::@40 status_
Oversampling temperature_oversampling_
@ ERROR_COMMUNICATION_FAILED
enum esphome::bmp581_base::BMP581Component::ErrorCode NONE
void dump_config() override
virtual bool bmp_write_byte(uint8_t a_register, uint8_t data)=0
bool read_temperature_and_pressure_(float &temperature, float &pressure)
bool check_data_readiness_()
bool write_power_mode_(OperationMode mode)
union esphome::bmp581_base::BMP581Component::@43 osr_config_
sensor::Sensor * temperature_sensor_
void publish_state(float state)
Publish a new state to the front-end.
@ BMP581_MEASUREMENT_DATA
PROGMEM_STRING_TABLE(OversamplingStrings, "None", "2x", "4x", "8x", "16x", "32x", "64x", "128x", "")
void IRAM_ATTR HOT delay(uint32_t ms)