File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/SDWebServer Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -111,10 +111,23 @@ bool loadFromSdCard(String path){
111
111
dataType = 0 ;
112
112
path = 0 ;
113
113
114
- if (client.write (dataFile) != dataFile.size ()){
114
+ uint8_t obuf[WWW_BUF_SIZE];
115
+
116
+ while (dataFile.available () > WWW_BUF_SIZE){
117
+ dataFile.read (obuf, WWW_BUF_SIZE);
118
+ if (client.write (obuf, WWW_BUF_SIZE) != WWW_BUF_SIZE){
119
+ DBG_OUTPUT_PORT.println (" Sent less data than expected!" );
120
+ dataFile.close ();
121
+ return true ;
122
+ }
123
+ }
124
+ uint16_t leftLen = dataFile.available ();
125
+ dataFile.read (obuf, leftLen);
126
+ if (client.write (obuf, leftLen) != leftLen){
115
127
DBG_OUTPUT_PORT.println (" Sent less data than expected!" );
128
+ dataFile.close ();
129
+ return true ;
116
130
}
117
-
118
131
dataFile.close ();
119
132
client.stop ();
120
133
return true ;
You can’t perform that action at this time.
0 commit comments