mirror of
https://github.com/esphome/esphome.git
synced 2024-12-27 17:28:01 +01:00
Fix BME280 initialization before wifi setup (#4190)
fixes https://github.com/esphome/issues/issues/3530
This commit is contained in:
parent
4d72eb42a5
commit
ded86493c2
@ -88,7 +88,10 @@ void BME280Component::setup() {
|
|||||||
|
|
||||||
// Mark as not failed before initializing. Some devices will turn off sensors to save on batteries
|
// Mark as not failed before initializing. Some devices will turn off sensors to save on batteries
|
||||||
// and when they come back on, the COMPONENT_STATE_FAILED bit must be unset on the component.
|
// and when they come back on, the COMPONENT_STATE_FAILED bit must be unset on the component.
|
||||||
this->component_state_ &= ~COMPONENT_STATE_FAILED;
|
if ((this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_FAILED) {
|
||||||
|
this->component_state_ &= ~COMPONENT_STATE_MASK;
|
||||||
|
this->component_state_ |= COMPONENT_STATE_CONSTRUCTION;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->read_byte(BME280_REGISTER_CHIPID, &chip_id)) {
|
if (!this->read_byte(BME280_REGISTER_CHIPID, &chip_id)) {
|
||||||
this->error_code_ = COMMUNICATION_FAILED;
|
this->error_code_ = COMMUNICATION_FAILED;
|
||||||
|
Loading…
Reference in New Issue
Block a user