diff --git a/esphome/components/shtcx/shtcx.cpp b/esphome/components/shtcx/shtcx.cpp index d81bc152ad..356453d66a 100644 --- a/esphome/components/shtcx/shtcx.cpp +++ b/esphome/components/shtcx/shtcx.cpp @@ -11,9 +11,6 @@ static const uint16_t SHTCX_COMMAND_WAKEUP = 0x3517; static const uint16_t SHTCX_COMMAND_READ_ID_REGISTER = 0xEFC8; static const uint16_t SHTCX_COMMAND_SOFT_RESET = 0x805D; static const uint16_t SHTCX_COMMAND_POLLING_H = 0x7866; -//static const uint16_t SHTCX_COMMAND_READ_STATUS = 0xF32D; -//static const uint16_t SHTCX_COMMAND_CLEAR_STATUS = 0x3041; - void SHTCXComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up SHTCx..."); @@ -32,7 +29,7 @@ void SHTCXComponent::setup() { this->mark_failed(); return; } - if ((( device_id_register[0] << 2) & 0x1C) == 0x1C){ + if (((device_id_register[0] << 2) & 0x1C) == 0x1C) { if ((device_id_register[0] & 0x847) == 0x847) { this->type_ = SHTCX_TYPE_SHTC3; ESP_LOGCONFIG(TAG, " Device identified: SHTC3"); @@ -55,7 +52,7 @@ void SHTCXComponent::dump_config() { } float SHTCXComponent::get_setup_priority() const { return setup_priority::DATA; } void SHTCXComponent::update() { - if (this->status_has_warning()){ + if (this->status_has_warning()) { ESP_LOGW(TAG, "Retrying to reconnect the sensor."); this->write_command_(SHTCX_COMMAND_SOFT_RESET); } @@ -143,15 +140,15 @@ bool SHTCXComponent::read_data_(uint16_t *data, uint8_t len) { void SHTCXComponent::soft_reset() { if (!this->write_command_(SHTCX_COMMAND_SOFT_RESET)) { - ESP_LOGE(TAG, "Error sending SHTCX_COMMAND_SOFT_RESET"); - this->mark_failed(); - return; + ESP_LOGE(TAG, "Error sending SHTCX_COMMAND_SOFT_RESET"); + this->mark_failed(); + return; } delayMicroseconds(200); } void SHTCXComponent::sleep() { if (!this->write_command_(SHTCX_COMMAND_SLEEP)) { - return; + return; } } diff --git a/esphome/components/shtcx/shtcx.h b/esphome/components/shtcx/shtcx.h index 7a5bd13d77..7ab63bd5f8 100644 --- a/esphome/components/shtcx/shtcx.h +++ b/esphome/components/shtcx/shtcx.h @@ -7,10 +7,7 @@ namespace esphome { namespace shtcx { -enum SHTCXType { - SHTCX_TYPE_SHTC1 = 0, - SHTCX_TYPE_SHTC3 -}; +enum SHTCXType { SHTCX_TYPE_SHTC1 = 0, SHTCX_TYPE_SHTC3 }; /// This class implements support for the SHT3x-DIS family of temperature+humidity i2c sensors. class SHTCXComponent : public PollingComponent, public i2c::I2CDevice {