Skip to content

Small improvements in update example #552

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
Aug 1, 2017
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
13 changes: 10 additions & 3 deletions libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ bool isValidContentType = false;

// Your SSID and PSWD that the chip needs
// to connect to
char* SSID = "YOUR-SSID";
char* PSWD = "YOUR-SSID-PSWD";
const char* SSID = "YOUR-SSID";
const char* PSWD = "YOUR-SSID-PSWD";

// S3 Bucket Config
String host = "bucket-name.s3.ap-south-1.amazonaws.com"; // Host => bucket-name.s3.region.amazonaws.com
Expand Down Expand Up @@ -65,7 +65,14 @@ void execOTA() {
// "Cache-Control: no-cache\r\n" +
// "Connection: close\r\n\r\n");

delay(100);
unsigned long timeout = millis();
while (client.available() == 0) {
if (millis() - timeout > 5000) {
Serial.println("Client Timeout !");
client.stop();
return;
}
}
// Once the response is available,
// check stuff

Expand Down