Skip to content

Commit 1e2e6cb

Browse files
committed
fixed extra creation of esp-idf i2c handles
1 parent acd474d commit 1e2e6cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/arduino_io.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int bbepI2CWrite(unsigned char iAddr, unsigned char *pData, int iLen)
336336
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
337337
i2c_device_config_t dev_config;
338338

339-
if (my_dev_handle || u8Address != iAddr) {
339+
if (!my_dev_handle || u8Address != iAddr) {
340340
if (my_dev_handle) {
341341
ESP_ERROR_CHECK(i2c_master_bus_rm_device(my_dev_handle));
342342
my_dev_handle = 0;
@@ -381,7 +381,7 @@ int i = 0;
381381
esp_err_t ret;
382382
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
383383
i2c_device_config_t dev_config;
384-
if (my_dev_handle || u8Address != iAddr) {
384+
if (!my_dev_handle || u8Address != iAddr) {
385385
if (my_dev_handle) {
386386
ESP_ERROR_CHECK(i2c_master_bus_rm_device(my_dev_handle));
387387
my_dev_handle = 0;

0 commit comments

Comments
 (0)