Show unknown error ID

This commit is contained in:
Jasper Blanckenburg 2023-05-22 05:55:33 +02:00
parent 7b335536e2
commit 0a180764f9
1 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,8 @@
#include "touchgfx/Unicode.hpp" #include "touchgfx/Unicode.hpp"
#include "vehicle.h" #include "vehicle.h"
#include <cstdio>
ErrorPopup::ErrorPopup() {} ErrorPopup::ErrorPopup() {}
void ErrorPopup::initialize() { ErrorPopupBase::initialize(); } void ErrorPopup::initialize() { ErrorPopupBase::initialize(); }
@ -39,7 +41,10 @@ void ErrorPopup::showAMSError() {
panicKindStr = "OPEN WIRE"; panicKindStr = "OPEN WIRE";
break; break;
default: 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::UnicodeChar panicKindBuf[32];
touchgfx::Unicode::strncpy(panicKindBuf, panicKindStr, touchgfx::Unicode::strncpy(panicKindBuf, panicKindStr,
@ -65,8 +70,9 @@ void ErrorPopup::showAMSError() {
break; break;
case AMS_ERROR_NONE: case AMS_ERROR_NONE:
default: default:
touchgfx::Unicode::strncpy(detailsBuffer, "UNKNOWN ERROR", touchgfx::Unicode::snprintf(
sizeof(detailsBuffer) / sizeof(*detailsBuffer)); detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer),
"UNKNOWN ERROR (%02x)", vehicle_state.last_ams_error.kind);
break; break;
} }
details.setWildcard(detailsBuffer); details.setWildcard(detailsBuffer);