Skip to content

Commit

Permalink
Merge pull request #450 from pgrawehr/I2CReplyLength
Browse files Browse the repository at this point in the history
Return only as many bytes as were received in I2C transfers.
  • Loading branch information
soundanalogous authored Apr 19, 2020
2 parents e5204be + 9eac4a8 commit a4e79c9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/StandardFirmata/StandardFirmata.ino
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down
1 change: 1 addition & 0 deletions examples/StandardFirmataBLE/StandardFirmataBLE.ino
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down
1 change: 1 addition & 0 deletions examples/StandardFirmataChipKIT/StandardFirmataChipKIT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down
1 change: 1 addition & 0 deletions examples/StandardFirmataPlus/StandardFirmataPlus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down
1 change: 1 addition & 0 deletions examples/StandardFirmataWiFi/StandardFirmataWiFi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes, byte stopTX
Firmata.sendString("I2C: Too many bytes received");
} else if (numBytes > Wire.available()) {
Firmata.sendString("I2C: Too few bytes received");
numBytes = Wire.available();
}

i2cRxData[0] = address;
Expand Down

0 comments on commit a4e79c9

Please sign in to comment.