mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 00:48:19 +01:00
Add braces to if statement to avoid compiler warning. (#7036)
This commit is contained in:
parent
1b57d8511b
commit
08b8ab837a
1 changed files with 4 additions and 2 deletions
|
@ -93,8 +93,9 @@ void AHT10Component::restart_read_() {
|
||||||
|
|
||||||
void AHT10Component::read_data_() {
|
void AHT10Component::read_data_() {
|
||||||
uint8_t data[6];
|
uint8_t data[6];
|
||||||
if (this->read_count_ > 1)
|
if (this->read_count_ > 1) {
|
||||||
ESP_LOGD(TAG, "Read attempt %d at %ums", this->read_count_, (unsigned) (millis() - this->start_time_));
|
ESP_LOGD(TAG, "Read attempt %d at %ums", this->read_count_, (unsigned) (millis() - this->start_time_));
|
||||||
|
}
|
||||||
if (this->read(data, 6) != i2c::ERROR_OK) {
|
if (this->read(data, 6) != i2c::ERROR_OK) {
|
||||||
this->status_set_warning("AHT10 read failed, retrying soon");
|
this->status_set_warning("AHT10 read failed, retrying soon");
|
||||||
this->restart_read_();
|
this->restart_read_();
|
||||||
|
@ -119,8 +120,9 @@ void AHT10Component::read_data_() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->read_count_ > 1)
|
if (this->read_count_ > 1) {
|
||||||
ESP_LOGD(TAG, "Success at %ums", (unsigned) (millis() - this->start_time_));
|
ESP_LOGD(TAG, "Success at %ums", (unsigned) (millis() - this->start_time_));
|
||||||
|
}
|
||||||
uint32_t raw_temperature = ((data[3] & 0x0F) << 16) | (data[4] << 8) | data[5];
|
uint32_t raw_temperature = ((data[3] & 0x0F) << 16) | (data[4] << 8) | data[5];
|
||||||
uint32_t raw_humidity = ((data[1] << 16) | (data[2] << 8) | data[3]) >> 4;
|
uint32_t raw_humidity = ((data[1] << 16) | (data[2] << 8) | data[3]) >> 4;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue