1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-29 05:21:37 +03:00

Merge branch 'master' into wifi_mesh_update_2.2

This commit is contained in:
Earle F. Philhower, III
2019-07-28 12:17:03 -07:00
committed by GitHub
67 changed files with 417 additions and 229 deletions

View File

@ -16,7 +16,7 @@ static const char serverIndex[] PROGMEM =
</form>
</body></html>)";
static const char successResponse[] PROGMEM =
"<META http-equiv=\"refresh\" content=\"15;URL=/\">Update Success! Rebooting...\n";
"<META http-equiv=\"refresh\" content=\"15;URL=/\">Update Success! Rebooting...";
template <typename ServerType>
ESP8266HTTPUpdateServerTemplate<ServerType>::ESP8266HTTPUpdateServerTemplate(bool serial_debug)

View File

@ -156,7 +156,7 @@ bool ESP8266NetBIOS::begin(const char *name)
}
_pcb = udp_new();
udp_recv(_pcb, &_s_recv, (void *) this);
err_t err = udp_bind(_pcb, INADDR_ANY, NBNS_PORT);
err_t err = udp_bind(_pcb, (ip_addr_t*)INADDR_ANY, NBNS_PORT);
if(err != ERR_OK) {
end();
return false;

View File

@ -135,6 +135,8 @@ public:
void sendContent(const String& content);
void sendContent_P(PGM_P content);
void sendContent_P(PGM_P content, size_t size);
void sendContent(const char *content) { sendContent_P(content); }
void sendContent(const char *content, size_t size) { sendContent_P(content, size); }
static String credentialHash(const String& username, const String& realm, const String& password);
@ -216,6 +218,7 @@ protected:
using ESP8266WebServer = esp8266webserver::ESP8266WebServerTemplate<WiFiServer>;
using RequestHandler = esp8266webserver::RequestHandler<WiFiServer>;
#endif //ESP8266WEBSERVER_H

View File

@ -473,7 +473,7 @@ extern "C" int __ax_port_read(int fd, uint8_t* buffer, size_t count)
}
return cb;
}
extern "C" void ax_port_read() __attribute__ ((weak, alias("__ax_port_read")));
extern "C" int ax_port_read(int fd, uint8_t* buffer, size_t count) __attribute__ ((weak, alias("__ax_port_read")));
extern "C" int __ax_port_write(int fd, uint8_t* buffer, size_t count)
{
@ -489,7 +489,7 @@ extern "C" int __ax_port_write(int fd, uint8_t* buffer, size_t count)
}
return cb;
}
extern "C" void ax_port_write() __attribute__ ((weak, alias("__ax_port_write")));
extern "C" int ax_port_write(int fd, uint8_t* buffer, size_t count) __attribute__ ((weak, alias("__ax_port_write")));
extern "C" int __ax_get_file(const char *filename, uint8_t **buf)
{
@ -497,7 +497,7 @@ extern "C" int __ax_get_file(const char *filename, uint8_t **buf)
*buf = 0;
return 0;
}
extern "C" void ax_get_file() __attribute__ ((weak, alias("__ax_get_file")));
extern "C" int ax_get_file(const char *filename, uint8_t **buf) __attribute__ ((weak, alias("__ax_get_file")));
extern "C" void __ax_wdt_feed()
{

View File

@ -654,6 +654,13 @@ extern "C" {
if (!xc->done_cert) {
br_sha1_update(&xc->sha1_cert, buf, len);
br_x509_decoder_push(&xc->ctx, (const void*)buf, len);
#ifdef DEBUG_ESP_SSL
DEBUG_BSSL("CERT: ");
for (size_t i=0; i<len; i++) {
DEBUG_ESP_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
}
DEBUG_ESP_PORT.printf_P(PSTR("\n"));
#endif
}
}
@ -676,7 +683,24 @@ extern "C" {
char res[20];
br_sha1_out(&xc->sha1_cert, res);
if (xc->match_fingerprint && memcmp(res, xc->match_fingerprint, sizeof(res))) {
#ifdef DEBUG_ESP_SSL
DEBUG_BSSL("insecure_end_chain: Received cert FP doesn't match\n");
char buff[3 * sizeof(res) + 1]; // 3 chars per byte XX_, and null
buff[0] = 0;
for (size_t i=0; i<sizeof(res); i++) {
char hex[4]; // XX_\0
snprintf(hex, sizeof(hex), "%02x ", xc->match_fingerprint[i] & 0xff);
strlcat(buff, hex, sizeof(buff));
}
DEBUG_BSSL("insecure_end_chain: expected %s\n", buff);
buff[0] =0;
for (size_t i=0; i<sizeof(res); i++) {
char hex[4]; // XX_\0
snprintf(hex, sizeof(hex), "%02x ", res[i] & 0xff);
strlcat(buff, hex, sizeof(buff));
}
DEBUG_BSSL("insecure_end_chain: received %s\n", buff);
#endif
return BR_ERR_X509_NOT_TRUSTED;
}

View File

@ -37,6 +37,8 @@ class WiFiClientSecure : public WiFiClient {
WiFiClientSecure(const WiFiClientSecure &rhs);
~WiFiClientSecure() override;
WiFiClientSecure& operator=(const WiFiClientSecure&) = default; // The shared-ptrs handle themselves automatically
int connect(IPAddress ip, uint16_t port) override;
int connect(const String& host, uint16_t port) override;
int connect(const char* name, uint16_t port) override;

View File

@ -62,6 +62,8 @@ class WiFiServerSecure : public WiFiServer {
void setServerKeyAndCert(const uint8_t *key, int keyLen, const uint8_t *cert, int certLen);
void setServerKeyAndCert_P(const uint8_t *key, int keyLen, const uint8_t *cert, int certLen);
WiFiServerSecure& operator=(const WiFiServerSecure&) = default;
using ClientType = WiFiClientSecure;
private:

View File

@ -1051,7 +1051,7 @@ bool MDNSResponder::setHostProbeResultCallback(MDNSResponder::MDNSHostProbeFn p_
bool MDNSResponder::setHostProbeResultCallback(MDNSHostProbeFn1 pfn) {
using namespace std::placeholders;
return setHostProbeResultCallback([resp=std::ref(*this), pfn](const char* p_pcDomainName, bool p_bProbeResult) { pfn(resp, p_pcDomainName, p_bProbeResult); });
return setHostProbeResultCallback([this, pfn](const char* p_pcDomainName, bool p_bProbeResult) { pfn(*this, p_pcDomainName, p_bProbeResult); });
}
/*
@ -1080,8 +1080,8 @@ bool MDNSResponder::setServiceProbeResultCallback(const MDNSResponder::hMDNSServ
bool MDNSResponder::setServiceProbeResultCallback(const MDNSResponder::hMDNSService p_hService,
MDNSResponder::MDNSServiceProbeFn1 p_fnCallback) {
using namespace std::placeholders;
return setServiceProbeResultCallback(p_hService, [resp=std::ref(*this), p_fnCallback](const char* p_pcServiceName, const hMDNSService p_hMDNSService, bool p_bProbeResult) {
p_fnCallback(resp, p_pcServiceName, p_hMDNSService, p_bProbeResult);
return setServiceProbeResultCallback(p_hService, [this, p_fnCallback](const char* p_pcServiceName, const hMDNSService p_hMDNSService, bool p_bProbeResult) {
p_fnCallback(*this, p_pcServiceName, p_hMDNSService, p_bProbeResult);
});
}

View File

@ -900,7 +900,7 @@ void ATTR_GDBINIT gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), vo
//gdbstub initialization routine.
void ATTR_GDBINIT gdbstub_init() {
void gdbstub_init() {
#if GDBSTUB_REDIRECT_CONSOLE_OUTPUT
os_install_putc1(gdbstub_semihost_putchar1);
#endif
@ -923,4 +923,4 @@ bool ATTR_GDBEXTERNFN gdb_present() {
}
void ATTR_GDBFN gdb_do_break() { gdbstub_do_break(); }
void ATTR_GDBINIT gdb_init() __attribute__((alias("gdbstub_init")));
void gdb_init() __attribute__((alias("gdbstub_init")));

View File

@ -32,7 +32,7 @@ public:
Ticker();
~Ticker();
typedef void (*callback_with_arg_t)(void*);
typedef void (*callback_with_arg_t)(void *);
typedef std::function<void(void)> callback_function_t;
void attach_scheduled(float seconds, callback_function_t callback)
@ -64,14 +64,14 @@ public:
// C-cast serves two purposes:
// static_cast for smaller integer types,
// reinterpret_cast + const_cast for pointer types
_attach_s(seconds, true, reinterpret_cast<callback_with_arg_t>(callback), (void*)arg);
_attach_s(seconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg>
void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
{
static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)");
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), (void*)arg);
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
void once_scheduled(float seconds, callback_function_t callback)
@ -100,14 +100,14 @@ public:
void once(float seconds, void (*callback)(TArg), TArg arg)
{
static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)");
_attach_s(seconds, false, reinterpret_cast<callback_with_arg_t>(callback), (void*)arg);
_attach_s(seconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg>
void once_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
{
static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)");
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), (void*)arg);
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
void detach();
@ -122,7 +122,6 @@ protected:
private:
void _attach_s(float seconds, bool repeat, callback_with_arg_t callback, void* arg);
//char _etsTimerMem[sizeof(ETSTimer)];
ETSTimer _etsTimer;
};

View File

@ -14,12 +14,17 @@
#include <Ticker.h>
Ticker tickerSetHigh;
Ticker tickerSetAnalog;
Ticker tickerSetLow;
void setPin(int state) {
digitalWrite(LED_BUILTIN, state);
}
void setPinChar(char state) {
digitalWrite(LED_BUILTIN, state);
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(1, LOW);
@ -27,8 +32,9 @@ void setup() {
// every 25 ms, call setPin(0)
tickerSetLow.attach_ms(25, setPin, 0);
// every 26 ms, call setPin(1)
tickerSetHigh.attach_ms(26, setPin, 1);
// every 26 ms, call setPinChar(1)
tickerSetHigh.attach_ms(26, setPinChar, (char)1);
}
void loop() {