Insist on writing stream data in buffer-sized blocks.

Maintaining alignment improves SD card write performance significantly.
This commit is contained in:
Jared Boone 2016-04-06 11:26:32 -07:00
parent 0d8971cd7d
commit ba3c9dd8d1

View File

@ -121,8 +121,8 @@ private:
const auto bytes_to_write = stream.read(write_buffer->data(), write_buffer->size()); const auto bytes_to_write = stream.read(write_buffer->data(), write_buffer->size());
if( bytes_to_write ) { if( bytes_to_write == write_buffer->size() ) {
if( !file.write(write_buffer->data(), bytes_to_write) ) { if( !file.write(write_buffer->data(), write_buffer->size()) ) {
led_tx.on(); led_tx.on();
break; break;
} }