Skip to content

Commit

Permalink
Merge pull request #3 from raphacosta/increase-buffersize
Browse files Browse the repository at this point in the history
[Suggested Fix] Not enough space in buffer
  • Loading branch information
psachs authored Jul 23, 2024
2 parents 781ac23 + ae291e2 commit 36e600e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/SensirionI2CSgp41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ uint16_t SensirionI2CSgp41::executeConditioning(uint16_t defaultRh,
uint16_t defaultT,
uint16_t& srawVoc) {
uint16_t error;
uint8_t buffer[8];
uint8_t buffer[16];
SensirionI2CTxFrame txFrame =
SensirionI2CTxFrame::createWithUInt16Command(0x2612, buffer, 8);
SensirionI2CTxFrame::createWithUInt16Command(0x2612, buffer, 16);

error = txFrame.addUInt16(defaultRh);
error |= txFrame.addUInt16(defaultT);
Expand All @@ -72,7 +72,7 @@ uint16_t SensirionI2CSgp41::executeConditioning(uint16_t defaultRh,

delay(50);

SensirionI2CRxFrame rxFrame(buffer, 8);
SensirionI2CRxFrame rxFrame(buffer, 16);
error = SensirionI2CCommunication::receiveFrame(SGP41_I2C_ADDRESS, 3,
rxFrame, *_i2cBus);
if (error) {
Expand All @@ -88,9 +88,9 @@ uint16_t SensirionI2CSgp41::measureRawSignals(uint16_t relativeHumidity,
uint16_t& srawVoc,
uint16_t& srawNox) {
uint16_t error;
uint8_t buffer[8];
uint8_t buffer[16];
SensirionI2CTxFrame txFrame =
SensirionI2CTxFrame::createWithUInt16Command(0x2619, buffer, 8);
SensirionI2CTxFrame::createWithUInt16Command(0x2619, buffer, 16);

error = txFrame.addUInt16(relativeHumidity);
error |= txFrame.addUInt16(temperature);
Expand All @@ -106,7 +106,7 @@ uint16_t SensirionI2CSgp41::measureRawSignals(uint16_t relativeHumidity,

delay(50);

SensirionI2CRxFrame rxFrame(buffer, 8);
SensirionI2CRxFrame rxFrame(buffer, 16);
error = SensirionI2CCommunication::receiveFrame(SGP41_I2C_ADDRESS, 6,
rxFrame, *_i2cBus);
if (error) {
Expand Down

0 comments on commit 36e600e

Please sign in to comment.