-
Notifications
You must be signed in to change notification settings - Fork 0
DS_CAP_SYS_RESET
Denis Stepanov edited this page May 14, 2021
·
4 revisions
This capability adds support for reading the last reset reason. The following method is provided:
uint32 System::getResetReason(); // Return reset reason
This is just a thin interface to the built-in function ESP.getResetInfoPtr()
. The return codes are defined in ESP8266 Arduino headers:
enum rst_reason {
REASON_DEFAULT_RST = 0, /* normal startup by power on */
REASON_WDT_RST = 1, /* hardware watch dog reset */
REASON_EXCEPTION_RST = 2, /* exception reset, GPIO status won’t change */
REASON_SOFT_WDT_RST = 3, /* software watch dog reset, GPIO status won’t change */
REASON_SOFT_RESTART = 4, /* software restart ,system_restart , GPIO status won’t change */
REASON_DEEP_SLEEP_AWAKE = 5, /* wake up from deep-sleep */
REASON_EXT_SYS_RST = 6 /* external system reset */
};
- ESP8266 Arduino Core — ESP class implementation
None.
None.
MySystem.h
:
#define DS_CAP_SYS_RESET // Enable software reset interface
#include "System.h" // System global definitions
sketch.ino
:
#include "MySystem.h"
using namespace ds;
void setup() {
bool deep_sleep = System::getResetReason() == REASON_DEEP_SLEEP_AWAKE;
}
void loop() {
}
System::begin() |
Not required |
System::update() |
Not required |
- Returning reset reason as a string, as well as allowing triggering a reset would be obvious additions (issue #7).
Version 1.0 or later.
None.
- DS_CAP_APP_ID
- DS_CAP_APP_LOG
- DS_CAP_BUTTON
- DS_CAP_MDNS
- DS_CAP_SYS_FS
- DS_CAP_SYS_LED
- DS_CAP_SYS_LOG
- DS_CAP_SYS_LOG_HW
- DS_CAP_SYS_NETWORK
- DS_CAP_SYS_RESET
- DS_CAP_SYS_RTCMEM
- DS_CAP_SYS_TIME
- DS_CAP_SYS_UPTIME
- DS_CAP_TIMERS
- DS_CAP_TIMERS_ABS
- DS_CAP_TIMERS_COUNT_ABS
- DS_CAP_TIMERS_COUNT_TICK
- DS_CAP_TIMERS_SOLAR
- DS_CAP_WEB_TIMERS
- DS_CAP_WEBSERVER
- DS_CAP_WIFIMANAGER