Skip to content

Commit fa381f6

Browse files
authored
Merge pull request #24 from yamamaya/yamamaya-patch-1
Add 3ms delay before read sequence
2 parents 4ca1f92 + 038066d commit fa381f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/SparkFun_SCD30_Arduino_Library.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ bool SCD30::readMeasurement()
266266
if (_i2cPort->endTransmission() != 0)
267267
return (0); //Sensor did not ACK
268268

269+
delay(3);
270+
269271
const uint8_t receivedBytes = _i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)18);
270272
bool error = false;
271273
if (_i2cPort->available())
@@ -358,6 +360,8 @@ bool SCD30::getSettingValue(uint16_t registerAddress, uint16_t *val)
358360
if (_i2cPort->endTransmission() != 0)
359361
return (false); //Sensor did not ACK
360362

363+
delay(3);
364+
361365
_i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)3); // Request data and CRC
362366
if (_i2cPort->available())
363367
{
@@ -389,6 +393,8 @@ uint16_t SCD30::readRegister(uint16_t registerAddress)
389393
if (_i2cPort->endTransmission() != 0)
390394
return (0); //Sensor did not ACK
391395

396+
delay(3);
397+
392398
_i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)2);
393399
if (_i2cPort->available())
394400
{

0 commit comments

Comments
 (0)