1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Wyatt Neal 2016-01-10 09:41:52 -05:00
commit e34ded1821
28 changed files with 222 additions and 43 deletions

View File

@ -177,16 +177,16 @@ generic.menu.Debug.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial
generic.menu.Debug.Serial1=Serial1 generic.menu.Debug.Serial1=Serial1
generic.menu.Debug.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 generic.menu.Debug.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1
generic.menu.DebugLevel.None=None generic.menu.DebugLevel.None____=None
generic.menu.DebugLevel.None.build.debug_level= generic.menu.DebugLevel.None____.build.debug_level=
generic.menu.DebugLevel.Core=Core generic.menu.DebugLevel.Core____=Core
generic.menu.DebugLevel.Core.build.debug_level=-DDEBUG_ESP_CORE generic.menu.DebugLevel.Core____.build.debug_level=-DDEBUG_ESP_CORE
generic.menu.DebugLevel.SSL=Core + SSL generic.menu.DebugLevel.SSL_____=Core + SSL
generic.menu.DebugLevel.SSL.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL generic.menu.DebugLevel.SSL_____.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL
generic.menu.DebugLevel.WiFic=Core + WiFi generic.menu.DebugLevel.WiFic___=Core + WiFi
generic.menu.DebugLevel.WiFic.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI generic.menu.DebugLevel.WiFic___.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI
generic.menu.DebugLevel.WiFi=WiFi generic.menu.DebugLevel.WiFi____=WiFi
generic.menu.DebugLevel.WiFi.build.debug_level=-DDEBUG_ESP_WIFI generic.menu.DebugLevel.WiFi____.build.debug_level=-DDEBUG_ESP_WIFI
generic.menu.DebugLevel.HTTPClient=HTTPClient generic.menu.DebugLevel.HTTPClient=HTTPClient
generic.menu.DebugLevel.HTTPClient.build.debug_level=-DDEBUG_ESP_HTTP_CLIENT generic.menu.DebugLevel.HTTPClient.build.debug_level=-DDEBUG_ESP_HTTP_CLIENT
generic.menu.DebugLevel.HTTPClient2=HTTPClient + SSL generic.menu.DebugLevel.HTTPClient2=HTTPClient + SSL
@ -201,12 +201,12 @@ generic.menu.DebugLevel.HTTPServer=HTTPServer
generic.menu.DebugLevel.HTTPServer.build.debug_level=-DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.HTTPServer.build.debug_level=-DDEBUG_ESP_HTTP_SERVER
generic.menu.DebugLevel.UPDATER=Updater generic.menu.DebugLevel.UPDATER=Updater
generic.menu.DebugLevel.UPDATER.build.debug_level=-DDEBUG_ESP_UPDATER generic.menu.DebugLevel.UPDATER.build.debug_level=-DDEBUG_ESP_UPDATER
generic.menu.DebugLevel.OTA=OTA generic.menu.DebugLevel.OTA_____=OTA
generic.menu.DebugLevel.OTA.build.debug_level=-DDEBUG_ESP_OTA generic.menu.DebugLevel.OTA_____.build.debug_level=-DDEBUG_ESP_OTA
generic.menu.DebugLevel.OTA2=OTA + Updater generic.menu.DebugLevel.OTA2____=OTA + Updater
generic.menu.DebugLevel.OTA2.build.debug_level=-DDEBUG_ESP_OTA -DDEBUG_ESP_UPDATER generic.menu.DebugLevel.OTA2____.build.debug_level=-DDEBUG_ESP_OTA -DDEBUG_ESP_UPDATER
generic.menu.DebugLevel.all=All generic.menu.DebugLevel.all_____=All
generic.menu.DebugLevel.all.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA generic.menu.DebugLevel.all_____.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA
# disabled because espressif's bootloader refuses to write above 4M # disabled because espressif's bootloader refuses to write above 4M
# generic.menu.FlashSize.8M=8M (7M SPIFFS) # generic.menu.FlashSize.8M=8M (7M SPIFFS)

View File

