From 0a180764f9a49c9b1be66825ff9d37b78e97161b Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Mon, 22 May 2023 05:55:33 +0200 Subject: [PATCH] Show unknown error ID --- TouchGFX/gui/src/containers/ErrorPopup.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/TouchGFX/gui/src/containers/ErrorPopup.cpp b/TouchGFX/gui/src/containers/ErrorPopup.cpp index 7687e40..4a760f9 100644 --- a/TouchGFX/gui/src/containers/ErrorPopup.cpp +++ b/TouchGFX/gui/src/containers/ErrorPopup.cpp @@ -4,6 +4,8 @@ #include "touchgfx/Unicode.hpp" #include "vehicle.h" +#include + ErrorPopup::ErrorPopup() {} void ErrorPopup::initialize() { ErrorPopupBase::initialize(); } @@ -39,7 +41,10 @@ void ErrorPopup::showAMSError() { panicKindStr = "OPEN WIRE"; break; default: - panicKindStr = "UNKNOWN"; + static char unknownPanicBuf[32]; + snprintf(unknownPanicBuf, sizeof(unknownPanicBuf), "UNKNOWN (%02x)", + vehicle_state.last_ams_slave_panic.kind); + panicKindStr = unknownPanicBuf; } touchgfx::Unicode::UnicodeChar panicKindBuf[32]; touchgfx::Unicode::strncpy(panicKindBuf, panicKindStr, @@ -65,8 +70,9 @@ void ErrorPopup::showAMSError() { break; case AMS_ERROR_NONE: default: - touchgfx::Unicode::strncpy(detailsBuffer, "UNKNOWN ERROR", - sizeof(detailsBuffer) / sizeof(*detailsBuffer)); + touchgfx::Unicode::snprintf( + detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer), + "UNKNOWN ERROR (%02x)", vehicle_state.last_ams_error.kind); break; } details.setWildcard(detailsBuffer);