diff --git a/RELEASENOTES.md b/RELEASENOTES.md index e3b1e0fb4..42788a5b9 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -60,3 +60,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add SerialConfig to ``Status 1`` - Add WifiPower to ``Status 5`` - Add support for DS1624, DS1621 Temperature sensor by Leonid Myravjev +- Add Zigbee attribute decoder for Xiaomi Aqara Cube diff --git a/tasmota/support.ino b/tasmota/support.ino index 32ef55731..8010f1e5c 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -57,8 +57,13 @@ void OsWatchTicker(void) // AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space RtcSettings.oswatch_blocked_loop = 1; RtcSettingsSave(); + // ESP.restart(); // normal reboot - ESP.reset(); // hard reset +// ESP.reset(); // hard reset + + // Force an exception to get a stackdump + volatile uint32_t dummy; + dummy = *((uint32_t*) 0x00000000); } } diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 397d60f30..0762fa329 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -333,9 +333,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) || (ResetReason() == REASON_SOFT_WDT_RST); - if (!exception_flg && (12 == payload)) { payload = 99; } + if (!CrashFlag() && (12 == payload)) { payload = 99; } if ((0 == payload) || (99 == payload)) { uint32_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present; @@ -482,7 +480,7 @@ void CmndStatus(void) MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "11")); } - if (exception_flg) { + if (CrashFlag()) { if ((0 == payload) || (12 == payload)) { Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS12_STATUS "\":")); CrashDump(); @@ -578,6 +576,9 @@ void CmndRestart(void) case -2: CmndWDT(); break; + case -3: + CmndBlockedLoop(); + break; case 99: AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); EspRestart(); diff --git a/tasmota/support_crash_recorder.ino b/tasmota/support_crash_recorder.ino index d354adb3b..a51cb5dd2 100644 --- a/tasmota/support_crash_recorder.ino +++ b/tasmota/support_crash_recorder.ino @@ -50,7 +50,7 @@ void CmndCrash(void) dummy = *((uint32_t*) 0x00000000); } -// do an infinite loop to trigger WDT watchdog +// Do an infinite loop to trigger WDT watchdog void CmndWDT(void) { volatile uint32_t dummy = 0; @@ -59,6 +59,14 @@ void CmndWDT(void) } } +// This will trigger the os watch after OSWATCH_RESET_TIME (=120) seconds +void CmndBlockedLoop(void) +{ + while (1) { + delay(1000); + } +} + // Clear the RTC dump counter when we do a normal reboot, this avoids garbage data to stay in RTC void CrashDumpClear(void) { @@ -70,6 +78,11 @@ void CrashDumpClear(void) * CmndCrashDump - dump the crash history - called by `Status 12` \*********************************************************************************************/ +bool CrashFlag(void) +{ + return ((ResetReason() == REASON_EXCEPTION_RST) || (ResetReason() == REASON_SOFT_WDT_RST) || oswatch_blocked_loop); +} + void CrashDump(void) { ResponseAppend_P(PSTR("{\"Exception\":%d,\"Reason\":\"%s\",\"EPC\":[\"%08x\",\"%08x\",\"%08x\"],\"EXCVADDR\":\"%08x\",\"DEPC\":\"%08x\""), diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index 910a2ea6f..3544ec070 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -532,7 +532,7 @@ void MqttConnected(void) } #endif // USE_WEBSERVER Response_P(PSTR("{\"" D_JSON_RESTARTREASON "\":")); - if (ResetReason() == REASON_EXCEPTION_RST) { + if (CrashFlag()) { CrashDump(); } else { ResponseAppend_P(PSTR("\"%s\""), GetResetReason().c_str());