Skip to content

Commit 091f2d2

Browse files
committed
Check for an I2C timeout in getData. receivePacket should return false if getData returns false
1 parent eb30aa0 commit 091f2d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SparkFun_BNO080_Arduino_Library.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,10 @@ boolean BNO080::receivePacket(void)
14851485
}
14861486
dataLength -= 4; //Remove the header bytes from the data count
14871487

1488-
getData(dataLength, channelNumber, sequenceNumber);
1488+
if (getData(dataLength, channelNumber, sequenceNumber) == false)
1489+
{
1490+
return (false); // If getData returns false - due to an I2C timeout - return false
1491+
}
14891492
}
14901493

14911494
return (true); //We're done!

0 commit comments

Comments
 (0)