@ -59,7 +59,9 @@ public:
int read() override; int read() override;
int peek() override; int peek() override;
void flush() override; void flush() override;
size_t readBytes(char *buffer, size_t length) override {
return read((uint8_t*)buffer, length);
}
size_t read(uint8_t* buf, size_t size); size_t read(uint8_t* buf, size_t size);
bool seek(uint32_t pos, SeekMode mode); bool seek(uint32_t pos, SeekMode mode);
size_t position() const; size_t position() const;

View File

@ -23,6 +23,46 @@ void MD5Builder::addHexString(const char * data){
free(tmp); free(tmp);
} }
bool MD5Builder::addStream(Stream & stream, const size_t total_len) {
const int buf_size = 512;
int bytesleft = total_len;
uint8_t * buf = (uint8_t*) malloc(buf_size);
if(buf) {
while((stream.available() > -1) && (bytesleft > 0)) {
// get available data size
int sizeAvailable = stream.available();
if(sizeAvailable) {
int readBytes = sizeAvailable;
// read only the asked bytes
if(readBytes > bytesleft) {
readBytes = bytesleft ;
}
// not read more the buffer can handle
if(readBytes > buf_size) {
readBytes = buf_size;
}
// read data
int bytesread = stream.readBytes(buf, readBytes);
bytesleft -= bytesread;
if(bytesread > 0) {
MD5Update(&_ctx, buf, bytesread);
}
}
// time for network streams
delay(0);
}
// not free null ptr
free(buf);
return (bytesleft == 0);
} else {
return false;
}
}
void MD5Builder::calculate(void){ void MD5Builder::calculate(void){
MD5Final(_buf, &_ctx); MD5Final(_buf, &_ctx);
} }

View File

