From e0c8ebdd0c2c31a8c6ade180cf285272c7f495d7 Mon Sep 17 00:00:00 2001 From: Dominik Westner Date: Fri, 22 Oct 2021 15:30:32 +0200 Subject: [PATCH] Update mgos_sht31.c fix for issue #1 --- src/mgos_sht31.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mgos_sht31.c b/src/mgos_sht31.c index 5f38c79..7f2472f 100644 --- a/src/mgos_sht31.c +++ b/src/mgos_sht31.c @@ -93,11 +93,14 @@ struct mgos_sht31 *mgos_sht31_create(struct mgos_i2c *i2c, uint8_t i2caddr) { sensor->i2c = i2c; mgos_sht31_cmd(sensor, MGOS_SHT31_SOFTRESET); - + mgos_usleep(2000); // Toggle heater on and off, which shows up in status register bit 13 (0=Off, 1=On) status0 = mgos_sht31_status(sensor); // heater is off, bit13 is 0 + mgos_usleep(2000); mgos_sht31_cmd(sensor, MGOS_SHT31_HEATEREN); + mgos_usleep(2000); status1 = mgos_sht31_status(sensor); // heater is on, bit13 is 1 + mgos_usleep(2000); mgos_sht31_cmd(sensor, MGOS_SHT31_HEATERDIS); status2 = mgos_sht31_status(sensor); // heater is off, bit13 is 0