mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
Fix sdp3x error checking (#3531)
This commit is contained in:
parent
dd470d4197
commit
31c4551890
1 changed files with 3 additions and 4 deletions
|
@ -40,7 +40,7 @@ void SDP3XComponent::setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t data[6];
|
uint16_t data[6];
|
||||||
if (this->read_data(data, 6) != i2c::ERROR_OK) {
|
if (!this->read_data(data, 6)) {
|
||||||
ESP_LOGE(TAG, "Read ID SDP3X failed!");
|
ESP_LOGE(TAG, "Read ID SDP3X failed!");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
|
@ -78,8 +78,7 @@ void SDP3XComponent::setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->write_command(measurement_mode_ == DP_AVG ? SDP3X_START_DP_AVG : SDP3X_START_MASS_FLOW_AVG) !=
|
if (!this->write_command(measurement_mode_ == DP_AVG ? SDP3X_START_DP_AVG : SDP3X_START_MASS_FLOW_AVG)) {
|
||||||
i2c::ERROR_OK) {
|
|
||||||
ESP_LOGE(TAG, "Start Measurements SDP3X failed!");
|
ESP_LOGE(TAG, "Start Measurements SDP3X failed!");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
|
@ -98,7 +97,7 @@ void SDP3XComponent::dump_config() {
|
||||||
|
|
||||||
void SDP3XComponent::read_pressure_() {
|
void SDP3XComponent::read_pressure_() {
|
||||||
uint16_t data[3];
|
uint16_t data[3];
|
||||||
if (this->read_data(data, 3) != i2c::ERROR_OK) {
|
if (!this->read_data(data, 3)) {
|
||||||
ESP_LOGW(TAG, "Couldn't read SDP3X data!");
|
ESP_LOGW(TAG, "Couldn't read SDP3X data!");
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue