Skip to content

Commit 9e78b6d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ota_commands_in_flash
2 parents e67ebc5 + 916eb89 commit 9e78b6d

File tree

20 files changed

+149
-54
lines changed

20 files changed

+149
-54
lines changed

cores/esp8266/core_esp8266_features.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232

3333
#define WIFI_HAS_EVENT_CALLBACK
3434

35-
#ifdef __cplusplus
36-
3735
#include <stdlib.h> // malloc()
3836
#include <stddef.h> // size_t
37+
#include <stdint.h>
38+
39+
#ifdef __cplusplus
3940

4041
namespace arduino
4142
{

cores/esp8266/core_esp8266_main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ static void esp_yield_within_cont() {
100100
run_scheduled_recurrent_functions();
101101
}
102102

103-
extern "C" void esp_yield() {
103+
extern "C" void __esp_yield() {
104104
if (can_yield()) {
105105
esp_yield_within_cont();
106106
}
107107
}
108108

109-
extern "C" void esp_schedule() {
110-
// always on CONT stack here
109+
extern "C" void esp_yield() __attribute__ ((weak, alias("__esp_yield")));
110+
111+
extern "C" IRAM_ATTR void esp_schedule() {
111112
ets_post(LOOP_TASK_PRIORITY, 0, 0);
112113
}
113114

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ bool HTTPClient::setURL(const String& url)
551551
}
552552
// disconnect but preserve _client
553553
disconnect(true);
554-
clear();
555554
return beginInternal(url, nullptr);
556555
}
557556

libraries/ESP8266SSDP/ESP8266SSDP.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static const char _ssdp_packet_template[] PROGMEM =
7373
"SERVER: Arduino/1.0 UPNP/1.1 %s/%s\r\n" // _modelName, _modelNumber
7474
"USN: %s\r\n" // _uuid
7575
"%s: %s\r\n" // "NT" or "ST", _deviceType
76-
"LOCATION: http://%u.%u.%u.%u:%u/%s\r\n" // WiFi.localIP(), _port, _schemaURL
76+
"LOCATION: http://%s:%u/%s\r\n" // WiFi.localIP(), _port, _schemaURL
7777
"\r\n";
7878

7979
static const char _ssdp_schema_template[] PROGMEM =
@@ -88,7 +88,7 @@ static const char _ssdp_schema_template[] PROGMEM =
8888
"<major>1</major>"
8989
"<minor>0</minor>"
9090
"</specVersion>"
91-
"<URLBase>http://%u.%u.%u.%u:%u/</URLBase>" // WiFi.localIP(), _port
91+
"<URLBase>http://%s:%u/</URLBase>" // WiFi.localIP(), _port
9292
"<device>"
9393
"<deviceType>%s</deviceType>"
9494
"<friendlyName>%s</friendlyName>"
@@ -247,7 +247,7 @@ void SSDPClass::_send(ssdp_method_t method) {
247247
_uuid,
248248
(method == NONE) ? "ST" : "NT",
249249
(_st_is_uuid) ? _uuid : _deviceType,
250-
ip[0], ip[1], ip[2], ip[3], _port, _schemaURL
250+
ip.toString().c_str(), _port, _schemaURL
251251
);
252252

253253
_server->append(buffer, len);
@@ -276,12 +276,12 @@ void SSDPClass::_send(ssdp_method_t method) {
276276
_server->send(remoteAddr, remotePort);
277277
}
278278

279-
void SSDPClass::schema(WiFiClient client) {
279+
void SSDPClass::schema(Print &client) const {
280280
IPAddress ip = WiFi.localIP();
281281
char buffer[strlen_P(_ssdp_schema_template) + 1];
282282
strcpy_P(buffer, _ssdp_schema_template);
283283
client.printf(buffer,
284-
ip[0], ip[1], ip[2], ip[3], _port,
284+
ip.toString().c_str(), _port,
285285
_deviceType,
286286
_friendlyName,
287287
_presentationURL,

libraries/ESP8266SSDP/ESP8266SSDP.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ class SSDPClass{
6262
~SSDPClass();
6363
bool begin();
6464
void end();
65-
void schema(WiFiClient client);
65+
void schema(WiFiClient client) const { schema((Print&)std::ref(client)); }
66+
void schema(Print &print) const;
6667
void setDeviceType(const String& deviceType) { setDeviceType(deviceType.c_str()); }
6768
void setDeviceType(const char *deviceType);
6869

libraries/ESP8266SdFat

libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ void setup(void) {
6767
server.send(200, "text/plain", "this works as well");
6868
});
6969

70+
server.on("/gif", []() {
71+
static const uint8_t gif[] PROGMEM = {
72+
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80, 0x01,
73+
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00,
74+
0x10, 0x00, 0x10, 0x00, 0x00, 0x02, 0x19, 0x8c, 0x8f, 0xa9, 0xcb, 0x9d,
75+
0x00, 0x5f, 0x74, 0xb4, 0x56, 0xb0, 0xb0, 0xd2, 0xf2, 0x35, 0x1e, 0x4c,
76+
0x0c, 0x24, 0x5a, 0xe6, 0x89, 0xa6, 0x4d, 0x01, 0x00, 0x3b
77+
};
78+
char gif_colored[sizeof(gif)];
79+
memcpy_P(gif_colored, gif, sizeof(gif));
80+
// Set the background to a random set of colors
81+
gif_colored[16] = millis() % 256;
82+
gif_colored[17] = millis() % 256;
83+
gif_colored[18] = millis() % 256;
84+
server.send(200, "image/gif", gif_colored, sizeof(gif_colored));
85+
});
86+
7087
server.onNotFound(handleNotFound);
7188

7289
server.begin();

libraries/ESP8266WebServer/examples/SDWebServer/SDWebServer.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ void printDirectory() {
241241
entry.close();
242242
}
243243
server.sendContent("]");
244+
server.sendContent(""); // Terminate the HTTP chunked transmission with a 0-length chunk
244245
dir.close();
245246
}
246247

libraries/ESP8266WebServer/src/ESP8266WebServer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ class ESP8266WebServerTemplate
127127
void send(int code, const char* content_type = NULL, const String& content = String(""));
128128
void send(int code, char* content_type, const String& content);
129129
void send(int code, const String& content_type, const String& content);
130+
void send(int code, const char *content_type, const char *content, size_t content_length = 0) {
131+
if (content_length == 0) {
132+
content_length = strlen_P(content);
133+
}
134+
send_P(code, content_type, content, content_length);
135+
}
136+
void send(int code, const char *content_type, const uint8_t *content, size_t content_length) {
137+
send_P(code, content_type, (const char *)content, content_length);
138+
}
130139
void send_P(int code, PGM_P content_type, PGM_P content);
131140
void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength);
132141

libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
102102
// Append whatever follows this URI in request to get the file path.
103103
path += requestUri.substring(_baseUriLength);
104104

105-
if (!_fs.exists(path) && path.endsWith(".htm")) {
105+
if (!_fs.exists(path) && path.endsWith(".htm") && _fs.exists(path + "l")) {
106106
path += "l";
107107
}
108108
}

0 commit comments

Comments
 (0)