8000 Small improvements in update example (#552) · chemicstry/arduino-esp32@5c1b10f · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c1b10f

Browse files
copercinime-no-dev
authored andcommitted
Small improvements in update example (espressif#552)
- 100ms is too low to get server response
1 parent 2aed417 commit 5c1b10f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libraries/Update/examples/AWS_S3_OTA_Update/AWS_S3_OTA_Update.ino

Lines changed: 10 additions & 3 deletions
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)
0