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 "vehicle.h"
#include <cstdio>
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);