1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00

Update while()

This commit is contained in:
peteGSX 2024-01-17 12:40:24 +10:00
parent 41befc99b1
commit 3af9cee9ad

View File

@ -192,7 +192,11 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t
DIAG(F("Wire.available()=%d"),Wire.available()); DIAG(F("Wire.available()=%d"),Wire.available());
// while (Wire.available() && nBytes < readSize) // while (Wire.available() && nBytes < readSize)
while (nBytes < readSize) while (nBytes < readSize)
if (Wire.available()) {
readBuffer[nBytes++] = Wire.read(); readBuffer[nBytes++] = Wire.read();
} else {
delay(1);
}
// DIAG(F("nBytes=%d,readBuffer[nBytes]=%d"),nBytes-1,readBuffer[nBytes-1]); // DIAG(F("nBytes=%d,readBuffer[nBytes]=%d"),nBytes-1,readBuffer[nBytes-1]);
if (nBytes < readSize) status = I2C_STATUS_TRUNCATED; if (nBytes < readSize) status = I2C_STATUS_TRUNCATED;
DIAG(F("status=%d"),status); DIAG(F("status=%d"),status);