mirror of
https://github.com/esphome/esphome.git
synced 2025-01-10 14:43:17 +01:00
Clang-tidy update
This commit is contained in:
parent
b1a1ea05ce
commit
213d436672
2 changed files with 23 additions and 23 deletions
|
@ -33,25 +33,25 @@ void HDC2010Component::setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set measurement mode to temperature and humidity
|
// Set measurement mode to temperature and humidity
|
||||||
uint8_t configContents;
|
uint8_t config_contents;
|
||||||
read_register(MEASUREMENT_CONFIG, &configContents, 1);
|
read_register(MEASUREMENT_CONFIG, &config_contents, 1);
|
||||||
configContents = (configContents & 0xF9); // Always set to TEMP_AND_HUMID mode
|
config_contents = (config_contents & 0xF9); // Always set to TEMP_AND_HUMID mode
|
||||||
this->write_bytes(MEASUREMENT_CONFIG, &configContents, 1);
|
this->write_bytes(MEASUREMENT_CONFIG, &config_contents, 1);
|
||||||
|
|
||||||
// Set rate to manual
|
// Set rate to manual
|
||||||
read_register(CONFIG, &configContents, 1);
|
read_register(CONFIG, &config_contents, 1);
|
||||||
configContents &= 0x8F;
|
config_contents &= 0x8F;
|
||||||
this->write_bytes(CONFIG, &configContents, 1);
|
this->write_bytes(CONFIG, &config_contents, 1);
|
||||||
|
|
||||||
// Set temperature resolution to 14bit
|
// Set temperature resolution to 14bit
|
||||||
read_register(CONFIG, &configContents, 1);
|
read_register(CONFIG, &config_contents, 1);
|
||||||
configContents &= 0x3F;
|
config_contents &= 0x3F;
|
||||||
this->write_bytes(CONFIG, &configContents, 1);
|
this->write_bytes(CONFIG, &config_contents, 1);
|
||||||
|
|
||||||
// Set humidity resolution to 14bit
|
// Set humidity resolution to 14bit
|
||||||
read_register(CONFIG, &configContents, 1);
|
read_register(CONFIG, &config_contents, 1);
|
||||||
configContents &= 0xCF;
|
config_contents &= 0xCF;
|
||||||
this->write_bytes(CONFIG, &configContents, 1);
|
this->write_bytes(CONFIG, &config_contents, 1);
|
||||||
|
|
||||||
delayMicroseconds(5000); // wait for 5ms
|
delayMicroseconds(5000); // wait for 5ms
|
||||||
}
|
}
|
||||||
|
@ -69,15 +69,15 @@ void HDC2010Component::dump_config() {
|
||||||
|
|
||||||
void HDC2010Component::update() {
|
void HDC2010Component::update() {
|
||||||
// Trigger measurement
|
// Trigger measurement
|
||||||
uint8_t configContents;
|
uint8_t config_contents;
|
||||||
read_register(CONFIG, &configContents, 1);
|
read_register(CONFIG, &config_contents, 1);
|
||||||
configContents |= 0x01;
|
config_contents |= 0x01;
|
||||||
this->write_bytes(MEASUREMENT_CONFIG, &configContents, 1);
|
this->write_bytes(MEASUREMENT_CONFIG, &config_contents, 1);
|
||||||
|
|
||||||
delayMicroseconds(1000); // 1ms delay after triggering the sample
|
delayMicroseconds(1000); // 1ms delay after triggering the sample
|
||||||
|
|
||||||
float temp = readTemp();
|
float temp = read_temp();
|
||||||
float humidity = readHumidity();
|
float humidity = read_humidity();
|
||||||
|
|
||||||
this->temperature_->publish_state(temp);
|
this->temperature_->publish_state(temp);
|
||||||
this->humidity_->publish_state(humidity);
|
this->humidity_->publish_state(humidity);
|
||||||
|
@ -86,7 +86,7 @@ void HDC2010Component::update() {
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
}
|
}
|
||||||
|
|
||||||
float HDC2010Component::readTemp() {
|
float HDC2010Component::read_temp() {
|
||||||
uint8_t byte[2];
|
uint8_t byte[2];
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ float HDC2010Component::readTemp() {
|
||||||
return (float) temp * 0.0025177f - 40.0f;
|
return (float) temp * 0.0025177f - 40.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float HDC2010Component::readHumidity() {
|
float HDC2010Component::read_humidity() {
|
||||||
uint8_t byte[2];
|
uint8_t byte[2];
|
||||||
uint16_t humidity;
|
uint16_t humidity;
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ class HDC2010Component : public PollingComponent, public i2c::I2CDevice {
|
||||||
/// Retrieve the latest sensor values. This operation takes approximately 16ms.
|
/// Retrieve the latest sensor values. This operation takes approximately 16ms.
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
float readTemp();
|
float read_temp();
|
||||||
|
|
||||||
float readHumidity();
|
float read_humidity();
|
||||||
|
|
||||||
float get_setup_priority() const override;
|
float get_setup_priority() const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue