Skip to content

fixes for sd server example #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from May 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,20 @@ bool loadFromSdCard(String path){
uint8_t obuf[WWW_BUF_SIZE];
while (dataFile.available() > WWW_BUF_SIZE){
dataFile.read(obuf, WWW_BUF_SIZE);
client.write(obuf, WWW_BUF_SIZE);
if(client.write(obuf, WWW_BUF_SIZE) != WWW_BUF_SIZE){
Serial.println("Sent less data than expected!");
dataFile.close();
return true;
}
}
//stream the last data left (size is at most WWW_BUF_SIZE bytes)
uint16_t leftLen = dataFile.available();
dataFile.read(obuf, leftLen);
client.write(obuf, leftLen);
if(client.write(obuf, leftLen) != leftLen){
Serial.println("Sent less data than expected!");
dataFile.close();
return true;
}

dataFile.close();
return true;
Expand Down Expand Up @@ -124,7 +132,7 @@ void setup(void){
while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);

//check if we have connected?
if(i == 20){
if(i == 21){
Serial.print("Could not connect to");
Serial.println(ssid);
//stop execution and wait forever
Expand Down