File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ int ENVClass::begin()
8686
8787 readHTS221Calibration ();
8888
89- // enable HTS221
90- i2cWrite (HTS221_ADDRESS, HTS221_CTRL1_REG, 0x80 );
89+ // turn on the HTS221 and enable Block Data Update
90+ i2cWrite (HTS221_ADDRESS, HTS221_CTRL1_REG, 0x84 );
9191
9292 // configure VEML6075 for 100 ms
9393 i2cWriteWord (VEML6075_ADDRESS, VEML6075_UV_CONF_REG, 0x0010 );
@@ -111,6 +111,9 @@ void ENVClass::end()
111111
112112float ENVClass::readTemperature (int units)
113113{
114+ // Wait for ONE_SHOT bit to be cleared by the hardware
115+ while (i2cRead (HTS221_ADDRESS, HTS221_CTRL2_REG) & 0x01 );
116+
114117 // trigger one shot
115118 i2cWrite (HTS221_ADDRESS, HTS221_CTRL2_REG, 0x01 );
116119
@@ -131,6 +134,9 @@ float ENVClass::readTemperature(int units)
131134
132135float ENVClass::readHumidity ()
133136{
137+ // Wait for ONE_SHOT bit to be cleared by the hardware
138+ while (i2cRead (HTS221_ADDRESS, HTS221_CTRL2_REG) & 0x01 );
139+
134140 // trigger one shot
135141 i2cWrite (HTS221_ADDRESS, HTS221_CTRL2_REG, 0x01 );
136142
You can’t perform that action at this time.
0 commit comments