mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Revert "Revert "Edit SD Server example to use the new Write(Stream) method""
This reverts commit 163a98375637ab8e3e177bb7853303e397e39dc0.
This commit is contained in:
parent
5eee3da4d5
commit
8d1c59842e
@ -111,23 +111,10 @@ bool loadFromSdCard(String path){
|
||||
dataType = 0;
|
||||
path = 0;
|
||||
|
||||
uint8_t obuf[WWW_BUF_SIZE];
|
||||
|
||||
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){
|
||||
if(client.write(dataFile) != dataFile.size()){
|
||||
DBG_OUTPUT_PORT.println("Sent less data than expected!");
|
||||
dataFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
dataFile.close();
|
||||
client.stop();
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user