Skip to content

Commit 269f89c

Browse files
authored
Merge branch 'master' into master
2 parents a566ea3 + 0f50fc0 commit 269f89c

34 files changed

+830
-266
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ If you can not find the answers above, you can also try [ESP8266 Community Forum
106106

107107
For minor fixes of code and documentation, go ahead and submit a pull request.
108108

109-
Check out the list of issues which are easy to fix — [easy issues for 2.2.0](https://github.com/esp8266/Arduino/issues?q=is%3Aopen+is%3Aissue+milestone%3A2.2.0+label%3A%22level%3A+easy%22). Working on them is a great way to move the project forward.
109+
Check out the list of issues which are easy to fix — [easy issues for 2.4.0](https://github.com/esp8266/Arduino/issues?q=is%3Aopen+is%3Aissue+milestone%3A2.4.0+label%3A%22level%3A+easy%22). Working on them is a great way to move the project forward.
110110

111111
Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed [in the chat](https://gitter.im/esp8266/Arduino) first.
112112

boards.txt

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
menu.BoardModel=Model
12
menu.UploadSpeed=Upload Speed
23
menu.CpuFrequency=CPU Frequency
4+
menu.CrystalFreq=Crystal Frequency
35
menu.FlashSize=Flash Size
46
menu.FlashMode=Flash Mode
57
menu.FlashFreq=Flash Frequency
@@ -1892,3 +1894,121 @@ coredev.menu.DebugLevel.OTA2____=OTA + Updater
18921894
coredev.menu.DebugLevel.OTA2____.build.debug_level=-DDEBUG_ESP_OTA -DDEBUG_ESP_UPDATER
18931895
coredev.menu.DebugLevel.all_____=All
18941896
coredev.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 -DDEBUG_TLS_MEM
1897+
1898+
############ Arduino boards with Esp8266 ############
1899+
1900+
arduino-esp8266.name=Arduino
1901+
1902+
arduino-esp8266.upload.tool=esptool
1903+
arduino-esp8266.upload.speed=9600
1904+
arduino-esp8266.upload.resetmethod=ck
1905+
arduino-esp8266.upload.maximum_size=1044464
1906+
arduino-esp8266.upload.maximum_data_size=81920
1907+
arduino-esp8266.upload.wait_for_upload_port=true
1908+
arduino-esp8266.serial.disableDTR=true
1909+
arduino-esp8266.serial.disableRTS=true
1910+
1911+
arduino-esp8266.build.mcu=esp8266
1912+
arduino-esp8266.build.f_cpu=80000000L
1913+
#arduino-esp8266.build.f_crystal=40000000
1914+
arduino-esp8266.build.core=esp8266
1915+
arduino-esp8266.build.flash_mode=qio
1916+
arduino-esp8266.build.flash_size=4M
1917+
arduino-esp8266.build.flash_freq=40
1918+
arduino-esp8266.build.debug_port=
1919+
arduino-esp8266.build.debug_level=
1920+
arduino-esp8266.build.board=ESP8266_ARDUINO
1921+
1922+
arduino-esp8266.menu.BoardModel.starottodeved=Star OTTO
1923+
arduino-esp8266.menu.BoardModel.starottodeved.build.board=ESP8266_ARDUINO_STAR_OTTO
1924+
arduino-esp8266.menu.BoardModel.starottodeved.build.variant=arduino_uart
1925+
arduino-esp8266.menu.BoardModel.starottodeved.build.extra_flags=-DF_CRYSTAL=40000000
1926+
1927+
arduino-esp8266.menu.BoardModel.primo=Primo
1928+
arduino-esp8266.menu.BoardModel.primo.build.board=ESP8266_ARDUINO_PRIMO
1929+
arduino-esp8266.menu.BoardModel.primo.build.variant=arduino_spi
1930+
arduino-esp8266.menu.BoardModel.primo.build.extra_flags=-DF_CRYSTAL=40000000
1931+
1932+
arduino-esp8266.menu.BoardModel.unowifideved=Uno WiFi
1933+
arduino-esp8266.menu.BoardModel.unowifideved.build.board=ESP8266_ARDUINO_UNOWIFI
1934+
arduino-esp8266.menu.BoardModel.unowifideved.build.variant=arduino_uart
1935+
arduino-esp8266.menu.BoardModel.unowifideved.build.extra_flags=-DF_CRYSTAL=40000000
1936+
1937+
arduino-esp8266.menu.UploadSpeed.9600=9600
1938+
arduino-esp8266.menu.UploadSpeed.9600.upload.speed=9600
1939+
arduino-esp8266.menu.UploadSpeed.19200=19200
1940+
arduino-esp8266.menu.UploadSpeed.19200.upload.speed=19200
1941+
arduino-esp8266.menu.UploadSpeed.57600=57600
1942+
arduino-esp8266.menu.UploadSpeed.57600.upload.speed=57600
1943+
arduino-esp8266.menu.UploadSpeed.115200=115200
1944+
arduino-esp8266.menu.UploadSpeed.115200.upload.speed=115200
1945+
arduino-esp8266.menu.UploadSpeed.230400=230400
1946+
arduino-esp8266.menu.UploadSpeed.230400.upload.speed=230400
1947+
arduino-esp8266.menu.UploadSpeed.460800=460800
1948+
arduino-esp8266.menu.UploadSpeed.460800.upload.speed=460800
1949+
1950+
arduino-esp8266.menu.FlashSize.4M1M=4M (1M SPIFFS)
1951+
arduino-esp8266.menu.FlashSize.4M1M.build.flash_size=4M
1952+
arduino-esp8266.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
1953+
arduino-esp8266.menu.FlashSize.4M1M.build.spiffs_start=0x300000
1954+
arduino-esp8266.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
1955+
arduino-esp8266.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
1956+
arduino-esp8266.menu.FlashSize.4M1M.build.spiffs_pagesize=256
1957+
1958+
arduino-esp8266.menu.FlashSize.4M3M=4M (3M SPIFFS)
1959+
arduino-esp8266.menu.FlashSize.4M3M.build.flash_size=4M
1960+
arduino-esp8266.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
1961+
arduino-esp8266.menu.FlashSize.4M3M.build.spiffs_start=0x100000
1962+
arduino-esp8266.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
1963+
arduino-esp8266.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
1964+
arduino-esp8266.menu.FlashSize.4M3M.build.spiffs_pagesize=256
1965+
1966+
##############################################################
1967+
1968+
gen4iod.name=4D Systems gen4 IoD Range
1969+
1970+
gen4iod.upload.tool=esptool
1971+
gen4iod.upload.speed=921600
1972+
gen4iod.upload.resetmethod=nodemcu
1973+
gen4iod.upload.maximum_size=434160
1974+
gen4iod.upload.maximum_data_size=81920
1975+
gen4iod.upload.wait_for_upload_port=true
1976+
gen4iod.serial.disableDTR=true
1977+
gen4iod.serial.disableRTS=true
1978+
1979+
gen4iod.build.mcu=esp8266
1980+
gen4iod.build.f_cpu=160000000L
1981+
gen4iod.build.board=GEN4_IOD
1982+
gen4iod.build.core=esp8266
1983+
gen4iod.build.variant=generic
1984+
gen4iod.build.flash_mode=qio
1985+
# flash chip: AT25SF041 (512 kbyte, 4Mbit)
1986+
gen4iod.build.flash_size=512K
1987+
gen4iod.build.flash_ld=eagle.flash.512k0.ld
1988+
gen4iod.build.flash_freq=80
1989+
gen4iod.build.debug_port=
1990+
gen4iod.build.debug_level=
1991+
1992+
gen4iod.menu.CpuFrequency.160=160 MHz
1993+
gen4iod.menu.CpuFrequency.160.build.f_cpu=160000000L
1994+
gen4iod.menu.CpuFrequency.80=80 MHz
1995+
gen4iod.menu.CpuFrequency.80.build.f_cpu=80000000L
1996+
1997+
gen4iod.menu.UploadSpeed.115200=115200
1998+
gen4iod.menu.UploadSpeed.115200.upload.speed=115200
1999+
gen4iod.menu.UploadSpeed.9600=9600
2000+
gen4iod.menu.UploadSpeed.9600.upload.speed=9600
2001+
gen4iod.menu.UploadSpeed.57600=57600
2002+
gen4iod.menu.UploadSpeed.57600.upload.speed=57600
2003+
gen4iod.menu.UploadSpeed.256000.windows=256000
2004+
gen4iod.menu.UploadSpeed.256000.upload.speed=256000
2005+
gen4iod.menu.UploadSpeed.230400.linux=230400
2006+
gen4iod.menu.UploadSpeed.230400.macosx=230400
2007+
gen4iod.menu.UploadSpeed.230400.upload.speed=230400
2008+
gen4iod.menu.UploadSpeed.460800.linux=460800
2009+
gen4iod.menu.UploadSpeed.460800.macosx=460800
2010+
gen4iod.menu.UploadSpeed.460800.upload.speed=460800
2011+
gen4iod.menu.UploadSpeed.512000.windows=512000
2012+
gen4iod.menu.UploadSpeed.512000.upload.speed=512000
2013+
gen4iod.menu.UploadSpeed.921600=921600
2014+
gen4iod.menu.UploadSpeed.921600.upload.speed=921600

cores/esp8266/base64.cpp

100644100755
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,20 @@ extern "C" {
3535
* @param length size_t
3636
* @return String
3737
*/
38-
String base64::encode(uint8_t * data, size_t length) {
38+
String base64::encode(uint8_t * data, size_t length, bool doNewLines) {
3939
// base64 needs more size then the source data
4040
size_t size = ((length * 1.6f) + 1);
4141
char * buffer = (char *) malloc(size);
4242
if(buffer) {
4343
base64_encodestate _state;
44-
base64_init_encodestate(&_state);
44+
if(doNewLines)
45+
{
46+
base64_init_encodestate(&_state);
47+
}
48+
else
49+
{
50+
base64_init_encodestate_nonewlines(&_state);
51+
}
4552
int len = base64_encode_block((const char *) &data[0], length, &buffer[0], &_state);
4653
len = base64_encode_blockend((buffer + len), &_state);
4754

@@ -57,7 +64,7 @@ String base64::encode(uint8_t * data, size_t length) {
5764
* @param text String
5865
* @return String
5966
*/
60-
String base64::encode(String text) {
61-
return base64::encode((uint8_t *) text.c_str(), text.length());
67+
String base64::encode(String text, bool doNewLines) {
68+
return base64::encode((uint8_t *) text.c_str(), text.length(), doNewLines);
6269
}
6370

cores/esp8266/base64.h

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727

2828
class base64 {
2929
public:
30-
static String encode(uint8_t * data, size_t length);
31-
static String encode(String text);
30+
// NOTE: The default behaviour of backend (lib64)
31+
// is to add a newline every 72 (encoded) characters output.
32+
// This may 'break' longer uris and json variables
33+
static String encode(uint8_t * data, size_t length, bool doNewLines = true);
34+
static String encode(String text, bool doNewLines = true);
3235
private:
3336
};
3437

cores/esp8266/core_esp8266_i2s.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ void ICACHE_FLASH_ATTR i2s_slc_end(){
146146
SLCIE = 0;
147147
SLCTXL &= ~(SLCTXLAM << SLCTXLA); // clear TX descriptor address
148148
SLCRXL &= ~(SLCRXLAM << SLCRXLA); // clear RX descriptor address
149+
150+
for (int x = 0; x<SLC_BUF_CNT; x++) {
151+
free(i2s_slc_buf_pntr[x]);
152+
}
149153
}
150154

151155
//This routine pushes a single, 32-bit sample to the I2S buffers. Call this at (on average)
@@ -238,8 +242,16 @@ void ICACHE_FLASH_ATTR i2s_begin(){
238242
}
239243

240244
void ICACHE_FLASH_ATTR i2s_end(){
241-
i2s_slc_end();
245+
I2SC &= ~I2STXS;
246+
247+
//Reset I2S
248+
I2SC &= ~(I2SRST);
249+
I2SC |= I2SRST;
250+
I2SC &= ~(I2SRST);
251+
242252
pinMode(2, INPUT);
243253
pinMode(3, INPUT);
244254
pinMode(15, INPUT);
255+
256+
i2s_slc_end();
245257
}

cores/esp8266/core_esp8266_phy.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
8888
// 0: 40MHz
8989
// 1: 26MHz
9090
// 2: 24MHz
91-
[48] = 1,
91+
#if F_CRYSTAL == 40000000
92+
[48] = 0,
93+
#else
94+
[48] = 1,
95+
#endif
9296

9397

9498

@@ -312,4 +316,3 @@ void user_rf_pre_init()
312316

313317

314318
void ICACHE_RAM_ATTR user_spi_flash_dio_to_qio_pre_init() {}
315-

cores/esp8266/esp8266_peri.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ extern uint8_t esp8266_gpioToFn[16];
586586
#define SPIE2IHEN 0x3 //SPI_INT_HOLD_ENA
587587
#define SPIE2IHEN_S 0 //SPI_INT_HOLD_ENA_S
588588

589+
//SPI PIN (SPIxP)
590+
#define SPIPCS2DIS (1 << 2)
591+
#define SPIPCS1DIS (1 << 1)
592+
#define SPIPCS0DIS (1 << 0)
589593

590594
//SLC (DMA) Registers
591595
#define SLCC0 ESP8266_REG(0xB00) //SLC_CONF0

cores/esp8266/libb64/cencode.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ void base64_init_encodestate(base64_encodestate* state_in){
1313
state_in->step = step_A;
1414
state_in->result = 0;
1515
state_in->stepcount = 0;
16+
state_in->stepsnewline = CHARS_PER_LINE;
17+
}
18+
19+
20+
void base64_init_encodestate_nonewlines(base64_encodestate* state_in){
21+
base64_init_encodestate(state_in);
22+
state_in->stepsnewline = -1;
1623
}
1724

1825
char base64_encode_value(char value_in){
@@ -65,7 +72,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
6572
*codechar++ = base64_encode_value(result);
6673

6774
++(state_in->stepcount);
68-
if (state_in->stepcount == CHARS_PER_LINE/4){
75+
if ((state_in->stepcount == CHARS_PER_LINE/4) && (state_in->stepsnewline > 0)){
6976
*codechar++ = '\n';
7077
state_in->stepcount = 0;
7178
}

cores/esp8266/libb64/cencode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ typedef struct {
2222
base64_encodestep step;
2323
char result;
2424
int stepcount;
25+
int stepsnewline;
2526
} base64_encodestate;
2627

2728
void base64_init_encodestate(base64_encodestate* state_in);
29+
void base64_init_encodestate_nonewlines(base64_encodestate* state_in);
2830

2931
char base64_encode_value(char value_in);
3032

cores/esp8266/pgmspace.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,31 @@ int vsnprintf_P(char *str, size_t strSize, PGM_P formatP, va_list ap) __attribut
8787
// w1, w0
8888

8989
#ifdef __ets__
90-
#define pgm_read_byte(addr) \
91-
(__extension__({ \
92-
PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
93-
ptrdiff_t __offset = ((uint32_t)__local & 0x00000003); /* byte aligned mask */ \
94-
const uint32_t* __addr32 = (const uint32_t*)((const uint8_t*)(__local)-__offset); \
95-
uint8_t __result = ((*__addr32) >> (__offset * 8)); \
96-
__result; \
97-
}))
98-
99-
#define pgm_read_word(addr) \
100-
(__extension__({ \
101-
PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
102-
ptrdiff_t __offset = ((uint32_t)__local & 0x00000002); /* word aligned mask */ \
103-
const uint32_t* __addr32 = (const uint32_t*)((const uint8_t*)(__local) - __offset); \
104-
uint16_t __result = ((*__addr32) >> (__offset * 8)); \
105-
__result; \
106-
}))
90+
91+
#define pgm_read_with_offset(addr, res) \
92+
asm("extui %0, %1, 0, 2\n" /* Extract offset within word (in bytes) */ \
93+
"sub %1, %1, %0\n" /* Subtract offset from addr, yielding an aligned address */ \
94+
"l32i.n %1, %1, 0x0\n" /* Load word from aligned address */ \
95+
"slli %0, %0, 3\n" /* Mulitiply offset by 8, yielding an offset in bits */ \
96+
"ssr %0\n" /* Prepare to shift by offset (in bits) */ \
97+
"srl %0, %1\n" /* Shift right; now the requested byte is the first one */ \
98+
:"=r"(res), "=r"(addr) \
99+
:"1"(addr) \
100+
:);
101+
102+
static inline uint8_t pgm_read_byte(const void* addr) {
103+
register uint32_t res;
104+
pgm_read_with_offset(addr, res);
105+
return (uint8_t) res; /* This masks the lower byte from the returned word */
106+
}
107+
108+
/* Although this says "word", it's actually 16 bit, i.e. half word on Xtensa */
109+
static inline uint16_t pgm_read_word(const void* addr) {
110+
register uint32_t res;
111+
pgm_read_with_offset(addr, res);
112+
return (uint16_t) res; /* This masks the lower half-word from the returned word */
113+
}
114+
107115
#else //__ets__
108116
#define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
109117
#define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))

doc/boards.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ title: Supported Hardware
3333
* [WeMos D1](#wemos-d1)
3434
* [WeMos D1 mini](#wemos-d1-mini)
3535
* [ESPino by ThaiEasyElec](#espinotee)
36+
* [gen4-IoD Range by 4D Systems](#gen4iod)
3637

3738
## Adafruit HUZZAH ESP8266 (ESP-12)
3839

@@ -303,6 +304,16 @@ We will update an English description soon.
303304
- Dimensions: http://thaieasyelec.com/downloads/ETEE052/ETEE052_ESPino_Dimension.pdf
304305
- Pinouts: http://thaieasyelec.com/downloads/ETEE052/ETEE052_ESPino_User_Manual_TH_v1_0_20160204.pdf (Please see pg. 8)
305306

307+
## gen4-IoD Range by 4D Systems
308+
gen4-IoD Range of ESP8266 powered Display Modules by 4D Systems.
309+
310+
2.4", 2.8" and 3.2" TFT LCD with uSD card socket and Resistive Touch. Chip Antenna + uFL Connector.
311+
312+
Datasheet and associated downloads can be found on the 4D Systems product page.
313+
314+
The gen4-IoD range can be programmed using the Arduino IDE and also the 4D Systems Workshop4 IDE, which incorporates many additional graphics benefits. GFX4d library is available, along with a number of demo applications.
315+
316+
- Product page: http://www.4dsystems.com.au/product/gen4-IoD
306317

307318

308319

doc/esp8266wifi/station-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Connecting to sensor-net
137137
.
138138
Connected, IP address: 192.168.1.22
139139
```
140-
Please note that station with static IP configuration usually connects to the network faster. In the above example it took about 500ms (one dot `.` displayed). This is because obtaining of IP configuration by DHCP client takes time and in this case this step is skipped.
140+
Please note that station with static IP configuration usually connects to the network faster. In the above example it took about 500ms (one dot `.` displayed). This is because obtaining of IP configuration by DHCP client takes time and in this case this step is skipped. If you pass all three parameter as 0.0.0.0 ( local_ip, gateway and subnet), it will re enable DHCP. You need to re connect the device to get new IPs.
141141
142142
143143
### Manage Connection

doc/libraries.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ else they default to pins 4(SDA) and 5(SCL).
5656

5757
SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA).
5858
Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working).
59+
The usual SPI pins are:
60+
61+
- `MOSI` = GPIO13
62+
- `MISO` = GPIO12
63+
- `SCLK` = GPIO14
64+
65+
There's an extended mode where you can swap the normal pins to the pin0 hardware pins.
66+
This is enabled by calling `SPI.pins(6, 7, 8, 0)` before the call to `SPI.begin()`. The pins would
67+
change to:
68+
69+
- `MOSI` = SD1
70+
- `MISO` = SD0
71+
- `SCLK` = CLK
72+
- `HWCS` = GPIO0
73+
74+
This mode shares the SPI pins with the controller that reads the program code from flash and is
75+
controlled by a hardware arbiter (the flash has always higher priority). For this mode the CS
76+
will be controlled by hardware as you can't handle the CS line with a GPIO, you never actually
77+
know when the arbiter is going to grant you access to the bus so you must let it handle CS
78+
automatically.
79+
80+
5981

6082
## SoftwareSerial
6183

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ bool HTTPClient::begin(String url)
132132
bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
133133
{
134134
DEBUG_HTTPCLIENT("[HTTP-Client][begin] url: %s\n", url.c_str());
135-
bool hasPort = false;
136135
clear();
137136

138137
// check for : (http: or https:

0 commit comments

Comments
 (0)