Skip to content

Commit f12bd80

Browse files
coperciniRaienryu97
authored andcommitted
Small improvements in update example (espressif#552)
- 100ms is too low to get server response
1 parent dad6c68 commit f12bd80

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino

+10-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bool isValidContentType = false;
3131

3232
// Your SSID and PSWD that the chip needs
3333
// to connect to
34-
char* SSID = "YOUR-SSID";
35-
char* PSWD = "YOUR-SSID-PSWD";
34+
const char* SSID = "YOUR-SSID";
35+
const char* PSWD = "YOUR-SSID-PSWD";
3636

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

68-
delay(100);
68+
unsigned long timeout = millis();
69+
while (client.available() == 0) {
70+
if (millis() - timeout > 5000) {
71+
Serial.println("Client Timeout !");
72+
client.stop();
73+
return;
74+
}
75+
}
6976
// Once the response is available,
7077
// check stuff
7178

0 commit comments

Comments
 (0)