Skip to content

Commit e24584c

Browse files
authored
Merge pull request #10 from Rocketct/master
fix pressure readings
2 parents 052d676 + 836faae commit e24584c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MKRENV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ float ENVClass::readPressure(int units)
156156
// trigger one shot
157157
i2cWrite(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG, 0x01);
158158

159-
// wait for completion
160-
while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_STATUS_REG) & 0x02) == 0) {
159+
// wait for ONE_SHOT bit to be cleared by the hardware
160+
while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG) & 0x01) != 0) {
161161
yield();
162162
}
163163

0 commit comments

Comments
 (0)