mirror of https://github.com/arendst/Tasmota.git
remove crash recorder from safeboot (#21332)
* remove crash recorder from safeboot * small refactor
This commit is contained in:
parent
6f20dcd0ed
commit
9b8cd42e5f
|
@ -1,5 +1,7 @@
|
|||
Import('env')
|
||||
|
||||
build_flags = " ".join(env.GetProjectOption("build_flags"))
|
||||
|
||||
#
|
||||
# Dump build environment (for debug)
|
||||
#print env.Dump()
|
||||
|
@ -8,6 +10,10 @@ Import('env')
|
|||
flags = " ".join(env['LINKFLAGS'])
|
||||
flags = flags.replace("-u _printf_float", "")
|
||||
flags = flags.replace("-u _scanf_float", "")
|
||||
if "FIRMWARE_SAFEBOOT" in build_flags:
|
||||
# Crash Recorder is not included in safeboot firmware -> remove Linker wrap
|
||||
flags = flags.replace("-Wl,--wrap=panicHandler", "")
|
||||
flags = flags.replace("-Wl,--wrap=xt_unhandled_exception", "")
|
||||
newflags = flags.split()
|
||||
|
||||
env.Replace(
|
||||
|
|
|
@ -812,7 +812,9 @@ void CmndStatus(void)
|
|||
if (payload > MAX_STATUS) { return; } // {"Command":"Error"}
|
||||
if (!Settings->flag.mqtt_enabled && (6 == payload)) { return; } // SetOption3 - Enable MQTT
|
||||
if (!TasmotaGlobal.energy_driver && (9 == payload)) { return; }
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
if (!CrashFlag() && (12 == payload)) { return; }
|
||||
#endif // FIRMWARE_SAFEBOOT
|
||||
if (!Settings->flag3.shutter_mode && (13 == payload)) { return; }
|
||||
|
||||
char stemp[200];
|
||||
|
@ -1042,6 +1044,7 @@ void CmndStatus(void)
|
|||
CmndStatusResponse(11);
|
||||
}
|
||||
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
if (CrashFlag()) {
|
||||
if ((0 == payload) || (12 == payload)) {
|
||||
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS12_STATUS "\":"));
|
||||
|
@ -1050,6 +1053,7 @@ void CmndStatus(void)
|
|||
CmndStatusResponse(12);
|
||||
}
|
||||
}
|
||||
#endif // FIRMWARE_SAFEBOOT
|
||||
|
||||
#ifdef USE_SHUTTER
|
||||
if ((0 == payload) || (13 == payload)) {
|
||||
|
@ -1252,6 +1256,7 @@ void CmndRestart(void)
|
|||
TasmotaGlobal.restart_deepsleep = true;
|
||||
ResponseCmndChar(PSTR("Go to sleep"));
|
||||
break;
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
case -1:
|
||||
CmndCrash(); // force a crash
|
||||
break;
|
||||
|
@ -1261,6 +1266,7 @@ void CmndRestart(void)
|
|||
case -3:
|
||||
CmndBlockedLoop();
|
||||
break;
|
||||
#endif // FIRMWARE_SAFEBOOT
|
||||
case 99:
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
|
||||
EspRestart();
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
|
||||
// Generate a crash to test the crash recorder
|
||||
void CmndCrash(void)
|
||||
{
|
||||
|
@ -359,5 +361,7 @@ void CrashDump(void)
|
|||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // FIRMWARE_SAFEBOOT
|
|
@ -1159,7 +1159,9 @@ void WifiDisable(void) {
|
|||
void EspRestart(void) {
|
||||
ResetPwm();
|
||||
WifiShutdown(true);
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
CrashDumpClear(); // Clear the stack dump in RTC
|
||||
#endif // FIRMWARE_SAFEBOOT
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||
GpioForceHoldRelay(); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep
|
||||
|
|
|
@ -1018,9 +1018,12 @@ void MqttConnected(void) {
|
|||
}
|
||||
#endif // USE_WEBSERVER
|
||||
Response_P(PSTR("{\"Info3\":{\"" D_JSON_RESTARTREASON "\":"));
|
||||
#ifndef FIRMWARE_SAFEBOOT
|
||||
if (CrashFlag()) {
|
||||
CrashDump();
|
||||
} else {
|
||||
} else
|
||||
#endif // FIRMWARE_SAFEBOOT
|
||||
{
|
||||
ResponseAppend_P(PSTR("\"%s\""), GetResetReason().c_str());
|
||||
}
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_BOOTCOUNT "\":%d}}"), Settings->bootcount +1);
|
||||
|
|
Loading…
Reference in New Issue