Skip to content

Commit f04d65c

Browse files
Merge branch 'master' into reducei2ciram
2 parents 1c14e9e + 3890e1a commit f04d65c

File tree

5 files changed

+27
-28
lines changed

5 files changed

+27
-28
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ class BearSSLTraits : public TransportTraits
113113
* constructor
114114
*/
115115
HTTPClient::HTTPClient()
116+
: _client(nullptr), _userAgent(F("ESP8266HTTPClient"))
116117
{
117-
_client = nullptr;
118118
#if HTTPCLIENT_1_1_COMPATIBLE
119119
_tcpDeprecated.reset(nullptr);
120120
#endif
@@ -1294,21 +1294,21 @@ int HTTPClient::handleHeaderResponse()
12941294
String headerValue = headerLine.substring(headerLine.indexOf(':') + 1);
12951295
headerValue.trim();
12961296

1297-
if(headerName.equalsIgnoreCase("Content-Length")) {
1297+
if(headerName.equalsIgnoreCase(F("Content-Length"))) {
12981298
_size = headerValue.toInt();
12991299
}
13001300

1301-
if(_canReuse && headerName.equalsIgnoreCase("Connection")) {
1301+
if(_canReuse && headerName.equalsIgnoreCase(F("Connection"))) {
13021302
if(headerValue.indexOf("close") >= 0 && headerValue.indexOf("keep-alive") < 0) {
13031303
_canReuse = false;
13041304
}
13051305
}
13061306

1307-
if(headerName.equalsIgnoreCase("Transfer-Encoding")) {
1307+
if(headerName.equalsIgnoreCase(F("Transfer-Encoding"))) {
13081308
transferEncoding = headerValue;
13091309
}
13101310

1311-
if(headerName.equalsIgnoreCase("Location")) {
1311+
if(headerName.equalsIgnoreCase(F("Location"))) {
13121312
_location = headerValue;
13131313
}
13141314

@@ -1334,7 +1334,7 @@ int HTTPClient::handleHeaderResponse()
13341334

13351335
if(transferEncoding.length() > 0) {
13361336
DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Transfer-Encoding: %s\n", transferEncoding.c_str());
1337-
if(transferEncoding.equalsIgnoreCase("chunked")) {
1337+
if(transferEncoding.equalsIgnoreCase(F("chunked"))) {
13381338
_transferEncoding = HTTPC_TE_CHUNKED;
13391339
} else {
13401340
return HTTPC_ERROR_ENCODING;

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class HTTPClient
242242
String _uri;
243243
String _protocol;
244244
String _headers;
245-
String _userAgent = "ESP8266HTTPClient";
245+
String _userAgent;
246246
String _base64Authorization;
247247

248248
/// Response handling

libraries/ESP8266WebServer/src/Parsing-impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseRequest(ClientType& client) {
238238
DEBUG_OUTPUT.println(headerValue);
239239
#endif
240240

241-
if (headerName.equalsIgnoreCase("Host")){
241+
if (headerName.equalsIgnoreCase(F("Host"))){
242242
_hostHeader = headerValue;
243243
}
244244
}

libraries/ESP8266WiFi/src/ESP8266WiFi.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ extern "C" {
4949
* @param p Print interface
5050
*/
5151
void ESP8266WiFiClass::printDiag(Print& p) {
52-
const char* modes[] = { "NULL", "STA", "AP", "STA+AP" };
53-
p.print("Mode: ");
52+
const char* const modes[] = { "NULL", "STA", "AP", "STA+AP" };
53+
p.print(F("Mode: "));
5454
p.println(modes[wifi_get_opmode()]);
5555

56-
const char* phymodes[] = { "", "B", "G", "N" };
57-
p.print("PHY mode: ");
56+
const char* const phymodes[] = { "", "B", "G", "N" };
57+
p.print(F("PHY mode: "));
5858
p.println(phymodes[(int) wifi_get_phy_mode()]);
5959

60-
p.print("Channel: ");
60+
p.print(F("Channel: "));
6161
p.println(wifi_get_channel());
6262

63-
p.print("AP id: ");
63+
p.print(F("AP id: "));
6464
p.println(wifi_station_get_current_ap_id());
6565

66-
p.print("Status: ");
66+
p.print(F("Status: "));
6767
p.println(wifi_station_get_connect_status());
6868

69-
p.print("Auto connect: ");
69+
p.print(F("Auto connect: "));
7070
p.println(wifi_station_get_auto_connect());
7171

7272
struct station_config conf;
@@ -75,22 +75,14 @@ void ESP8266WiFiClass::printDiag(Print& p) {
7575
char ssid[33]; //ssid can be up to 32chars, => plus null term
7676
memcpy(ssid, conf.ssid, sizeof(conf.ssid));
7777
ssid[32] = 0; //nullterm in case of 32 char ssid
78-
79-
p.print("SSID (");
80-
p.print(strlen(ssid));
81-
p.print("): ");
82-
p.println(ssid);
78+
p.printf_P(PSTR("SSID (%d): %s\n"), strlen(ssid), ssid);
8379

8480
char passphrase[65];
8581
memcpy(passphrase, conf.password, sizeof(conf.password));
8682
passphrase[64] = 0;
83+
p.printf_P(PSTR("Passphrase (%d): %s\n"), strlen(passphrase), passphrase);
8784

88-
p.print("Passphrase (");
89-
p.print(strlen(passphrase));
90-
p.print("): ");
91-
p.println(passphrase);
92-
93-
p.print("BSSID set: ");
85+
p.print(F("BSSID set: "));
9486
p.println(conf.bssid_set);
9587

9688
}

tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
8080
return (uint16_t) res; /* This masks the lower half-word from the returned word */
8181
}
8282

83+
/* Can't legally cast bits of uint32_t to a float w/o conversion or std::memcpy, which is inefficient. */
84+
/* The ASM block doesn't care the type, so just pass in what C thinks is a float and return in custom fcn. */
85+
static inline float pgm_read_float_unaligned(const void *addr) {
86+
register float res;
87+
pgm_read_with_offset(addr, res);
88+
return res;
89+
}
90+
8391
#define pgm_read_byte(addr) pgm_read_byte_inlined(addr)
8492
#define pgm_read_word_aligned(addr) pgm_read_word_inlined(addr)
8593
#ifdef __cplusplus
@@ -98,7 +106,6 @@ static inline uint32_t pgm_read_dword_unaligned(const void *addr) {
98106
return res;
99107
}
100108

101-
#define pgm_read_float_unaligned(addr) ((float)pgm_read_dword_unaligned(addr))
102109
#define pgm_read_ptr_unaligned(addr) ((void*)pgm_read_dword_unaligned(addr))
103110
#define pgm_read_word_unaligned(addr) ((uint16_t)(pgm_read_dword_unaligned(addr) & 0xffff))
104111

0 commit comments

Comments
 (0)