Skip to content

Commit

Permalink
Merge pull request #36 from ab-tools/master
Browse files Browse the repository at this point in the history
Blocking Operation of Single Shot Measurement Now Optional
  • Loading branch information
psachs authored Jul 23, 2024
2 parents c02b6bd + 1bbaf9c commit 229d854
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/SensirionI2CScd4x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ uint16_t SensirionI2CScd4x::reinit() {
return error;
}

uint16_t SensirionI2CScd4x::measureSingleShot() {
uint16_t SensirionI2CScd4x::measureSingleShot(bool blocking) {
uint16_t error;
uint8_t buffer[2];
SensirionI2CTxFrame txFrame(buffer, 2);
Expand All @@ -600,7 +600,11 @@ uint16_t SensirionI2CScd4x::measureSingleShot() {

error = SensirionI2CCommunication::sendFrame(SCD4X_I2C_ADDRESS, txFrame,
*_i2cBus);
delay(5000);

if (blocking) {
delay(5000);
}

return error;
}

Expand Down
4 changes: 3 additions & 1 deletion src/SensirionI2CScd4x.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,13 @@ class SensirionI2CScd4x {
* relative humidity and temperature. The sensor output is read with the
* read_measurement command.
*
* @param blocking Delay for 5 seconds till on-demand measurement is available
*
* @note Only available in idle mode.
*
* @return 0 on success, an error code otherwise
*/
uint16_t measureSingleShot(void);
uint16_t measureSingleShot(bool blocking = true);

/**
* measureSingleShotRhtOnly() - On-demand measurement of relative humidity
Expand Down

0 comments on commit 229d854

Please sign in to comment.