From 6fcc35325037c7fa3ad4fa6bfb563a774fea2b35 Mon Sep 17 00:00:00 2001 From: Jason K <jason.kania@ymail.com> Date: Mon, 21 Aug 2017 23:15:26 -0400 Subject: [PATCH] Change to retry setting up I2C command rather than waiting without making a reattempt. --- cores/esp32/esp32-hal-i2c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index e5354b91faa..ae16216a408 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -445,7 +445,8 @@ void i2cInitFix(i2c_t * i2c){ i2c->dev->fifo_data.data = 0; i2cSetCmd(i2c, 1, I2C_CMD_WRITE, 1, false, false, false); i2cSetCmd(i2c, 2, I2C_CMD_STOP, 0, false, false, false); - i2c->dev->ctr.trans_start = 1; - while(!i2c->dev->command[2].done); + do { + i2c->dev->ctr.trans_start = 1; + } while(!i2c->dev->command[2].done); I2C_MUTEX_UNLOCK(); }