Add WDT crash status

This commit is contained in:
Hadinger 2019-12-28 13:14:51 +01:00
parent 5f62b59f05
commit 4d9c551083
2 changed files with 13 additions and 1 deletions

View File

@ -334,7 +334,7 @@ void CmndStatus(void)
if ((!Settings.flag.mqtt_enabled) && (6 == payload)) { payload = 99; } // SetOption3 - Enable MQTT
if (!energy_flg && (9 == payload)) { payload = 99; }
bool exception_flg = (ResetReason() == REASON_EXCEPTION_RST);
bool exception_flg = (ResetReason() == REASON_EXCEPTION_RST) || (ResetReason() == REASON_SOFT_WDT_RST);
if (!exception_flg && (12 == payload)) { payload = 99; }
if ((0 == payload) || (99 == payload)) {
@ -575,6 +575,9 @@ void CmndRestart(void)
case -1:
CmndCrash(); // force a crash
break;
case -2:
CmndWDT();
break;
case 99:
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
EspRestart();

View File

@ -50,6 +50,15 @@ void CmndCrash(void)
dummy = *((uint32_t*) 0x00000000);
}
// do an infinite loop to trigger WDT watchdog
void CmndWDT(void)
{
volatile uint32_t dummy = 0;
while (1) {
dummy++;
}
}
// Clear the RTC dump counter when we do a normal reboot, this avoids garbage data to stay in RTC
void CrashDumpClear(void)
{