Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3ms delay before read sequence #24

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/SparkFun_SCD30_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ bool SCD30::readMeasurement()
if (_i2cPort->endTransmission() != 0)
return (0); //Sensor did not ACK

delay(3);

const uint8_t receivedBytes = _i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)18);
bool error = false;
if (_i2cPort->available())
Expand Down Expand Up @@ -358,6 +360,8 @@ bool SCD30::getSettingValue(uint16_t registerAddress, uint16_t *val)
if (_i2cPort->endTransmission() != 0)
return (false); //Sensor did not ACK

delay(3);

_i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)3); // Request data and CRC
if (_i2cPort->available())
{
Expand Down Expand Up @@ -389,6 +393,8 @@ uint16_t SCD30::readRegister(uint16_t registerAddress)
if (_i2cPort->endTransmission() != 0)
return (0); //Sensor did not ACK

delay(3);

_i2cPort->requestFrom((uint8_t)SCD30_ADDRESS, (uint8_t)2);
if (_i2cPort->available())
{
Expand Down