Skip to content

Commit dce7bc9

Browse files
authored
Merge branch 'espressif:master' into master
2 parents cd56d8d + 6e47e18 commit dce7bc9

File tree

11 files changed

+81
-14
lines changed

11 files changed

+81
-14
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Now you can install the latest 2.0.0 version from the boards manager.
2525

2626
Latest Stable Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/)
2727

28-
Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/)
28+
Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/)
2929

3030
### Documentation
3131

cores/esp32/esp32-hal-time.c

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ static void setTimeZone(long offset, int daylight)
4444
/*
4545
* configTime
4646
* Source: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/time.c
47+
* Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
48+
* see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
4749
* */
4850
void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
4951
{
@@ -63,6 +65,8 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1,
6365
/*
6466
* configTzTime
6567
* sntp setup using TZ environment variable
68+
* Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
69+
* see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
6670
* */
6771
void configTzTime(const char* tz, const char* server1, const char* server2, const char* server3)
6872
{

cores/esp32/esp32-hal-uart.c

+2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ static void uartEnableInterrupt(uart_t* uart, uint8_t rxfifo_full_thrhd)
164164
static void uartDisableInterrupt(uart_t* uart)
165165
{
166166
UART_MUTEX_LOCK();
167+
#if CONFIG_IDF_TARGET_ESP32
167168
uart->dev->conf1.val = 0;
169+
#endif
168170
uart->dev->int_ena.val = 0;
169171
uart->dev->int_clr.val = 0xffffffff;
170172

libraries/FFat/examples/FFat_time/FFat_time.ino

+4
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ void setup(){
148148
Serial.println("IP address: ");
149149
Serial.println(WiFi.localIP());
150150
Serial.println("Contacting Time Server");
151+
/*
152+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
153+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
154+
*/
151155
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
152156
struct tm tmstruct ;
153157
delay(2000);

libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ WiFiMulti WiFiMulti;
1717

1818
// Set time via NTP, as required for x.509 validation
1919
void setClock() {
20+
/*
21+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
22+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
23+
*/
2024
configTime(0, 0, "pool.ntp.org", "time.nist.gov"); // UTC
2125

2226
Serial.print(F("Waiting for NTP time sync: "));

libraries/LittleFS/examples/LITTLEFS_time/LITTLEFS_time.ino

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ void setup(){
160160
Serial.println("IP address: ");
161161
Serial.println(WiFi.localIP());
162162
Serial.println("Contacting Time Server");
163+
/*
164+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
165+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
166+
*/
163167
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
164168
struct tm tmstruct ;
165169
delay(2000);

libraries/SD/examples/SD_time/SD_time.ino

+4
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ void setup(){
164164
Serial.println("IP address: ");
165165
Serial.println(WiFi.localIP());
166166
Serial.println("Contacting Time Server");
167+
/*
168+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
169+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
170+
*/
167171
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
168172
struct tm tmstruct ;
169173
delay(2000);

libraries/SD_MMC/examples/SDMMC_time/SDMMC_time.ino

+4
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ void setup(){
164164
Serial.println("IP address: ");
165165
Serial.println(WiFi.localIP());
166166
Serial.println("Contacting Time Server");
167+
/*
168+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
169+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
170+
*/
167171
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
168172
struct tm tmstruct ;
169173
delay(2000);

libraries/SPIFFS/examples/SPIFFS_time/SPIFFS_time.ino

+4
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ void setup(){
148148
Serial.println("IP address: ");
149149
Serial.println(WiFi.localIP());
150150
Serial.println("Contacting Time Server");
151+
/*
152+
Note: Bundled Arduino lwip supports only ONE ntp server, 2nd and 3rd options are silently ignored
153+
see CONFIG_LWIP_DHCP_MAX_NTP_SERVERS define in ./tools/sdk/esp32/sdkconfig
154+
*/
151155
configTime(3600*timezone, daysavetime*3600, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
152156
struct tm tmstruct ;
153157
delay(2000);

libraries/WiFiClientSecure/src/ssl_client.cpp

+50-13
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,67 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
7676
return -1;
7777
}
7878

79+
fcntl( ssl_client->socket, F_SETFL, fcntl( ssl_client->socket, F_GETFL, 0 ) | O_NONBLOCK );
7980
struct sockaddr_in serv_addr;
8081
memset(&serv_addr, 0, sizeof(serv_addr));
8182
serv_addr.sin_family = AF_INET;
8283
serv_addr.sin_addr.s_addr = srv;
8384
serv_addr.sin_port = htons(port);
8485

85-
if (lwip_connect(ssl_client->socket, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == 0) {
86-
if(timeout <= 0){
87-
timeout = 30000; // Milli seconds.
88-
}
89-
timeval so_timeout = { .tv_sec = timeout / 1000, .tv_usec = (timeout % 1000) * 1000 };
86+
if(timeout <= 0){
87+
timeout = 30000; // Milli seconds.
88+
}
9089

91-
#define ROE(x,msg) { if (((x)<0)) { log_e("LWIP Socket config of " msg " failed."); return -1; }}
92-
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_RCVTIMEO, &so_timeout, sizeof(so_timeout)),"SO_RCVTIMEO");
93-
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_SNDTIMEO, &so_timeout, sizeof(so_timeout)),"SO_SNDTIMEO");
90+
fd_set fdset;
91+
struct timeval tv;
92+
FD_ZERO(&fdset);
93+
FD_SET(ssl_client->socket, &fdset);
94+
tv.tv_sec = timeout / 1000;
95+
tv.tv_usec = (timeout % 1000) * 1000;
9496

95-
ROE(lwip_setsockopt(ssl_client->socket, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable)),"TCP_NODELAY");
96-
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)),"SO_KEEPALIVE");
97-
} else {
98-
log_e("Connect to Server failed!");
97+
int res = lwip_connect(ssl_client->socket, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
98+
if (res < 0 && errno != EINPROGRESS) {
99+
log_e("connect on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
100+
close(ssl_client->socket);
99101
return -1;
100102
}
101103

102-
fcntl( ssl_client->socket, F_SETFL, fcntl( ssl_client->socket, F_GETFL, 0 ) | O_NONBLOCK );
104+
res = select(ssl_client->socket + 1, nullptr, &fdset, nullptr, timeout<0 ? nullptr : &tv);
105+
if (res < 0) {
106+
log_e("select on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
107+
close(ssl_client->socket);
108+
return -1;
109+
} else if (res == 0) {
110+
log_i("select returned due to timeout %d ms for fd %d", timeout, ssl_client->socket);
111+
close(ssl_client->socket);
112+
return -1;
113+
} else {
114+
int sockerr;
115+
socklen_t len = (socklen_t)sizeof(int);
116+
res = getsockopt(ssl_client->socket, SOL_SOCKET, SO_ERROR, &sockerr, &len);
117+
118+
if (res < 0) {
119+
log_e("getsockopt on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
120+
close(ssl_client->socket);
121+
return -1;
122+
}
123+
124+
if (sockerr != 0) {
125+
log_e("socket error on fd %d, errno: %d, \"%s\"", ssl_client->socket, sockerr, strerror(sockerr));
126+
close(ssl_client->socket);
127+
return -1;
128+
}
129+
}
130+
131+
132+
#define ROE(x,msg) { if (((x)<0)) { log_e("LWIP Socket config of " msg " failed."); return -1; }}
133+
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)),"SO_RCVTIMEO");
134+
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)),"SO_SNDTIMEO");
135+
136+
ROE(lwip_setsockopt(ssl_client->socket, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable)),"TCP_NODELAY");
137+
ROE(lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)),"SO_KEEPALIVE");
138+
139+
103140

104141
log_v("Seeding the random number generator");
105142
mbedtls_entropy_init(&ssl_client->entropy_ctx);

tools/sdk/esp32/lib/libesp32-camera.a

-217 KB
Binary file not shown.

0 commit comments

Comments
 (0)