1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-13 22:28:14 +00:00

Fix lint issues

This commit is contained in:
valordk 2019-07-27 22:11:08 +02:00
parent c11e92f295
commit 75d2de79d8
2 changed files with 7 additions and 13 deletions

View File

@ -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;
}
}

View File

@ -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 {