@@ -329,6 +329,28 @@ bool EspClass::checkFlashConfig(bool needsEquals) {
329
329
return false ;
330
330
}
331
331
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
+
332
354
String EspClass::getResetInfo (void ) {
333
355
if (resetInfo.reason != 0 ) {
334
356
char buff[200 ];
0 commit comments