Call send if the buffer would be full

This commit is contained in:
Kristian Sloth Lauszus 2013-05-07 00:37:43 +02:00
parent e6a557870b
commit 1dc75ae89f

View file

@ -736,7 +736,7 @@ size_t SPP::write(uint8_t data) {
size_t SPP::write(const uint8_t* data, size_t size) {
for(uint8_t i = 0; i < size; i++) {
if(sppIndex >= sizeof(sppOutputBuffer)/sizeof(sppOutputBuffer[0]))
return i; // Don't send any more if buffer is already full
send(); // Send the current data in the buffer
sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
}
return size;