mirror of
https://github.com/esphome/esphome.git
synced 2025-02-22 04:48:21 +00:00
remove delay from tmp102 (#6577)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
parent
8c31aea94f
commit
655dbc48b5
@ -28,12 +28,12 @@ void TMP102Component::dump_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TMP102Component::update() {
|
void TMP102Component::update() {
|
||||||
int16_t raw_temperature;
|
|
||||||
if (this->write(&TMP102_REGISTER_TEMPERATURE, 1) != i2c::ERROR_OK) {
|
if (this->write(&TMP102_REGISTER_TEMPERATURE, 1) != i2c::ERROR_OK) {
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delay(50); // NOLINT
|
this->set_timeout("read_temp", 50, [this]() {
|
||||||
|
int16_t raw_temperature;
|
||||||
if (this->read(reinterpret_cast<uint8_t *>(&raw_temperature), 2) != i2c::ERROR_OK) {
|
if (this->read(reinterpret_cast<uint8_t *>(&raw_temperature), 2) != i2c::ERROR_OK) {
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
return;
|
return;
|
||||||
@ -45,6 +45,7 @@ void TMP102Component::update() {
|
|||||||
|
|
||||||
this->publish_state(temperature);
|
this->publish_state(temperature);
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
float TMP102Component::get_setup_priority() const { return setup_priority::DATA; }
|
float TMP102Component::get_setup_priority() const { return setup_priority::DATA; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user