1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Merge branch 'patch-1' of github.com:bobh66/Arduino into bobh66-patch-1

This commit is contained in:
Cristian Maglie 2014-01-28 19:01:26 +01:00
commit 9ebfe233b8

View File

@ -119,12 +119,15 @@ void File::doBuffer() {
// Try to buffer up to BUFFER_SIZE characters // Try to buffer up to BUFFER_SIZE characters
readPos = 0; readPos = 0;
uint8_t cmd[] = {'G', handle, BUFFER_SIZE - 1}; uint8_t cmd[] = {'G', handle, BUFFER_SIZE - 1};
buffered = bridge.transfer(cmd, 3, buffer, BUFFER_SIZE) - 1; buffered = bridge.transfer(cmd, 3, buffer, BUFFER_SIZE);
//err = buff[0]; // First byte is error code //err = buff[0]; // First byte is error code
if (buffered > 0) { if (BridgeClass::TRANSFER_TIMEOUT == buffered || 0 == buffered) {
// Shift the reminder of buffer // transfer failed to retrieve any data
for (uint8_t i = 0; i < buffered; i++) buffered = 0;
buffer[i] = buffer[i + 1]; } else {
// transfer retrieved at least one byte of data so skip the error code character
readPos++;
buffered--;
} }
} }