Skip to content

Commit 30a0a92

Browse files
committed
Merge branch 'master' into bug-esp8266#3795
2 parents 72954ab + 291bc6b commit 30a0a92

File tree

160 files changed

+5364
-1507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+5364
-1507
lines changed

.travis.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ language: bash
33
os: linux
44
dist: trusty
55

6-
env:
7-
- BUILD_TYPE=build
6+
matrix:
7+
include:
8+
- env:
9+
- BUILD_TYPE=build
10+
- env:
11+
- BUILD_TYPE=platformio
12+
- env:
13+
- BUILD_TYPE=docs
14+
- env:
15+
- BUILD_TYPE=package
16+
- env:
17+
- BUILD_TYPE=host_tests
818

919
install:
1020
- pip install --user -r doc/requirements.txt
@@ -25,6 +35,7 @@ deploy:
2535
on:
2636
repo: esp8266/Arduino
2737
tags: true
38+
condition: "$BUILD_TYPE = package"
2839

2940
notifications:
3041
email:

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package
2828
#### Latest release [![Latest release](https://img.shields.io/github/release/esp8266/Arduino.svg)](https://github.com/esp8266/Arduino/releases/latest/)
2929
Boards manager link: `http://arduino.esp8266.com/stable/package_esp8266com_index.json`
3030