@ -37,6 +37,7 @@ class MD5Builder {
void addHexString(const char * data); void addHexString(const char * data);
void addHexString(char * data){ addHexString((const char*)data); } void addHexString(char * data){ addHexString((const char*)data); }
void addHexString(String data){ addHexString(data.c_str()); } void addHexString(String data){ addHexString(data.c_str()); }
bool addStream(Stream & stream, const size_t total_len);
void calculate(void); void calculate(void);
void getBytes(uint8_t * output); void getBytes(uint8_t * output);
void getChars(char * output); void getChars(char * output);

View File

@ -87,8 +87,8 @@ class Stream: public Print {
float parseFloat(); // float version of parseInt float parseFloat(); // float version of parseInt
size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer virtual size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer
size_t readBytes(uint8_t *buffer, size_t length) { virtual size_t readBytes(uint8_t *buffer, size_t length) {
return readBytes((char *) buffer, length); return readBytes((char *) buffer, length);
} }
// terminates if length characters have been read or timeout (see setTimeout) // terminates if length characters have been read or timeout (see setTimeout)

View File

@ -103,7 +103,7 @@ void ICACHE_RAM_ATTR pwm_timer_isr(){
current_step = 0; current_step = 0;
stepcount = 0; stepcount = 0;
if(pwm_mask == 0) return; if(pwm_mask == 0) return;
T1L = (pwm_steps[current_step+1] * pwm_multiplier); T1L = (pwm_steps[current_step] * pwm_multiplier);
TEIE |= TEIE1; TEIE |= TEIE1;
if(pwm_mask & 0xFFFF) GPOS = pwm_mask & 0xFFFF; if(pwm_mask & 0xFFFF) GPOS = pwm_mask & 0xFFFF;
if(pwm_mask & 0x10000) GP16O = 1; if(pwm_mask & 0x10000) GP16O = 1;

View File

@ -107,7 +107,7 @@ void HTTPClient::begin(String url, String httpsFingerprint) {
int index = url.indexOf(':'); int index = url.indexOf(':');
//int index2; //int index2;
bool hasPort = false; bool hasPort = false;
if(index) { if(index >= 0) {
protocol = url.substring(0, index); protocol = url.substring(0, index);
url.remove(0, (index + 3)); // remove http:// or https:// url.remove(0, (index + 3)); // remove http:// or https://

View File

@ -40,6 +40,17 @@ extern "C" {
#include "WiFiServer.h" #include "WiFiServer.h"
#include "WiFiClientSecure.h" #include "WiFiClientSecure.h"
#ifdef DEBUG_ESP_WIFI
#ifdef DEBUG_ESP_PORT
#define DEBUG_WIFI(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#endif
#endif
#ifndef DEBUG_WIFI
#define DEBUG_WIFI(...)
#endif
class ESP8266WiFiClass : public ESP8266WiFiGenericClass, public ESP8266WiFiSTAClass, public ESP8266WiFiScanClass, public ESP8266WiFiAPClass { class ESP8266WiFiClass : public ESP8266WiFiGenericClass, public ESP8266WiFiSTAClass, public ESP8266WiFiScanClass, public ESP8266WiFiAPClass {
public: public:

View File

@ -85,19 +85,24 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch
if(!WiFi.enableAP(true)) { if(!WiFi.enableAP(true)) {
// enable AP failed // enable AP failed
DEBUG_WIFI("[AP] enableAP failed!\n");
return false; return false;
} }
if(!ssid || *ssid == 0 || strlen(ssid) > 31) { if(!ssid || *ssid == 0 || strlen(ssid) > 31) {
// fail SSID too long or missing! // fail SSID too long or missing!
DEBUG_WIFI("[AP] SSID too long or missing!\n");
return false; return false;
} }
if(passphrase && (strlen(passphrase) > 63 || strlen(passphrase) < 8)) { if(passphrase && (strlen(passphrase) > 63 || strlen(passphrase) < 8)) {
// fail passphrase to long or short! // fail passphrase to long or short!
DEBUG_WIFI("[AP] fail passphrase to long or short!\n");
return false; return false;
} }
bool ret = true;
struct softap_config conf; struct softap_config conf;
strcpy(reinterpret_cast<char*>(conf.ssid), ssid); strcpy(reinterpret_cast<char*>(conf.ssid), ssid);
conf.channel = channel; conf.channel = channel;
@ -116,20 +121,50 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch
struct softap_config conf_current; struct softap_config conf_current;
wifi_softap_get_config(&conf_current); wifi_softap_get_config(&conf_current);
if(softap_config_equal(conf, conf_current)) { if(!softap_config_equal(conf, conf_current)) {
DEBUGV("softap config unchanged");
return true;
}
bool ret; ETS_UART_INTR_DISABLE();
if(WiFi._persistent) {
ret = wifi_softap_set_config(&conf);
} else {
ret = wifi_softap_set_config_current(&conf);
}
ETS_UART_INTR_ENABLE();
if(!ret) {
DEBUG_WIFI("[AP] set_config failed!\n");
return false;
}
ETS_UART_INTR_DISABLE();
if(WiFi._persistent) {
ret = wifi_softap_set_config(&conf);
} else { } else {
ret = wifi_softap_set_config_current(&conf); DEBUG_WIFI("[AP] softap config unchanged\n");
}
if(wifi_softap_dhcps_status() != DHCP_STARTED) {
DEBUG_WIFI("[AP] DHCP not started, starting...\n");
if(!wifi_softap_dhcps_start()) {
DEBUG_WIFI("[AP] wifi_softap_dhcps_start failed!\n");
ret = false;
}
}
// check IP config
struct ip_info ip;
if(wifi_get_ip_info(SOFTAP_IF, &ip)) {
if(ip.ip.addr == 0x00000000) {
// Invalid config
DEBUG_WIFI("[AP] IP config Invalid resetting...\n");
//192.168.244.1 , 192.168.244.1 , 255.255.255.0
ret = softAPConfig(0x01F4A8C0, 0x01F4A8C0, 0x00FFFFFF);
if(!ret) {
DEBUG_WIFI("[AP] softAPConfig failed!\n");
ret = false;
}
}
} else {
DEBUG_WIFI("[AP] wifi_get_ip_info failed!\n");
ret = false;
} }
ETS_UART_INTR_ENABLE();
return ret; return ret;
} }
@ -142,21 +177,76 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch
* @param subnet subnet mask * @param subnet subnet mask
*/ */
bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet) { bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet) {
DEBUG_WIFI("[APConfig] local_ip: %s gateway: %s subnet: %s\n", local_ip.toString().c_str(), gateway.toString().c_str(), subnet.toString().c_str());
if(!WiFi.enableAP(true)) { if(!WiFi.enableAP(true)) {
// enable AP failed // enable AP failed
DEBUG_WIFI("[APConfig] enableAP failed!\n");
return false; return false;
} }
bool ret = true;
struct ip_info info; struct ip_info info;
info.ip.addr = static_cast<uint32_t>(local_ip); info.ip.addr = static_cast<uint32_t>(local_ip);
info.gw.addr = static_cast<uint32_t>(gateway); info.gw.addr = static_cast<uint32_t>(gateway);
info.netmask.addr = static_cast<uint32_t>(subnet); info.netmask.addr = static_cast<uint32_t>(subnet);
wifi_softap_dhcps_stop();
if(wifi_set_ip_info(SOFTAP_IF, &info)) { if(!wifi_softap_dhcps_stop()) {
return wifi_softap_dhcps_start(); DEBUG_WIFI("[APConfig] wifi_softap_dhcps_stop failed!\n");
} }
return false;
if(!wifi_set_ip_info(SOFTAP_IF, &info)) {
DEBUG_WIFI("[APConfig] wifi_set_ip_info failed!\n");
ret = false;
}
struct dhcps_lease dhcp_lease;
IPAddress ip = local_ip;
ip[3] += 99;
dhcp_lease.start_ip.addr = static_cast<uint32_t>(ip);
DEBUG_WIFI("[APConfig] DHCP IP start: %s\n", ip.toString().c_str());
ip[3] += 100;
dhcp_lease.end_ip.addr = static_cast<uint32_t>(ip);
DEBUG_WIFI("[APConfig] DHCP IP end: %s\n", ip.toString().c_str());
if(!wifi_softap_set_dhcps_lease(&dhcp_lease)) {
DEBUG_WIFI("[APConfig] wifi_set_ip_info failed!\n");
ret = false;
}
// set lease time to 720min --> 12h
if(!wifi_softap_set_dhcps_lease_time(720)) {
DEBUG_WIFI("[APConfig] wifi_softap_set_dhcps_lease_time failed!\n");
ret = false;
}
uint8 mode = 1;
if(!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
DEBUG_WIFI("[APConfig] wifi_softap_set_dhcps_offer_option failed!\n");
ret = false;
}
if(!wifi_softap_dhcps_start()) {
DEBUG_WIFI("[APConfig] wifi_softap_dhcps_start failed!\n");
ret = false;
}
// check config
if(wifi_get_ip_info(SOFTAP_IF, &info)) {
if(info.ip.addr == 0x00000000) {
DEBUG_WIFI("[APConfig] IP config Invalid?!\n");
ret = false;
} else if(local_ip != info.ip.addr) {
ip = info.ip.addr;
DEBUG_WIFI("[APConfig] IP config not set correct?! new IP: %s\n", ip.toString().c_str());
ret = false;
}
} else {
DEBUG_WIFI("[APConfig] wifi_get_ip_info failed!\n");
ret = false;
}
return ret;
} }
@ -179,6 +269,10 @@ bool ESP8266WiFiAPClass::softAPdisconnect(bool wifioff) {
} }
ETS_UART_INTR_ENABLE(); ETS_UART_INTR_ENABLE();
if(!ret) {
DEBUG_WIFI("[APdisconnect] set_config failed!\n");
}
if(wifioff) { if(wifioff) {
ret = WiFi.enableAP(false); ret = WiFi.enableAP(false);
} }

View File

@ -103,10 +103,10 @@ void ESP8266WiFiGenericClass::removeEvent(WiFiEventCb cbEvent, WiFiEvent_t event
*/ */
void ESP8266WiFiGenericClass::_eventCallback(void* arg) { void ESP8266WiFiGenericClass::_eventCallback(void* arg) {
System_Event_t* event = reinterpret_cast<System_Event_t*>(arg); System_Event_t* event = reinterpret_cast<System_Event_t*>(arg);
DEBUGV("wifi evt: %d\n", event->event); DEBUG_WIFI("wifi evt: %d\n", event->event);
if(event->event == EVENT_STAMODE_DISCONNECTED) { if(event->event == EVENT_STAMODE_DISCONNECTED) {
DEBUGV("STA disconnect: %d\n", event->event_info.disconnected.reason); DEBUG_WIFI("STA disconnect: %d\n", event->event_info.disconnected.reason);
WiFiClient::stopAll(); WiFiClient::stopAll();
} }

View File

@ -3,7 +3,7 @@
#include "c_types.h" #include "c_types.h"
/*------------------------变量定义------------------------*/ /*------------------------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------------------------*/
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#ifndef IOT_SIP_MODE #ifndef IOT_SIP_MODE
@ -61,7 +61,7 @@ static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_
//static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK ); //static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
/*------------------------函数声明-----------------------------------*/ /*------------------------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------------------------------*/
//static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) ;//ICACHE_FLASH_ATTR; //static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) ;//ICACHE_FLASH_ATTR;
@ -69,9 +69,9 @@ static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_
void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR; void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR;
void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR; void *pvPortMalloc( size_t xWantedSize, const char* file, int line ) __attribute__((malloc, alloc_size(1)));//ICACHE_FLASH_ATTR;
void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR; void vPortFree( void *pv, const char* file, int line ) ;//ICACHE_FLASH_ATTR;
size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR; size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR;

View File

@ -1,3 +1,34 @@
esp_iot_sdk_v1.5.1_16_01_08 Release Note
----------------------------------------
Resolved Issues (Bugs listed below apply to Bug Bounty Program):
1.espconn_abort may cause system crash.
Optimization:
1.Optimize the data receiving process under TCP connection.
2.Optimize low MAC and increase stability of the software.
3.Optimize watchdog feeding process.
4.Optimize softAP working mode so that some stations can be easily connected.
5.Optimize station working mode, enabling connection even when the SSID of the AP has changed.
6.Optimize station working mode, and increase routers compatibility during the connection process.
7.Optimize SSL shakehand.
8.Optimize espconn internal timer.
9.Optimize UDP transmission.
10.Improve the flash writing process.
11.Strenthen WPA2 security protocols.
12.Improve data sending ability.
13.Straighten the control capability of GPIO16 under light sleep mode.
14.boot.bin is upgrade to version 1.5, resolving boot failure when firmware is upgraded over the air (OTA).
AT release note
1.Optimize the process of establishing TCP server via AT command.
2.Optimize UART-WiFi transparent transmission mode via AT command.
Please be noted that with the release of NONOS SDK Version 1.5.0 (ESP8266_NONOS_SDK_V1.5.0), the space that AT commands occupies has increased to more than 4Mbit. Therefore, flash with 512Kbit capacity is no longer supported. Please choose flash with at least 8Mbit capacity.
Please be noted that firmware upgrade over-the-air process is changed a bit. We will upgrade the latest firmware to Espressif Cloud server only after it has been tested and the overall performance is guaranteed. Users may not be able to download firmware encapsulated in ESP8266_NONOS_SDK_V1.5.0 and other more advanced versions.
esp_iot_sdk_v1.5.0_15_12_15_p1 Release Note esp_iot_sdk_v1.5.0_15_12_15_p1 Release Note
---------------------------------------- ----------------------------------------
Here is a patch based on ESP8266_NONOS_SDK_V1.5.0 solved a problem that calling espconn_abort may cause unexpected reset. Here is a patch based on ESP8266_NONOS_SDK_V1.5.0 solved a problem that calling espconn_abort may cause unexpected reset.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
1.5.0_15_12_15_p1 1.5.1_16_01_08