1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Revert "Edit SD Server example to use the new Write(Stream) method"

This reverts commit 4ae8a6d631d532409dde5ea35af03bccbb62974f.
This commit is contained in:
ficeto 2015-05-13 12:15:52 +03:00
parent 30228c3641
commit 2f45612bb8

View File

@ -111,10 +111,23 @@ bool loadFromSdCard(String path){
dataType = 0; dataType = 0;
path = 0; path = 0;
if(client.write(dataFile) != dataFile.size()){ uint8_t obuf[WWW_BUF_SIZE];
DBG_OUTPUT_PORT.println("Sent less data than expected!");
}
while (dataFile.available() > WWW_BUF_SIZE){
dataFile.read(obuf, WWW_BUF_SIZE);
if(client.write(obuf, WWW_BUF_SIZE) != WWW_BUF_SIZE){
DBG_OUTPUT_PORT.println("Sent less data than expected!");
dataFile.close();
return true;
}
}
uint16_t leftLen = dataFile.available();
dataFile.read(obuf, leftLen);
if(client.write(obuf, leftLen) != leftLen){
DBG_OUTPUT_PORT.println("Sent less data than expected!");
dataFile.close();
return true;
}
dataFile.close(); dataFile.close();
client.stop(); client.stop();
return true; return true;