Skip to content

Commit 4a88c94

Browse files
committed
Merge remote-tracking branch 'remotes/esp8266/master'
2 parents b2a6ab8 + 5e19757 commit 4a88c94

File tree

7 files changed

+51
-15
lines changed

7 files changed

+51
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Documentation: [http://esp8266.github.io/Arduino/versions/2.0.0/](http://esp8266
3838
##### Staging version ![](http://arduino.esp8266.com/staging/badge.svg)
3939
Boards manager link: `http://arduino.esp8266.com/staging/package_esp8266com_index.json`
4040

41-
Documentation: [http://esp8266.github.io/Arduino/versions/2.1.0-rc1/](http://esp8266.github.io/Arduino/versions/2.1.0-rc1/)
41+
Documentation: [http://esp8266.github.io/Arduino/versions/2.1.0-rc2/](http://esp8266.github.io/Arduino/versions/2.1.0-rc2/)
4242

4343
### Using git version [![Linux build status](https://travis-ci.org/esp8266/Arduino.svg)](https://travis-ci.org/esp8266/Arduino)
4444

cores/esp8266/Esp.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,28 @@ bool EspClass::checkFlashConfig(bool needsEquals) {
329329
return false;
330330
}
331331

332+
String EspClass::getResetReason(void) {
333+
char buff[32];
334+
if (resetInfo.reason == REASON_DEFAULT_RST) { // normal startup by power on
335+
strcpy_P(buff, PSTR("Power on"));
336+
} else if (resetInfo.reason == REASON_WDT_RST) { // hardware watch dog reset
337+
strcpy_P(buff, PSTR("Hardware Watchdog"));
338+
} else if (resetInfo.reason == REASON_EXCEPTION_RST) { // exception reset, GPIO status won’t change
339+
strcpy_P(buff, PSTR("Exception"));
340+
} else if (resetInfo.reason == REASON_SOFT_WDT_RST) { // software watch dog reset, GPIO status won’t change
341+
strcpy_P(buff, PSTR("Software Watchdog"));
342+
} else if (resetInfo.reason == REASON_SOFT_RESTART) { // software restart ,system_restart , GPIO status won’t change
343+
strcpy_P(buff, PSTR("Software/System restart"));
344+
} else if (resetInfo.reason == REASON_DEEP_SLEEP_AWAKE) { // wake up from deep-sleep
345+
strcpy_P(buff, PSTR("Deep-Sleep Wake"));
346+
} else if (resetInfo.reason == REASON_EXT_SYS_RST) { // external system reset
347+
strcpy_P(buff, PSTR("External System"));
348+
} else {
349+
strcpy_P(buff, PSTR("Unknown"));
350+
}
351+
return String(buff);
352+
}
353+
332354
String EspClass::getResetInfo(void) {
333355
if(resetInfo.reason != 0) {
334356
char buff[200];

cores/esp8266/Esp.h

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class EspClass {
131131
uint32_t getFreeSketchSpace();
132132
bool updateSketch(Stream& in, uint32_t size, bool restartOnFail = false, bool restartOnSuccess = true);
133133

134+
String getResetReason();
134135
String getResetInfo();
135136
struct rst_info * getResetInfoPtr();
136137

doc/changes.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ title: Change Log
66

77
### Core
88

9+
- Add function to know last reset resaon.
910
- Allow control of enabling debug and debug level from IDE
1011
- Make HardwareSerial::begin() and end() interrupt safe
1112
- Put HardwareSerial and cbuf methods called from interrupt context in RAM
1213
- Re-enable interrupts before directly enqueuing characters in the UART FIFO
1314
- Add espduino board
1415
- Rework StreamString::write to use String internal buffer directly (#1289)
1516
- Add function to measure stack high water mark
16-
- Update SDK to esp_iot_sdk_v1.5.0_15_12_15_p1
1717
- Fix RAM corruption caused by our hook of register_chipv6_phy(init_data*).
1818
- Optimize PWM interrupt handler for better precision
1919
- Add warning levels configurable through Preferences
@@ -22,6 +22,9 @@ title: Change Log
2222
- Set CPU frequency before running setup
2323
- Add core_esp8266_features.h to be able to detect the features and libraries included in the ESP core
2424
- Added ESPino to supported boards
25+
- Fix pwm first step getting skipped
26+
- Update SDK to 1.5.1_16_01_08
27+
- HardwareSerial: allow mapping of UART0 TX to GPIO2
2528

2629
### Libraries
2730

@@ -39,6 +42,13 @@ title: Change Log
3942
- Fix link-time dependency of ESP8266WebServer on SPIFFS (#862)
4043
- Allow setting client side TLS key and certificate
4144
- Replace chain of UDP pbufs with a single pbuf before sending (#1009)
45+
- Unique Built-In libraries library.properties name
46+
- Improvements for MD5Builder with Stream
47+
- ESP8266SSDP: fixing TTL to 2 per spec
48+
- ESP8266WebServer: a content length of zero should also be sent
49+
- Use SoftwareSerial version 2.2
50+
- EEPROM: optimised `_dirty` flag
51+
- ESP8266mDNS: advertise all hosted services
4252
- Remove bundled OneWire - ESP8266 support has been merged in the official OneWire sources
4353

4454
### Tools

doc/libraries.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ APIs related to deep sleep and watchdog timer are available in the `ESP` object,
8383

8484
`ESP.restart()` restarts the CPU.
8585

86+
`ESP.getResetReason()` returns String containing the last reset resaon in human readable format.
87+
8688
`ESP.getFreeHeap()` returns the free heap size.
8789

8890
`ESP.getChipId()` returns the ESP8266 chip ID as a 32-bit integer.
@@ -141,10 +143,11 @@ Libraries that don't rely on low-level access to AVR registers should work well.
141143
- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git)
142144
- [DHT-sensor-library](https://github.com/adafruit/DHT-sensor-library) - Arduino library for the DHT11/DHT22 temperature and humidity sensors. Download latest v1.1.1 library and no changes are necessary. Older versions should initialize DHT as follows: `DHT dht(DHTPIN, DHTTYPE, 15)`
143145
- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
144-
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with ESP8266. Use the "NeoPixelAnimator" branch for ESP8266 to get HSL color support and more.
146+
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with ESP8266. Use the "DmaDriven" or "UartDriven" branches for ESP8266. Includes HSL color support and more.
145147
- [PubSubClient](https://github.com/Imroy/pubsubclient) - MQTT library by @Imroy.
146148
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
147149
- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB.
148150
- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific.
151+
- [Task](https://github.com/Makuna/Task) - Arduino Nonpreemptive multitasking library. While similiar to the included Ticker library in the functionality provided, this library was meant for cross Arduino compatibility.
149152
- [UTFT-ESP8266](https://github.com/gnulabis/UTFT-ESP8266) - UTFT display library with support for ESP8266. Only serial interface (SPI) displays are supported for now (no 8-bit parallel mode, etc). Also includes support for the hardware SPI controller of the ESP8266.
150153
- [WiFiManager](https://github.com/tzapu/WiFiManager) - WiFi Connection manager with web captive portal. If it can't connect, it starts AP mode and a configuration portal so you can choose and enter WiFi credentials.

tools/espota.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
9292
logging.info('Sending invitation to: %s', remoteAddr)
9393
sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
9494
remote_address = (remoteAddr, int(remotePort))
95-
sent = sock2.sendto(message, remote_address)
95+
sent = sock2.sendto(message.encode(), remote_address)
9696
sock2.settimeout(10)
9797
try:
98-
data = sock2.recv(37)
98+
data = sock2.recv(37).decode()
9999
except:
100100
logging.error('No Answer')
101101
sock2.close()
@@ -111,10 +111,10 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
111111
sys.stderr.write('Authenticating...')
112112
sys.stderr.flush()
113113
message = '%d %s %s\n' % (AUTH, cnonce, result)
114-
sock2.sendto(message, remote_address)
114+
sock2.sendto(message.encode(), remote_address)
115115
sock2.settimeout(10)
116116
try:
117-
data = sock2.recv(32)
117+
data = sock2.recv(32).decode()
118118
except:
119119
sys.stderr.write('FAIL\n')
120120
logging.error('No Answer to our Authentication')
@@ -173,7 +173,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
173173
logging.info('Waiting for result...')
174174
try:
175175
connection.settimeout(60)
176-
data = connection.recv(32)
176+
data = connection.recv(32).decode()
177177
logging.info('Result: %s' ,data)
178178
connection.close()
179179
f.close()

tools/sdk/include/user_interface.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
#endif
2424

2525
enum rst_reason {
26-
REASON_DEFAULT_RST = 0,
27-
REASON_WDT_RST = 1,
28-
REASON_EXCEPTION_RST = 2,
29-
REASON_SOFT_WDT_RST = 3,
30-
REASON_SOFT_RESTART = 4,
31-
REASON_DEEP_SLEEP_AWAKE = 5,
32-
REASON_EXT_SYS_RST = 6
26+
REASON_DEFAULT_RST = 0, /* normal startup by power on */
27+
REASON_WDT_RST = 1, /* hardware watch dog reset */
28+
REASON_EXCEPTION_RST = 2, /* exception reset, GPIO status won’t change */
29+
REASON_SOFT_WDT_RST = 3, /* software watch dog reset, GPIO status won’t change */
30+
REASON_SOFT_RESTART = 4, /* software restart ,system_restart , GPIO status won’t change */
31+
REASON_DEEP_SLEEP_AWAKE = 5, /* wake up from deep-sleep */
32+
REASON_EXT_SYS_RST = 6 /* external system reset */
3333
};
3434

3535
struct rst_info{

0 commit comments

Comments
 (0)