mirror of https://github.com/esphome/esphome.git
Bugfixes
This commit is contained in:
parent
9ddf1efe57
commit
e1d576afec
|
@ -1,6 +1,5 @@
|
|||
#include "ain4_20ma.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/components/i2c/i2c_bus.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ain4_20ma {
|
||||
|
@ -17,8 +16,8 @@ void Ain4_20maComponent::dump_config() {
|
|||
void Ain4_20maComponent::update() {
|
||||
uint8_t data[2];
|
||||
|
||||
i2c::I2CDevice::ErrorCode err = this->read_register(0x20, ¤t, 2, true);
|
||||
if (err != i2c::I2CDevice::ERROR_OK) {
|
||||
i2c::ErrorCode err = this->read_register(0x20, ¤t, 2, true);
|
||||
if (err != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, "Error reading data from AIN4-20mA");
|
||||
this->publish_state(NAN);
|
||||
} else {
|
||||
|
|
|
@ -16,5 +16,5 @@ class Ain4_20maComponent : public i2c::I2CDevice, public PollingComponent, publi
|
|||
void update() override;
|
||||
};
|
||||
|
||||
} // namespace ain4_20ma
|
||||
} // namespace ain4_20ma
|
||||
} // namespace esphome
|
||||
|
|
Loading…
Reference in New Issue