Fix crash when displaying slave panic

This commit is contained in:
Jasper Blanckenburg 2023-05-22 05:52:11 +02:00
parent 02ea501c81
commit 7b335536e2
1 changed files with 3 additions and 1 deletions

View File

@ -38,13 +38,15 @@ void ErrorPopup::showAMSError() {
case AMS_SLAVEPANIC_OPENWIRE:
panicKindStr = "OPEN WIRE";
break;
default:
panicKindStr = "UNKNOWN";
}
touchgfx::Unicode::UnicodeChar panicKindBuf[32];
touchgfx::Unicode::strncpy(panicKindBuf, panicKindStr,
sizeof(panicKindBuf) / sizeof(*panicKindBuf));
touchgfx::Unicode::snprintf(
detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer),
"Slave panic: Slave %d\n[ID: %d, Kind: %s, Arg: %08x]",
"Slave panic:\n[ID: %d, Kind: %s, Arg: %08x]",
vehicle_state.last_ams_slave_panic.id, panicKindBuf,
vehicle_state.last_ams_slave_panic.arg);
break;