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

Merge remote-tracking branch 'esporigin/esp8266' into SPIFFS-OTA

This commit is contained in:
Pascal Gollor 2015-09-28 13:25:08 +02:00
commit 98d2468edf
6 changed files with 29 additions and 20 deletions

View File

@ -118,7 +118,7 @@ ICACHE_FLASH_ATTR String::String(double value, unsigned char decimalPlaces) {
} }
ICACHE_FLASH_ATTR String::~String() { ICACHE_FLASH_ATTR String::~String() {
os_free(buffer); free(buffer);
} }
// /*********************************************/ // /*********************************************/
@ -133,7 +133,7 @@ inline void String::init(void) {
void ICACHE_FLASH_ATTR String::invalidate(void) { void ICACHE_FLASH_ATTR String::invalidate(void) {
if(buffer) if(buffer)
os_free(buffer); free(buffer);
buffer = NULL; buffer = NULL;
capacity = len = 0; capacity = len = 0;
} }
@ -150,12 +150,18 @@ unsigned char ICACHE_FLASH_ATTR String::reserve(unsigned int size) {
} }
unsigned char ICACHE_FLASH_ATTR String::changeBuffer(unsigned int maxStrLen) { unsigned char ICACHE_FLASH_ATTR String::changeBuffer(unsigned int maxStrLen) {
char *newbuffer = (char *) os_realloc(buffer, maxStrLen + 1); size_t newSize = (maxStrLen + 16) & (~0xf);
char *newbuffer = (char *) malloc(newSize);
if(newbuffer) { if(newbuffer) {
memset(newbuffer, 0, newSize);
memcpy(newbuffer, buffer, len);
if (buffer)
free(buffer);
capacity = newSize - 1;
buffer = newbuffer; buffer = newbuffer;
capacity = maxStrLen;
return 1; return 1;
} }
buffer = newbuffer;
return 0; return 0;
} }
@ -192,7 +198,7 @@ void ICACHE_FLASH_ATTR String::move(String &rhs) {
rhs.len = 0; rhs.len = 0;
return; return;
} else { } else {
os_free(buffer); free(buffer);
} }
} }
buffer = rhs.buffer; buffer = rhs.buffer;

View File

@ -55,6 +55,9 @@ void __wrap_system_restart_local() {
ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n", ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n",
rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc); rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc);
} }
else if (rst_info.reason == REASON_SOFT_WDT_RST) {
ets_printf("\nSoft WDT reset\n");
}
uint32_t cont_stack_start = (uint32_t) &(g_cont.stack); uint32_t cont_stack_start = (uint32_t) &(g_cont.stack);
uint32_t cont_stack_end = (uint32_t) g_cont.stack_end; uint32_t cont_stack_end = (uint32_t) g_cont.stack_end;

View File

@ -26,7 +26,7 @@ title: Reference
* [size](#size) * [size](#size)
* [name](#name) * [name](#name)
* [close](#close) * [close](#close)
* [WiFi(ESP8266WiFi library)](#wifiesp8266wifi-library) * [WiFi(ESP8266WiFi library)](#wifiesp8266wifi-library)
* [Ticker](#ticker) * [Ticker](#ticker)
* [EEPROM](#eeprom) * [EEPROM](#eeprom)
* [I2C (Wire library)](#i2c-wire-library) * [I2C (Wire library)](#i2c-wire-library)
@ -382,7 +382,7 @@ Size can be anywhere between 4 and 4096 bytes.
whenever you wish to save changes to flash. `EEPROM.end()` will also commit, and will whenever you wish to save changes to flash. `EEPROM.end()` will also commit, and will
release the RAM copy of EEPROM contents. release the RAM copy of EEPROM contents.
EEPROM library uses one sector of flash located at 0x7b000 for storage. EEPROM library uses one sector of flash located just after the SPIFFS.
Three examples included. Three examples included.

View File

@ -130,10 +130,10 @@ void ESP8266WebServer::_prepareHeader(String& response, int code, const char* co
sendHeader("Content-Type", content_type, true); sendHeader("Content-Type", content_type, true);
if (_contentLength != CONTENT_LENGTH_UNKNOWN && _contentLength != CONTENT_LENGTH_NOT_SET) { if (_contentLength != CONTENT_LENGTH_UNKNOWN && _contentLength != CONTENT_LENGTH_NOT_SET) {
sendHeader("Content-Length", String(_contentLength).c_str()); sendHeader("Content-Length", String(_contentLength));
} }
else if (contentLength > 0){ else if (contentLength > 0){
sendHeader("Content-Length", String(contentLength).c_str()); sendHeader("Content-Length", String(contentLength));
} }
sendHeader("Connection", "close"); sendHeader("Connection", "close");
sendHeader("Access-Control-Allow-Origin", "*"); sendHeader("Access-Control-Allow-Origin", "*");

Binary file not shown.

Binary file not shown.