31-
Documentation: [http://esp8266.github.io/Arduino/versions/2.3.0/](http://esp8266.github.io/Arduino/versions/2.3.0/)
31+
Documentation: [https://arduino-esp8266.readthedocs.io/en/2.4.0/](https://arduino-esp8266.readthedocs.io/en/2.4.0/)
3232

3333
### Using git version
3434
[![Linux build status](https://travis-ci.org/esp8266/Arduino.svg)](https://travis-ci.org/esp8266/Arduino)
@@ -51,19 +51,19 @@ python get.py
5151

5252
### Using PlatformIO
5353

54-
[PlatformIO](http://platformio.org) is an open source ecosystem for IoT
54+
[PlatformIO](http://platformio.org?utm_source=github&utm_medium=arduino-esp8266) is an open source ecosystem for IoT
5555
development with cross platform build system, library manager and full support
5656
for Espressif (ESP8266) development. It works on the popular host OS: macOS, Windows,
5757
Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
5858

59-
- [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html)
60-
- [PlatformIO IDE](http://platformio.org/platformio-ide)
61-
- Quick Start with [PlatformIO IDE](http://docs.platformio.org/page/ide/atom.html#quick-start) or [PlatformIO Core](http://docs.platformio.org/page/core.html)
62-
- [Advanced usage](http://docs.platformio.org/page/platforms/espressif.html) -
63-
custom settings, uploading to SPIFFS, Over-the-Air (OTA) or using stage version
64-
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) -
65-
Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
66-
- [Project Examples](http://docs.platformio.org/page/platforms/espressif.html#examples)
59+
- [What is PlatformIO?](http://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp8266)
60+
- [PlatformIO IDE](http://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp8266)
61+
- [PlatformIO Core](http://docs.platformio.org/en/latest/core.html?utm_source=github&utm_medium=arduino-esp8266) (command line tool)
62+
- [Advanced usage](http://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=github&utm_medium=arduino-esp8266) -
63+
custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
64+
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/en/latest/ide.html?utm_source=github&utm_medium=arduino-esp8266) -
65+
Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
66+
- [Project Examples](http://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=github&utm_medium=arduino-esp8266#examples)
6767

6868
### Building with make
6969

@@ -96,7 +96,7 @@ Please provide as much context as possible:
9696

9797
For minor fixes of code and documentation, please go ahead and submit a pull request.
9898

99-
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.
99+
Check out the list of issues which are easy to fix — [easy issues for 2.5.0](https://github.com/esp8266/Arduino/issues?q=is%3Aopen+is%3Aissue+milestone%3A2.5.0+label%3A%22level%3A+easy%22). Working on them is a great way to move the project forward.
100100

101101
Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed by opening an issue first.
102102

boards.txt

Lines changed: 765 additions & 538 deletions
Large diffs are not rendered by default.

cores/esp8266/Arduino.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ extern "C" {
8585
#define EXTERNAL 0
8686

8787
//timer dividers
88-
#define TIM_DIV1 0 //80MHz (80 ticks/us - 104857.588 us max)
89-
#define TIM_DIV16 1 //5MHz (5 ticks/us - 1677721.4 us max)
90-
#define TIM_DIV265 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
88+
enum TIM_DIV_ENUM {
89+
TIM_DIV1 = 0, //80MHz (80 ticks/us - 104857.588 us max)
90+
TIM_DIV16 = 1, //5MHz (5 ticks/us - 1677721.4 us max)
91+
TIM_DIV256 = 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
92+
};
93+
94+
9195
//timer int_types
9296
#define TIM_EDGE 0
9397
#define TIM_LEVEL 1
@@ -236,7 +240,17 @@ void optimistic_yield(uint32_t interval_us);
236240
} // extern "C"
237241
#endif
238242

243+
244+
//for compatibility, below 4 lines to be removed in release 3.0.0
239245
#ifdef __cplusplus
246+
extern "C"
247+
#endif
248+
const int TIM_DIV265 __attribute__((deprecated, weak)) = TIM_DIV256;
249+
250+
251+
252+
#ifdef __cplusplus
253+
240254
#include <algorithm>
241255
#include "pgmspace.h"
242256

@@ -283,3 +297,9 @@ extern "C" void configTime(long timezone, int daylightOffset_sec,
283297
#include "pins_arduino.h"
284298

285299
#endif
300+
301+
#ifdef DEBUG_ESP_OOM
302+
// reinclude *alloc redefinition because of <cstdlib> undefining them
303+
// this is mandatory for allowing OOM *alloc definitions in .ino files
304+
#include "umm_malloc/umm_malloc_cfg.h"
305+
#endif

cores/esp8266/Esp.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,22 @@ void EspClass::wdtFeed(void)
107107

108108
extern "C" void esp_yield();
109109

110-
void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
110+
void EspClass::deepSleep(uint64_t time_us, WakeMode mode)
111111
{
112112
system_deep_sleep_set_option(static_cast<int>(mode));
113113
system_deep_sleep(time_us);
114114
esp_yield();
115115
}
116116

117+
//this calculation was taken verbatim from the SDK api reference for SDK 2.1.0.
118+
//Note: system_rtc_clock_cali_proc() returns a uint32_t, even though system_deep_sleep() takes a uint64_t.
119+
uint64_t EspClass::deepSleepMax()
120+
{
121+
//cali*(2^31-1)/(2^12)
122+
return (uint64_t)system_rtc_clock_cali_proc()*(0x80000000-1)/(0x1000);
123+
124+
}
125+
117126
bool EspClass::rtcUserMemoryRead(uint32_t offset, uint32_t *data, size_t size)
118127
{
119128
if (size + offset > 512) {
@@ -396,7 +405,6 @@ struct rst_info * EspClass::getResetInfoPtr(void) {
396405
}
397406

398407
bool EspClass::eraseConfig(void) {
399-
bool ret = true;
400408
const size_t cfgSize = 0x4000;
401409
size_t cfgAddr = ESP.getFlashChipSize() - cfgSize;
402410

cores/esp8266/Esp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class EspClass {
9292
void wdtDisable();
9393
void wdtFeed();
9494

95-
void deepSleep(uint32_t time_us, RFMode mode = RF_DEFAULT);
95+
void deepSleep(uint64_t time_us, RFMode mode = RF_DEFAULT);
96+
uint64_t deepSleepMax();
9697

9798
bool rtcUserMemoryRead(uint32_t offset, uint32_t *data, size_t size);
9899
bool rtcUserMemoryWrite(uint32_t offset, uint32_t *data, size_t size);

cores/esp8266/HardwareSerial.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,10 @@ HardwareSerial::operator bool() const
180180
}
181181

182182

183+
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
183184
HardwareSerial Serial(UART0);
185+
#endif
186+
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL1)
184187
HardwareSerial Serial1(UART1);
188+
#endif
189+

cores/esp8266/Print.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class Print {
8989
size_t println(double, int = 2);
9090
size_t println(const Printable&);
9191
size_t println(void);
92+
93+
virtual void flush() { /* Empty implementation for backward compatibility */ }
9294
};
9395

9496
#endif

cores/esp8266/Schedule.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ bool schedule_function(std::function<void(void)> fn)
6565

6666
void run_scheduled_functions()
6767
{
68-
while (sFirst) {
69-
scheduled_fn_t* item = sFirst;
70-
sFirst = item->mNext;
71-
if (sFirst == NULL) {
72-
sLast = NULL;
73-
}
68+
scheduled_fn_t* rFirst = sFirst;
69+
sFirst = NULL;
70+
sLast = NULL;
71+
while (rFirst) {
72+
scheduled_fn_t* item = rFirst;
73+
rFirst = item->mNext;
7474
item->mFunc();
7575
item->mFunc = std::function<void(void)>();
7676
recycle_fn(item);

cores/esp8266/Stream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class Stream: public Print {
4747
virtual int available() = 0;
4848
virtual int read() = 0;
4949
virtual int peek() = 0;
50-
virtual void flush() = 0;
5150

5251
Stream() {
5352
_timeout = 1000;

0 commit comments

Comments
 (0)