Fix I2C clock stretch limit to fix BNO085 resets

This commit is contained in:
Eiren Rain
2021-05-27 21:27:40 +03:00
parent 17f6ba7a0d
commit a76e9bdb2b
2 changed files with 2 additions and 3 deletions

View File

@@ -1339,7 +1339,7 @@ void BNO080::saveCalibration()
//Returns false if failed
boolean BNO080::waitForI2C()
{
for (uint8_t counter = 0; counter < 255; counter++) //Don't got more than 255
for (uint8_t counter = 0; counter < 100; counter++) //Don't got more than 255
{
if (_i2cPort->available() > 0)
return (true);

View File

@@ -83,9 +83,8 @@ void setup()
digitalWrite(LOADING_LED, LOW);
// join I2C bus
Wire.flush();
Wire.begin(PIN_IMU_SDA, PIN_IMU_SCL);
Wire.setClockStretchLimit(4000);
Wire.setClockStretchLimit(150000L); // Default streatch limit 150mS
Wire.setClock(100000);
Serial.begin(serialBaudRate);
while (!Serial)