mirror of https://github.com/arendst/Tasmota.git
Add full exception data to Status 1
This commit is contained in:
parent
7777fa08b0
commit
0f68ccfe23
|
@ -24,22 +24,6 @@ extern "C" {
|
||||||
extern struct rst_info resetInfo;
|
extern struct rst_info resetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ResetReason(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
user_interface.h
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
return resetInfo.reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Watchdog extension (https://github.com/esp8266/Arduino/issues/1532)
|
* Watchdog extension (https://github.com/esp8266/Arduino/issues/1532)
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
@ -92,6 +76,26 @@ void OsWatchLoop(void)
|
||||||
// while(1) delay(1000); // this will trigger the os watch
|
// while(1) delay(1000); // this will trigger the os watch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OsWatchBlockedLoop(void)
|
||||||
|
{
|
||||||
|
return oswatch_blocked_loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t ResetReason(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
user_interface.h
|
||||||
|
REASON_DEFAULT_RST = 0, // "Power on" normal startup by power on
|
||||||
|
REASON_WDT_RST = 1, // "Hardware Watchdog" hardware watch dog reset
|
||||||
|
REASON_EXCEPTION_RST = 2, // "Exception" exception reset, GPIO status won’t change
|
||||||
|
REASON_SOFT_WDT_RST = 3, // "Software Watchdog" software watch dog reset, GPIO status won’t change
|
||||||
|
REASON_SOFT_RESTART = 4, // "Software/System restart" software restart ,system_restart , GPIO status won’t change
|
||||||
|
REASON_DEEP_SLEEP_AWAKE = 5, // "Deep-Sleep Wake" wake up from deep-sleep
|
||||||
|
REASON_EXT_SYS_RST = 6 // "External System" external system reset
|
||||||
|
*/
|
||||||
|
return resetInfo.reason;
|
||||||
|
}
|
||||||
|
|
||||||
String GetResetReason(void)
|
String GetResetReason(void)
|
||||||
{
|
{
|
||||||
if (oswatch_blocked_loop) {
|
if (oswatch_blocked_loop) {
|
||||||
|
@ -103,9 +107,10 @@ String GetResetReason(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OsWatchBlockedLoop(void)
|
String GetResetReasonInfo(void)
|
||||||
{
|
{
|
||||||
return oswatch_blocked_loop;
|
// "Fatal exception:0 flag:2 (EXCEPTION) epc1:0x704022a7 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"
|
||||||
|
return (ResetReason() == REASON_EXCEPTION_RST) ? ESP.getResetInfo() : GetResetReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
|
|
|
@ -369,7 +369,7 @@ void CmndStatus(void)
|
||||||
D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\",\"" D_JSON_STARTUPUTC "\":\"%s\",\"" D_CMND_SLEEP "\":%d,\""
|
D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\",\"" D_JSON_STARTUPUTC "\":\"%s\",\"" D_CMND_SLEEP "\":%d,\""
|
||||||
D_JSON_CONFIG_HOLDER "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"),
|
D_JSON_CONFIG_HOLDER "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"),
|
||||||
baudrate, Settings.mqtt_grptopic, Settings.ota_url,
|
baudrate, Settings.mqtt_grptopic, Settings.ota_url,
|
||||||
GetResetReason().c_str(), GetUptime().c_str(), GetDateAndTime(DT_RESTART).c_str(), Settings.sleep,
|
GetResetReasonInfo().c_str(), GetUptime().c_str(), GetDateAndTime(DT_RESTART).c_str(), Settings.sleep,
|
||||||
Settings.cfg_holder, Settings.bootcount, Settings.save_flag, GetSettingsAddress());
|
Settings.cfg_holder, Settings.bootcount, Settings.save_flag, GetSettingsAddress());
|
||||||
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "1"));
|
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "1"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,7 @@ void MqttConnected(void)
|
||||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "2"));
|
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "2"));
|
||||||
}
|
}
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
Response_P(PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), (GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str());
|
Response_P(PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), GetResetReasonInfo().c_str());
|
||||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3"));
|
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3"));
|
||||||
MqttPublishAllPowerState();
|
MqttPublishAllPowerState();
|
||||||
if (Settings.tele_period) {
|
if (Settings.tele_period) {
|
||||||
|
|
Loading…
Reference in New Issue