Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit158039e

Browse files
dirkmuellerearlephilhower
authored andcommitted
Reduce mem footprint of ESP.getResetInfo() (#7030)
This function has excessively long datastrings that canbetter be stored in flash, reducing runtime memory footprint.Also detailed formatting only makes sense when there is anexception or a watchdog. In other cases instead of printingan unhelpful "flag: 0" we can just return the ResetReason, whichis much more readable.Saves about 120 bytes of (data) memory.
1 parent00440cd commit158039e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎cores/esp8266/Esp.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,14 @@ String EspClass::getResetReason(void) {
490490
}
491491

492492
StringEspClass::getResetInfo(void) {
493-
if(resetInfo.reason!=0) {
493+
if(resetInfo.reason>= REASON_WDT_RST && resetInfo.reason <= REASON_SOFT_WDT_RST) {
494494
char buff[200];
495-
sprintf(&buff[0],"Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x", resetInfo.exccause, resetInfo.reason, (resetInfo.reason ==0 ?"DEFAULT" : resetInfo.reason ==1 ?"WDT" : resetInfo.reason ==2 ?"EXCEPTION" : resetInfo.reason ==3 ?"SOFT_WDT" : resetInfo.reason ==4 ?"SOFT_RESTART" : resetInfo.reason ==5 ?"DEEP_SLEEP_AWAKE" : resetInfo.reason ==6 ?"EXT_SYS_RST" :"???"), resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
495+
sprintf_P(buff,PSTR("Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x"),
496+
resetInfo.exccause, resetInfo.reason,getResetReason().c_str(),
497+
resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
496498
returnString(buff);
497499
}
498-
returnString("flag: 0");
500+
returngetResetReason();
499501
}
500502

501503
structrst_info *EspClass::getResetInfoPtr(void) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp